From smyth at wehi.edu.au  Thu Jun 12 13:11:25 2003
From: smyth at wehi.edu.au (Gordon Smyth)
Date: Thu Jun 12 04:11:58 2003
Subject: [Rd] bug in glm()? (PR#3223)
In-Reply-To: <200306111537.h5BFbO2b021879@pubhealth.ku.dk>
Message-ID: <5.2.0.9.1.20030612120050.00aef720@imaphost.wehi.edu.au>

At 01:37 AM 12/06/2003, bonnie.lafleur@vanderbilt.edu wrote:
>Full_Name: Bonnie LaFleur
>Version: 1.6.1
>OS: Windows
>Submission from: (NULL) (160.129.25.106)
>
>All,
>
>I sincerely apologize for being so vague with my "bugs" query.  Part of this
>is that it is not directly related to a specific data analysis, but rather
>a part of a bigger project I am working on.  I also apologize if the bugs
>forum is not appropriate for this problem.  Thank you Prof Brian Ripley for
>your point to the glm.control() command, I will work with this for now and
>it will solve my most immediate problems.
>
>Specifically, I am running about 10,000 + permutations through an R program
>on a bewoulf cluster of machines, and needed to get a handle on whether the
>lines and columns of my report output file are consistant, so I can use this
>in debugging the overall program for the parallel processing, as well as
>to keep track of any permutations for which a nonlinear program may not
>converge.
>In trying to answer the number of columns question I tried to find a problem
>which I pretty much know has no reason to converge.  It is totally nonsensical
>data (as you
>can tell).  It does not converge in SAS or Splus for Windows, it does however
>converge in R (version 1.6.1) for Windows and R (version 1.3.1) on linux -
>though, of course the  stimates are obviously suspect.  I am enclosing 
>simple R
>commands
>for these silly data for your perusal.  Thank you for you time, and again,
>I am sorry for the premature post last night.
>
>
>Bonnie
>
>R : Version 1.3.1 (2001-08-31) (on linux)
>
>Y <- c(1,1,1,1,0)
>X1 <- factor(c(0,0,0,1,1))
>X2 <- factor(c(0,0,1,0,0))
>
>logist<- glm(Y ~ X1*X2, family=binomial(link="logit"))
>summary(logist)
>    ## usual logistic output
>logist$converged
>   ## TRUE

Well, others can speak for themselves, but R does for this data exactly 
what I would want a generalized linear model program to do. R finds the 
correct fitted values c(1,1,1,0.5,0,5) to 5 decimal places and the correct 
residual deviance -4*log(0.5) to 4 decimal places. The fitted values for 
the coefficients and theoreticaly infinite, but R does the best that can be 
done by giving large finite values and small t-statistics.

It is true that the fitted coefficients cannot converge for these data, 
because the stationary values are at infinity, but the fitted values and 
residual deviance can and do converge.

Gordon


[Rd] bug in glm()? (PR#3223)
Gordon Smyth