# glm.fit: algorithm did not converge -Tweedie

I'm trying to estimate $p$ in tweedie regression, but I got the following message:

glm.fit: algorithm did not converge

I'm using public data from "GLMs for insurance data" book by Piet de Jong, and Gillian Z. Heller. Here is my code:

install.packages("sas7bdat") # A package to read SAS data set
library(sas7bdat)

View(mydata) # Viewing the data

library(tweedie)

out=tweedie.profile(mydata$CLM_AMT~1,p.vec=seq(1.1,1.9,length=9), method="interpolation",do.ci=TRUE,do.smooth=TRUE,do.plot=TRUE) # Estimating p  Any idea? • Sorry about that. I fixed it. – user9292 Nov 30 '14 at 6:39 • In addition to the error, I get 10 warning messages when I run your code. How many do you get? – Glen_b Nov 30 '14 at 7:10 • library(statmod) solves the problem I had. – Glen_b Nov 30 '14 at 7:16 ## 1 Answer The fit at 1.9 doesn't converge but you don't need it, since it's nowhere near the optimum. Try  out=tweedie.profile(mydata$CLM_AMT~1,p.vec=seq(1.1,1.85,length=16),
method="interpolation",do.ci=TRUE,do.smooth=TRUE,do.plot=TRUE) You could probably get it to converge by playing with some of the options (though the likelihood might not change all that much), but it's not worth the trouble.

• Many thanks! Why it is not worth the trouble? In what sense? – user9292 Nov 30 '14 at 7:34
• There are lots of zeros. These tend only to be likely with reasonably small $p$ unless the mean gets really small (smaller as p grows -- even a single zero is impossible at $p=2$), so the likelihood isn't going to go up - we expect it to start dropping dramatically as we get closer to 2. You can see where the peak is, so what purpose is served by knowing a more accurate value for the likelihood at $p=1.9$? It might be interesting to see if you can get convergence, but in respect of the data set, you won't learn anything other than $p$ isn't up near 1.9, which is already clear. – Glen_b Nov 30 '14 at 7:39