Page 1 of 1

RDMSMisclass model, total number beta vs. real parameters

PostPosted: Wed Mar 07, 2012 12:09 pm
by claudiapenaloza
I am working with a RDMSMisclass model with a lot of parameters (~10,000 before simplification/fixing). I have 54 occasions, 26 primary periods, and 6 states. Each state can only transition to two other states at any given time, so I am fixing ~8500 Psi parameters to zero.

In the output file produced by RMark (MARK), the beta estimates list a "simplified" number of parameters (~400). The real estimates, however, list what would be equivalent to the "all different PIMS" number of parameters, i.e., >10,000 (for example, listing constant model parameters 26 times and each and every one of the ~8500 fixed Psi's).

1) Is there any way to get the output file to list real parameters in the "simplified" format instead? (without having to calculate it by hand?)

2) Is there a different way to tell RMark to fix parameters... in a way that it will make all the "fixed" parameters the same "real parameter", like you can do in MARK pims/model runs? (in my case reducing ~8500 parameters -> 1)

Re: RDMSMisclass model, total number beta vs. real parameter

PostPosted: Wed Mar 07, 2012 10:37 pm
by jlaake
With summary you can set showall=FALSE and it will only show unique values. If that doesn't quite what you want, one of the elements of the model$result is simplify which is the simplified indices which you can use to just get the unique real parameters. Unfortunalely with Psi as an mlogit they are not simplified and even though they are all fixed, the indices are all unique because I can't simplify due to the way MARK computes real parameters for an mlogit.

--jeff

Re: RDMSMisclass model, total number beta vs. real parameter

PostPosted: Thu Mar 08, 2012 1:02 pm
by claudiapenaloza
Thank you Jeff, that definitely helped. I ended up using the "show.all=FALSE" in the call to summary for the time being (in the future I may determine the index for the exact parameters I need since they won't change from model to model).
The R output is so long it and gets truncated from the console so I used "sink" to capture it:

Code: Select all
sink("model.txt")
summary(model.results, show.all=FALSE)
sink()


Is there a better way to do this? (I tired using "write.table" and that didn't work... because "model.results" is a list, not a data.frame, right?)

Re: RDMSMisclass model, total number beta vs. real parameter

PostPosted: Thu Mar 08, 2012 2:33 pm
by jlaake
summary returns a list which is printed by default but you can always store the list and use components or use components of it directly. Here is an example using the dipper data.

Code: Select all
library(RMark)
data(dipper)
mod=mark(dipper)
# to look at output
summary(mod,se=TRUE,showall=FALSE)$reals$Phi
# or to write to file
mysummary=summary(mod,se=TRUE,showall=FALSE)
write.table(mysummary$reals$Phi,file="MyPhiEstimates.txt",sep="\t")
write.table(mysummary$reals$p,file="MypEstimates.txt",sep="\t")

Re: RDMSMisclass model, total number beta vs. real parameter

PostPosted: Thu Mar 08, 2012 2:47 pm
by claudiapenaloza
Nice :D
Thank you Jeff!