Page 1 of 1

Error in se.TransitionMatrix

PostPosted: Tue Jan 21, 2020 6:16 pm
by EROB
Hi all,

I am running a multistate model in RMark that runs fine and gives point estimates. However, it gives an error when I try to get the se.TransitionMatrix. Can you provide any advice on how to resolve this error? At first I got a warning message when I used the 'get.real' function:

>top=ms.results$S.stratum.p.stratum.Psi.stratum.t
> Psilist=get.real(top,"Psi",vcv=TRUE)
#In get.real(top, "Psi", vcv = TRUE) :
#Improper V-C matrix for beta estimates. Some variances non-positive.

And then it gives an error when I run se.TransitionMatix with vcv.real (but it runs fine without requesting vcv.real variance matrices):

>Psi.values=Psilist$estimates
> top.psi=TransitionMatrix(Psi.values[Psi.values$time==2014,],vcv.real=Psilist$vcv.real)
#Error in se.TransitionMat/(TransitionMat * (1 - TransitionMat)) :
#non-conformable arrays
#In addition: Warning message:
#In se.TransitionMat[!is.na(pin)] <- x$se[match(pin[!is.na(pin)], :
# number of items to replace is not a multiple of replacement length

Thanks for your help!
Ellen

Re: Error in se.TransitionMatrix

PostPosted: Tue Jan 21, 2020 7:14 pm
by jlaake
Ellen-

I would look at the output for that run in MARK and see if it converged and see if the model is over-parameterized or parameters are at a boundary. TransitionMatrix without vcv.real specified simply computes the point estimates which doesn't need good estimates of the std errors and will always work. The results from get.real are saying that it is not able to compute a valid estimate of the std errors for one or more parameters. That is clearly causing problems when it tries to compute the std errors for the transition matrix.

--jeff

Re: Error in se.TransitionMatrix

PostPosted: Thu Jan 23, 2020 10:23 am
by EROB
Jeff,

Thanks for your reply. Sorry for the naive question, but is the best way to tell whether parameters converged to look at their SEs in the output file? I see that some transitions where we had little data have SE=0 which I assume means they didn't converge?

Is the best remedy for this to fix these parameters to zero? I tried this at first by deleting the rows of the design data for these transitions where SE=0. After doing this I no longer get the warning in get.real (about some variances being non-positive). However, I am still getting the same error when I try to run the se.TransitionMatrix:
#Error in se.TransitionMat/(TransitionMat * (1 - TransitionMat)) :
#non-conformable arrays
#In addition: Warning message:
#In se.TransitionMat[!is.na(pin)] <- x$se[match(pin[!is.na(pin)], :
# number of items to replace is not a multiple of replacement length

After doing this though I found the post on how it is better to use the field fix in the design data rather than deleting rows of the design data (viewtopic.php?f=21&t=2887). However, when I try to run the model after doing this I am now getting this error:
#Error in if (max(ddl[[i]]$par.index) != nrow(ddl[[i]])) { :
# argument is of length zero
#In addition: Warning message:
#In max(ddl[[i]]$par.index) :
# no non-missing arguments to max; returning -Inf
#Error in mark(model.parameters = model.parameters, initial = initial, :
#Misspecification of model or internal error in code
#No mark models found

Do you have any advice on what I should try next? Thanks so much for your help.

Ellen

Re: Error in se.TransitionMatrix

PostPosted: Thu Jan 23, 2020 12:10 pm
by jlaake
Send me your data and code to jefflaake@gmail.com and I'll look at it.

Re: Error in se.TransitionMatrix

PostPosted: Fri Jan 24, 2020 3:04 pm
by EROB
Thanks, Jeff! I sent you my data / code.

Best,
Ellen