Roland Deutsch
2014-May-23 12:13 UTC
[R] Error message when fitting a binomial response model using glm
Dear R-help,
during a simulation study using glm, I got the following error message
for which I cannot determine the cause:
Error: inner loop 2; cannot correct step size
Below is the code for which this error occurred is
clog<-function(){
linkfun<-function(mu) qexp(mu)
linkinv<-function(eta) pmax(.Machine$double.eps,pexp(eta))
mu.eta<-function(eta) pmax(dexp(eta),.Machine$double.eps)
valideta<-function(eta) all(eta>0)
link<-"clog"
structure(list(linkfun=linkfun,linkinv=linkinv,mu.eta=mu.eta,valideta=valideta,name="link"),class="link-glm")
}
test<-data.frame(d=c(0,0.04,0.2,0.6,2,4),resp=c(0,1,3,4,24,28),nresp=c(18,21,19,17,1,0))
glm(cbind(resp,nresp)~d+I(d^2)+I(d^3),data=test,family=binomial(clog()))
Any help on why this error occurs and, more importantly, how I can
filter data producing this error would be highly appreciated.
Sincerely,
Roland Deutsch
[[alternative HTML version deleted]]
Adams, Jean
2014-May-23 21:04 UTC
[R] Error message when fitting a binomial response model using glm
Roland,
I did a google search for
R Error: inner loop 2; cannot correct step size
and found an old R-help message that suggests the glm() algorithm cannot
converge.
https://stat.ethz.ch/pipermail/r-help/2009-December/223142.html
I get the same error message as you when I fit
glm(cbind(resp,nresp)~d+I(d^2)+I(d^3),data=test,familybinomial(clog()))
but no error message if I get rid of the last parameter
glm(cbind(resp,nresp)~d+I(d^2),data=test,family=binomial(clog()))
Hope this helps
Jean
On Fri, May 23, 2014 at 7:13 AM, Roland Deutsch
<roland.deutsch@tuwien.ac.at> wrote:
> Dear R-help,
>
> during a simulation study using glm, I got the following error message
> for which I cannot determine the cause:
>
> Error: inner loop 2; cannot correct step size
>
> Below is the code for which this error occurred is
>
> clog<-function(){
> linkfun<-function(mu) qexp(mu)
> linkinv<-function(eta) pmax(.Machine$double.eps,pexp(eta))
> mu.eta<-function(eta) pmax(dexp(eta),.Machine$double.eps)
> valideta<-function(eta) all(eta>0)
> link<-"clog"
>
>
>
structure(list(linkfun=linkfun,linkinv=linkinv,mu.eta=mu.eta,valideta=valideta,name="link"),class="link-glm")
> }
>
>
test<-data.frame(d=c(0,0.04,0.2,0.6,2,4),resp=c(0,1,3,4,24,28),nresp=c(18,21,19,17,1,0))
> glm(cbind(resp,nresp)~d+I(d^2)+I(d^3),data=test,family=binomial(clog()))
>
> Any help on why this error occurs and, more importantly, how I can
> filter data producing this error would be highly appreciated.
>
> Sincerely,
> Roland Deutsch
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>
[[alternative HTML version deleted]]