RE: [R] glm family=binomial logistic sigmoid curve problem

From: <Bill.Venables_at_csiro.au>
Date: Mon 11 Apr 2005 - 17:17:35 EST


Couple of points:

Here's how I would (minimally) correct your script:

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 = quasibinomial) points(year, fitted(bm), pch = 3)
curve(predict(bm, data.frame(year = x), type = "resp"), add = TRUE)

Supplementary points:

-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch
[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of James Salsman Sent: Monday, 11 April 2005 4:51 PM
To: r-help@stat.math.ethz.ch
Subject: [R] glm family=binomial logistic sigmoid curve problem

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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Apr 11 17:21:31 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:06 EST