drizopoulos / JM

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

hard coded n of knots is causing an error with custom knots #12

Closed smouksassi closed 2 years ago

smouksassi commented 6 years ago

I have a joint model with the form


jointFit<- jointModel(lmeFitBsp.pro, coxFit.pro,
                              timeVar = "time", method = "piecewise-PH-aGH",
                              knots=c(150,175,200,225,250,260,270,280,300))

where the events come much later in the time period so the default 7 knots will not work and I am setting them manually when I try to get a roc :

rocJM(jointFit, dt = 5, data = plcbData,
+                     M = 1000, burn.in = 500)

I get

Error in optim(rep(0, ncz), ff, gg, y = y.new, tt = survMats.last, mm = method,  : 
  initial value in 'vmmin' is not finite
In addition: There were 50 or more warnings (use warnings() to see the first 50)

Warning messages: In wk * rep(P, each = 7) : longer object length is not a multiple of shorter object length

I think it is realted to this where the n = 7 default knots is hard coded:

https://github.com/drizopoulos/JM/blob/05bfde1addba3138258cc25bbbb661b4032e6b24/R/log.posterior.b.R#L62

agstone90 commented 3 years ago

Did you ever resolve this? I am getting the same error, but only for the cumulative effects parameterization of my model.

smouksassi commented 3 years ago

I had to hack the internals of JM for my particular model did not really see additional developments since then (other the internal namings of survfit obj that I submitted in another issue). I rely and like JM very much @drizopoulos how can we help you have done amazing tools for mixed and joint models!