# \donttest{
data(mstrata)
ms1=process.data(mstrata,model="MSCJS",strata.labels=c("A","B","C"))
ms1.ddl=make.design.data(ms1)
# following requires ADMB or the exe constructed from ADMB and links set for ADMB
# remove comments if you have admb
#mod1=try(crm(ms1,ms1.ddl,model.parameters=list(Psi=list(formula=~-1+stratum:tostratum),
# p=list(formula=~time)),hessian=TRUE))
#mod1
# file.remove("multistate.std")
ms2=process.data(mstrata,model="hmmMSCJS",strata.labels=c("A","B","C"))
ms2.ddl=make.design.data(ms2)
# uses R/Fortran code with hmmMSCJS
mod2=crm(ms2,ms2.ddl,model.parameters=list(Psi=list(formula=~-1+stratum:tostratum),
p=list(formula=~time)),hessian=TRUE)
mod2
# strata.labels for MVMS models must be specified as a list because more than one variable
# can be used
ms3=process.data(mstrata,model="MVMSCJS",strata.labels=list(state=c("A","B","C")))
ms3.ddl=make.design.data(ms3)
ms3.ddl$delta$fix=1
# uses R/Fortran code with MVMSCJS
mod3=crm(ms3,ms3.ddl,model.parameters=list(Psi=list(formula=~-1+stratum:tostratum),
p=list(formula=~time)),hessian=TRUE)
mod3
# requires admb; remove comments if you have admb
#mod4=crm(ms3,ms3.ddl,model.parameters=list(Psi=list(formula=~-1+stratum:tostratum),
# p=list(formula=~time)),hessian=TRUE,use.admb=TRUE)
#mod4
#file.remove("mvms.std")
# uses TMB with mvmscjs -remove comment to use
#mod5=crm(ms3,ms3.ddl,model.parameters=list(Psi=list(formula=~-1+stratum:tostratum),
# p=list(formula=~time)),hessian=TRUE,use.tmb=TRUE)
#mod5
unlink("*.cpp")
unlink("*.o")
unlink("symbols.rds")
# }
Run the code above in your browser using DataLab