I forgot to cc: the list on this response.
---------- Forwarded message ----------
From: Douglas Bates <bates at stat.wisc.edu>
Date: Wed, Dec 30, 2009 at 8:05 AM
Subject: Re: [R] glm error: cannot correct step size
To: John Sorkin <jsorkin at grecc.umaryland.edu>
On Wed, Dec 30, 2009 at 7:50 AM, John Sorkin
<jsorkin at grecc.umaryland.edu> wrote:> R 2.8.1
> windows XP
> I am getting an error message that I don't understand when I try to run
GLM. The error only occurs when I have all independent variables in the model.
When I drop one independent variable, the model runs fine. Can anyone help me
understand what the error means and how I can correct it?
> Thank you,
> John
>
>> fit11<-glm(AAMTCARE~BMI+BMIsq+SEX+jPHI+jMEDICAID+factor(AgeCat)+
> +
factor(jINDINC)+jMARSTAT+jEDUCATION+factor(jsmokercat)+factor(jrace),data=SimData,family=Gamma(link="log"))
> Warning: step size truncated due to divergence
> Error in glm.fit(x = X, y = Y, weights = weights, start = start, etastart =
etastart, ?:
> ?inner loop 1; cannot correct step size
That error message and the warning indicate that the algorithm
(iteratively reweighted least squares or IRLS) for fitting the
parameters cannot converge, which can be because the model is
over-specified. ?As you see, when you remove of the terms you do get
parameter estimates and I would guess that, even then, the model will
be over-specified.
> # Drop factor(jrace) and model runs without a problem.
>> fit11<-glm(AAMTCARE~BMI+BMIsq+SEX+jPHI+jMEDICAID+factor(AgeCat)+
> + factor(jINDINC)+jMARSTAT+jEDUCATION+factor(jsmokercat) ? ? ?
,data=SimData,family=Gamma(link="log"))
>
> # Drop jPHI and model runs without a problem.
>> fit11<-glm(AAMTCARE~BMI+BMIsq+SEX+ ? ?jMEDICAID+factor(AgeCat)+
> +
factor(jINDINC)+jMARSTAT+jEDUCATION+factor(jsmokercat)+jrace,data=SimData,family=Gamma(link="log"))
>
> Thanks,
> John
>
>
> John David Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
> Confidentiality Statement:
> This email message, including any attachments, is for th...{{dropped:6}}
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>