2
$\begingroup$

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)

mydata <- read.sas7bdat("http://www.businessandeconomics.mq.edu.au/our_departments/Applied_Finance_and_Actuarial_Studies/acst_docs/glms_for_insurance_data/data/claims_sas_miner.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?

$\endgroup$
  • $\begingroup$ Sorry about that. I fixed it. $\endgroup$ – user9292 Nov 30 '14 at 6:39
  • $\begingroup$ In addition to the error, I get 10 warning messages when I run your code. How many do you get? $\endgroup$ – Glen_b -Reinstate Monica Nov 30 '14 at 7:10
  • $\begingroup$ library(statmod) solves the problem I had. $\endgroup$ – Glen_b -Reinstate Monica Nov 30 '14 at 7:16
5
$\begingroup$

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)

enter image description here

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.

$\endgroup$
  • $\begingroup$ Many thanks! Why it is not worth the trouble? In what sense? $\endgroup$ – user9292 Nov 30 '14 at 7:34
  • 1
    $\begingroup$ 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. $\endgroup$ – Glen_b -Reinstate Monica Nov 30 '14 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.