by Eldar » Thu Jan 27, 2011 12:24 pm
Dear Jeff,
Thanks for the reply,
I am Ok now with the simulations - they run correctly and without errors...
I checked other possibilities and will try to formulate the story now.
A. Your questions:
a) I double checked and confirmed that only simplify = F works for Mark simulations. For identity matrix the only difference between make.mark.model(..., simplify=T) and make.mark.model(..., simplify=F) are in $links and $input lists (checked with identical())
b) I work with inentity matrix because it is the easiest choise to set up simulations betas.
c) Yes, I can export rMark model -> import to Mark database -> import to Mark simulations database. All of the problems happen with the second arrow.
B. The code:
1. We need to generate dummy dataset (let it be "d") with number of occasions and stratas we are interested in (I wrote simple function for this)
2. process data: dat<-process.data(d, model="Multistrata")
3. create ddl: des.data<-make.design.data(dat)
4. fix parameters, e.g.:
des.data$S<-des.data$S[!c((des.data$S$time)=="1" & des.data$S$stratum =="A"),]
des.data$p<-des.data$p[!c((des.data$p$time)=="1" & des.data$p$stratum =="A"),]
des.data$p<-des.data$Psi[!c((des.data$Psi$time)=="1" & des.data$Psi$stratum =="A"),]
5. make mark model:
mymodel<-make.mark.model(dat, des.data, parameters=list(S=list(formula=~-1+stratum),p=list(formula=~-1+stratum), Psi=list(formula=~-1+stratum:tostratum)), simplify=F)
6. run analysis:
mymodelres<-run.mark.model(mymodel)
7. export model:
export.MARK(dat, model=mymodelres, "mydatabase", replace=T)
8. Import to Mark (and don't close the database)
9. Run simulations/set up simulations/True model and then button "Results database"
10.If I had a model that was generated with simplify=T - a) Mark will generetate an error and close the window or b) it will show you next screen with ".. parameters fixed" - but if you will press any button -> a).
If simplify was set to FALSE - Mark will say that there are no parameters fixed but it is correct as they are not in betas (I am not sure I can describe this correctly) and you can set up your simulation..
11. If you will change betas in ...Y.tmp - Mark will suggest you to use these betas for simulation - this very helpful.
PS I also wrote a function that provides some interactive graphical interface for structural zeroes defining in multistrata models. Would you like to have a look?
Best,
Eldar