drizopoulos / JM

Joint Models for Longitudinal & Survival Data under Maximum Likelihood
34 stars 7 forks source link

Error in optim(thetas, opt.survPC, gr.survPC, method = "BFGS", control = list(maxit = if (it < : non-finite value supplied by optim #39

Closed anandhari97 closed 1 year ago

anandhari97 commented 1 year ago

Hi, I am a beginner in the area of Joint Models in survival analysis. While running R codes for Joint Model for Longitudinal and time to event data, I got the following error:

**Error in optim(thetas, opt.survPC, gr.survPC, method = "BFGS", control = list(maxit = if (it < : non-finite value supplied by optim**

This is my code for linear mixed model, Survival model, and Joint model. **> lmeFit<- lme (FUCEAvalue ~ year + SEX, random = ~ year| ID, data = longi_data.new)

coxFit<- coxph (Surv(year,DEATH)~ SEX, data = term.evnt.new, x="TRUE") jointFit<- jointModel (lmeFit, coxFit, timeVar = "year", method = "piecewise-PH-aGH")**

Any information and advice you could give is much appreciated.

drizopoulos commented 1 year ago

Do you have a reproducible example?

anandhari97 commented 1 year ago

The linear mixed model and relative risk model run well. But when running joint model it gives error. I tried to use methods, such as "piecewise-PH-GH" and "weibull-PH-GH", "spline-PH-GH" but it does not work. it gives the following mistakes: Error in optim(thetas, opt.survSplinePH, gr.survSplinePH, method = "BFGS", : non-finite value supplied by optim.

But on using "weibull-AFT-aGH" method it runs well.

I don't know what is the problem for other methods. I also tried the commands put (iter.EM = 80, tol3 = 1e-09, numeriDeriv = "cd", eps.Hes = 1e-04) these words at the end of my command, but it still gives the similar mistake. Thank you for your time.

drizopoulos commented 1 year ago

The data you sent can be used to reproduce the error.