[R] logistic regression asymptote problem
Spencer Graves
spencer.graves at pdf.com
Tue Jul 5 23:28:58 CEST 2005
I saw a standard overdispersed binomial. In particular, I saw NO
evidence of saturation at 0.5 or anything below 1. I did the following:
tmp$N <- tmp$yes+tmp$no
with(tmp, plot(x, yes))
with(tmp, plot(x, yes/N))
tmp.glm <- glm(cbind(yes,no) ~ x, data = tmp, family = binomial(link
=logit))
tmp.glmq <- glm(cbind(yes,no) ~ x, data = tmp, family =
quasibinomial(link =logit))
summary(tmp.glm)
summary(tmp.glmq)
plot(tmp.glm)
plot(tmp.glmq)
# Test the statistical significance of the "Dispersion" parameter
pchisq(summary(tmp.glmq)$dispersion*12, 12, lower=FALSE)
hope this helps.
spencer graves
Kevin J Emerson wrote:
> 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
>
--
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA
spencer.graves at pdf.com
www.pdf.com <http://www.pdf.com>
Tel: 408-938-4420
Fax: 408-280-7915
More information about the R-help
mailing list