How to increase the number of iterations of a function in R?

Asked

Viewed 166 times

1

My problem is this, when I do the regression

>mod<-glm(y~a+b+c,family=gaussian(link="log"), data = matrix)
Warning message:
glm.fit: algoritmo não convergiu
> summary(mod1)
...
Number of Fisher Scoring iterations: 25

To get around it I did:

>mod1<-glm(y~a+b+c ,family=gaussian(link="log"), data = matrix)
Warning message:
glm.fit: algoritmo não convergiu
>mod1<-glm(y~a+b+c,start=coef(mod1),family=gaussian(link="log"), data = matrix)
>summary(mod1)
...
Number of Fisher Scoring iterations: 6

So how do I increase the iteration rate beyond 25?

  • Unfortunately, this question cannot be reproduced by anyone trying to answer it. Please, take a look at this link and see how to ask a reproducible question in R. So, people who wish to help you will be able to do this in the best possible way.

  • I wouldn’t have been able to put all my dice.frame here.

1 answer

3


The maximum amount of interactions is defined by the function glm.control(epsilon = 1e-8, maxit = 25, trace = FALSE), so the maximum number of interactions is defined by default as 25.
To change it, as for example to 42, you have to call the argument control= of function glm. Thus remaining:

 glm(y~a+b+c, control=glm.control(epsilon = 1e-8, maxit = 42, trace = FALSE),family=gaussian)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.