R-alpha: glm

Ross Ihaka (ihaka@stat.auckland.ac.nz)
Wed, 22 May 1996 14:32:29 +1200

Date: Wed, 22 May 1996 14:32:29 +1200
From: Ross Ihaka <ihaka@stat.auckland.ac.nz>
Message-Id: <199605220232.OAA28499@stat.auckland.ac.nz>
To: Jim Lindsey <jlindsey@luc.ac.be>
Subject: R-alpha: glm
In-Reply-To: <9605210817.AA12732@alpha.luc.ac.be>

Jim Lindsey writes:
 > (1) In 0.6, cmd/pager is not executable - it needs chmod a+x


 > (2) On my Linux machine, R does not read .First or .Last. Hence I cannot
 >     set options there.

Are you sure about this?  .First and .Last should be functions of zero
arguments.  It is .First which opens the X11 window.  If you get the
window, .First must be working.

 > (3) Here is my quick fix for convergence of saturated models in glm().
 >     Also trace did not work, so one line for that. Thus, three changes in
 >     library/base/glm:
 > (a) before the line
 > 	#check for divergence
 >      add
 > if(control$trace)cat("Deviance =",dev,"Iterations =",iter,"\n")
 > (b) after the line
 > 	#check for convergence
 >     change to
 > if(dev==0|(abs((dev-devold)/dev^2)<control$epsilon
 > 	&abs((coef-coefold)/sum(coef^2))<control$epsilon)){
 > (c) in  print.summary.glm, in the cat() that runs over several lines,
 > 	remove digits,  :
 > "Residual deviance: ", x$deviance,  #digits,
 >     This error explains why deviances seemed so small: there was an
 > extra 4 tacked on the end of the exponent.

I have a slightly different fix for the convergence problem.  I think
the right test should be something like


So that when dev is large the test is based on relative change and
when dev is close to zero the test is based on absolute change.

 > (4) I still think the output for contrasts in factor variables is very
 >     misleading and should be changed. Not only is the numbering wrong
 >     but, if there are only two levels, R puts no number at all so that
 >     it is impossible to distinguish it from a continuous variate.

I agree that the output is confusing if you want to think in terms
of effects,  but it is set up to work with generally specified
contrasts (we'll have that generality soon), and it makes sense to
index by contrast number.  You could get the effect you want by
changing contr.treatment so that it is the last effect which is set
to zero rather than the first.

I'll think about factor vs variable distinction.  That could be quite
useful (and I'm just about to jump into that code anyway).

r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch