Rianti Siswi Utami
2013-Jul-25 04:37 UTC
[R] Error in initial value for qmatrix in msm function
*Hi R-helpers, **I am having a problem in running msm. I have a data with 200 ID, 4 state and transition is allowed for every state.**This is the number of transitions****> statetable.msm(Status,ID,data=dt) to from 1 2 3 4 1 0 54 181 100 2 11 14 7 11 3 49 12 42 10 4 75 6 3 11 ****I use the **crudeinits.msm to get initial value for the qmatrix.> iniq2=crudeinits.msm(Status ~ Time, ID, data=dt, qmatrix=iniq)[,1] [,2] [,3] [,4] [1,] -0.03037171 0.004895739 0.016409791 0.009066183 [2,] 0.05213270 -0.137440758 0.033175355 0.052132701 [3,] 0.08045977 0.019704433 -0.116584565 0.016420361 [4,] 0.12234910 0.009787928 0.004893964 -0.137030995 When I run the msm function with qmatrix=iniq2> m1=msm( Status ~ Time, subject=ID, data = dt,qmatrix = iniq2)* *there is an error message "Error in Pmat < 1e-16 : invalid comparison with complex values" Then I change the initial value become> iniq2[,1] [,2] [,3] [,4] [1,] -0.3 0.1 0.1 0.1 [2,] 0.1 -0.3 0.1 0.1 [3,] 0.1 0.1 -0.3 0.1 [4,] 0.1 0.1 0.1 -0.3 * *Then I run again the msm **> m1=msm( Status ~ Time, subject=ID, data = dt,qmatrix = iniq2) there in an error massage "Error in optim(p$inits, lik.msm, hessian = hessian, gr = gr, ..., msmdata = msmdata, : function cannot be evaluated at initial parameters" * *I have tried to use different initial value for several times, but the same error message always appear. **Do I need to add the data? Does anyone have any suggestions?****Any suggestions would be much appreciated,** **Best wishes,** **Rianti* [[alternative HTML version deleted]]