[R] glm family=binomial logistic sigmoid curve problem

James Salsman james at bovik.org
Mon Apr 11 08:50:40 CEST 2005


I'm trying to plot an extrapolated logistic sigmoid curve using
glm(..., family=binomial) as follows, but neither the fitted()
points or the predict()ed curve are plotting correctly:

 > year <- c(2003+(6/12), 2004+(2/12), 2004+(10/12), 2005+(4/12))
 > percent <- c(0.31, 0.43, 0.47, 0.50)
 > plot(year, percent, xlim=c(2003, 2007), ylim=c(0, 1))
 > lm <- lm(percent ~ year)
 > abline(lm)
 > bm <- glm(percent ~ year, family=binomial)
Warning message:
non-integer #successes in a binomial glm! in: eval(expr, envir, enclos)
 > points(year, fitted(bm), pch="+")
NULL
 > curve(predict(bm, data.frame(year=x)), add=TRUE)

All four of the binomial-fitted points fall exactly on the simple
linear regression line, and the predict() curve is nowhere near any
of the data points.  What am I doing wrong?

What does the warning mean?  Do I need more points?

I am using R on Windows, Version 2.0.1  (2004-11-15)

Thank you for your kind help.

Sincerely,
James Salsman




More information about the R-help mailing list