ich möchte eine lineare Regression berechnen unter der Bedingung, dass der Anstieg 1 ist.
Nach langem Suchen habe ich diese Lösung gefunden:
Code: Alles auswählen
linmodel2 <- lm(formula = y ~ offset(x), data = table)
Code: Alles auswählen
slope <- 1
linmodel2 <- lm(formula = y ~ 1 + offset(x*slope), data = table)
Code: Alles auswählen
Curve_ID <- c("curve_1", "curve_2", "curve_3", "curve_4", "curve_5", "curve_6", "curve_7", "curve_8", "curve_9", "curve_10")
x <- c(2.5e-06, 1.25e-06, 6.25e-07, 3.125e-07, 1.56e-07, 7.8125e-08, 3.906250e-08, 1.953125e-08, 9.765625e-09, 4.882813e-09)
y <- c(38001.886972, 71.366841, 24.365533, 13.003076, 8.356772, 3.562385, 2.548801, 1.406600, 1.431116, 1.311127)
table <- data.frame(Curve_ID, x, y)
table[, "x"] <- log10(table[, "x"])
table[, "y"] <- table[, "y"] - 1
table[, "y"] <- log10(table[, "y"])
plot(y~x, data = table, pch = 8, xlab="log(cAntagonist)", ylab="log(r-1)", ylim = c(-10, 10), xlim = c(-10, 10), main = "Schild-Regression")
linmodel <- lm(
formula = y ~ x,
data = table
)
linmodel2 <- lm(
formula = y ~ offset(x),
data = table
)
# slope chosen by lm(...)
abline(linmodel, coef(linmodel), col="green")
abline(linmodel2, coef(linmodel2), col="red")
Ich hoffe ihr könnt mir weiter helfen.
Vielen Dank,
Markus