Closed misstat closed 2 years ago
Thanks for the report. Could I have a minimal reproducible example please so I can fix?
The error happens when trying to find initial values for the spline model. The solve.QP function is used to find values that satisfy the constraint that the cumulative hazard has to be increasing. So you could work around this bug by supplying your own initial values if you can. There's also a backup routine internal to the package that I could make it use in cases where the QP method fails.
On 23/02/16 09:48, misstat wrote:
Fitting a model of the type:
m1<-flexsurvspline(Surv(Age_Recruitment,Age_Exit,dead)~variable1,data=data,k=1,scale="hazard") I can see the model doesn't fit using this type of Surv object, with right and left censored data, however this running very well inside survival package (this also happens for k greater than 1). The error message says:
|Error in solve.QP(Dmat = t(Xq) %% Xq, dvec = t(t(y) %% Xq), Amat = t(dXq), : matrix D in quadratic function is not positive definite! |
However if I fit the model in this way:
m2<-flexsurvspline(Surv(time_following,dead)~variable1,data=data,k=1,scale="hazard") convergence it is possible. Obviously I am more interested in fit the first model. Why this error occurs ?
Best regards!
— Reply to this email directly or view it on GitHub https://github.com/chjackson/flexsurv-dev/issues/9.
Thank you for your quick response. I will try to put inits for convergence. And also, please accept my apologies because I am working with confidential data and I can not send a reproducible example. ps: Thanks for the package!
The latest commit works around cases where this matrix is not positive definite, but I'm still not clear when this can happen.
Fitting a model of the type:
I can see the model doesn't fit using this type of Surv object, with right and left censored data, however this running very well inside survival package (this also happens for k greater than 1). The error message says:
However if I fit the model in this way:
convergence it is possible. Obviously I am more interested in fit the first model. Why this error occurs ?
Best regards!