[R] problems with glm

From: Roland R Regoes <roland.regoes_at_env.ethz.ch>
Date: Mon 16 Jan 2006 - 00:04:19 EST


Dear R users,

     I am having some problems with glm. The first is an error message "subscript out of bounds". The second is the fact that reasonable starting values are not accepted by the function.

     To be more specific, here is an example:

> success <- c(13,12,11,14,14,11,13,11,12)
> failure <- c(0,0,0,0,0,0,0,2,2)
> predictor <- c(0,80*5^(0:7))
> glm(cbind(success,failure) ~ predictor + 0,

+           family=binomial(link="log"),
+           control=glm.control(epsilon=1e-8,trace=TRUE,maxit=50))
Deviance = 3.348039 Iterations - 1
Error: subscript out of bounds
In addition: Warning message:
step size truncated: out of bounds
>

        The model with intercept yields:

> glm(cbind(success,failure) ~ predictor ,

+           family=binomial(link="log"),
+           control=glm.control(epsilon=1e-8,trace=FALSE,maxit=50))

Call:  glm(formula = cbind(success, failure) ~ predictor, family = binomial(link = "log"),      control = glm.control(epsilon = 1e-08, trace = FALSE, maxit = 50)) 

Coefficients:
(Intercept) predictor
 -5.830e-17 -4.000e-08

Degrees of Freedom: 8 Total (i.e. Null); 7 Residual

Null Deviance:	    12.08 
Residual Deviance: 2.889 	AIC: 11.8 

There were 33 warnings (use warnings() to see them)
> warnings()

1: step size truncated: out of bounds
...
31: step size truncated: out of bounds
32: algorithm stopped at boundary value in: glm.fit(x = X, y = Y, weights = weights, start = start, etastart = etastart,   ...
33: fitted probabilities numerically 0 or 1 occurred in: glm.fit(x = X, y = Y, weights = weights, start = start, etastart = etastart,   ...

>

        Since the intercept in the above fit is fairly small I thought I could use -4e-8 as a reasonable starting value in a model without intercept. But to no avail:

> glm(cbind(success,failure) ~ predictor + 0, start=-4e-8,

+           family=binomial(link="log"),
+           control=glm.control(epsilon=1e-8,trace=FALSE,maxit=50))
Error in glm.fit(x = X, y = Y, weights = weights, start = start, etastart = etastart,  : 
	cannot find valid starting values: please specify some

>

        I am stuck here. Am I doing something wrong when specifying the starting value? I would appreciate any help. (I could not find anything relevant in the documentation of glm and the mailing list archives, but I did not read the source code of glm yet.)

Roland

PS: I am using R Version 2.2.0 (R Cocoa GUI 1.13 (1915)) on MacOSX 10.4.4

-- 
-----------------------------------------------------------------------
Roland Regoes
Theoretical Biology
Universitaetsstr. 16 
ETH Zentrum, CHN H76.1 
CH-8092 Zurich, Switzerland

tel: +41-44-632-6935
fax: +41-44-632-1271

______________________________________________
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 Jan 16 00:10:57 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:04 EST