chjackson / msm

The msm R package for continuous-time multi-state modelling of panel data
https://chjackson.github.io/msm/
57 stars 16 forks source link

Error with "impossible for given initial state probabilities and outcome model" #26

Closed jacketlin closed 9 months ago

jacketlin commented 3 years ago

Hello Dr. Jackson,

Thank you very much for your excellent work for MSM; I'm a new user of this package and I have faced an issue that I didn't know how to solve it. I wanted to fit a misclassification model with msm of the data about a progressive disease. However, it resulted in a few errors, for example, "initial value in 'vmmin' is not finite" or "Optimisation has probably not converged to the maximum likelihood - Hessian is not positive definite."

Please could you advise?

Many thanks

R-data and code.zip

chjackson commented 3 years ago

Have you checked the suggestions in Section 2.12 of the vignette?

jacketlin commented 3 years ago

I have tried the methods below (independent or combination)

  1. Scaling(for example: control = list(fnscale = 2000 or 100000) as I checked the value of -2 * log-likelihood in model2 was 1936.695, but the value in model1 is inf.
  2. Convergence criteria( I set the reltol = 1e-16)
  3. Choice of algorithm (CG, nlm, L-BFGS-B, Nelder-Mead)
  4. Initial values (random-0.25,0.05, or according to the reference about the disease)
chjackson commented 3 years ago

I tried your code, and there is a warning "First observation of 3.000000 for subject number 151 out of 376 is impossible for given initial state probabilities and outcome model" which explains the failure of the first model.

Otherwise there's no easy solution, it's a matter of simplifying the model until you find out where the data are weakest. Fixing parameters at their initial values can help. I also notice there are very few observations in states 4 and 5, and heavy censoring. Also optim() seems to have trouble finding the Hessian - I got it to converge with fixedpars = 7:11, opt.method = "nlm"