[R] logistic regression asymptote problem
Kevin J Emerson
kemerson at darkwing.uoregon.edu
Tue Jul 5 22:08:29 CEST 2005
R-helpers,
I have a question about logistic regressions.
Consider a case where you have binary data that reaches an asymptote
that is not 1, maybe its 0.5. Can I still use a logistic regression to
fit a curve to this data? If so, how can I do this in R. As far as I
can figure out, using a logit link function assumes that the asymptote
is at y = 1.
An example. Consider the following data:
"tmp" <-
structure(list(x = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14), yes = c(0, 0, 0, 2, 1, 14, 24, 15, 23, 18, 22, 20, 14, 17
), no = c(94, 101, 95, 80, 81, 63, 51, 56, 30, 38, 31, 18, 21,
20)), .Names = c("x", "yes", "no"), row.names = c("1", "2", "3",
"4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"), class =
"data.frame")
where x is the independent variable, and yes and no are counts of
events. plotting the data you can see that the data seem to reach an
asymptote at around y=0.5. using glm to fit a logistic regression it is
easily seen that it does not fit well.
tmp.glm <- glm(cbind(yes,no) ~ x, data = tmp, family = binomial(link =
logit))
plot(tmp.glm$fitted, type = "l", ylim = c(0,1))
par(new=T)
plot(tmp$yes / (tmp$yes + tmp$no), ylim = c(0,1))
Any suggestions would be greatly appreciated.
Cheers,
Kevin
--
------------------------------------
------------------------------------
Kevin J Emerson
Center for Ecology and Evolutionary Biology
1210 University of Oregon
University of Oregon
Eugene, OR 97403
kemerson at darkwing.uoregon.edu
More information about the R-help
mailing list