problem reproducing RMark multi-strata example
Posted: Fri Nov 19, 2021 4:31 pm
Hi-
I am having trouble reproducing one of the examples from the RMark appendix of the MARK book, and am hoping someone can suggest what I might be doing wrong.
The example I'm working on is in section C.17 (Multi-strata example); the discussion and (most of) the code begin on page C-81. It's the example of setting PsiAA=PsiBB=PsiCC=0.
In the book, the fitted estimates of Psi show up as 0 for PsiAA, PsiBB, and PsiCC, and as non-zero for the other transitions. These results are on p. C-81 to C-82.
When I try to reproduce the example, the PsiAA, PsiBB, and PsiCC transitions don't show up at all in the summary results; PsiAC and PsiCB show up as 0; and PsiBC shows up as non-zero.
The code that generates my results is pasted below, along with the relevant portion of the output of summary(). The code is copied from Appendix C of the book, and as far as I can tell should produce the same output that the book shows on p. C-81 to C-82. I'd be very grateful for any ideas about what I'm doing wrong - I've searched the forum a few different ways and haven't been able to turn up an answer.
Thanks
Chris
<<Code>>
<<Abbreviated output>>
I am having trouble reproducing one of the examples from the RMark appendix of the MARK book, and am hoping someone can suggest what I might be doing wrong.
The example I'm working on is in section C.17 (Multi-strata example); the discussion and (most of) the code begin on page C-81. It's the example of setting PsiAA=PsiBB=PsiCC=0.
In the book, the fitted estimates of Psi show up as 0 for PsiAA, PsiBB, and PsiCC, and as non-zero for the other transitions. These results are on p. C-81 to C-82.
When I try to reproduce the example, the PsiAA, PsiBB, and PsiCC transitions don't show up at all in the summary results; PsiAC and PsiCB show up as 0; and PsiBC shows up as non-zero.
The code that generates my results is pasted below, along with the relevant portion of the output of summary(). The code is copied from Appendix C of the book, and as far as I can tell should produce the same output that the book shows on p. C-81 to C-82. I'd be very grateful for any ideas about what I'm doing wrong - I've searched the forum a few different ways and haven't been able to turn up an answer.
Thanks
Chris
<<Code>>
- Code: Select all
library(RMark)
data(mstrata)
mstrata.processed=process.data(mstrata,model="Multistrata")
mstrata.ddl=make.design.data(mstrata.processed,parameters=list(Psi=list(subtract.stratum=c("B","A","A"))))
mstrata.ddl$Psi=mstrata.ddl$Psi[!(mstrata.ddl$Psi$stratum=="A"&mstrata.ddl$Psi$tostratum=="A"),]
mstrata.ddl$Psi=mstrata.ddl$Psi[!(mstrata.ddl$Psi$stratum=="B"&mstrata.ddl$Psi$tostratum=="B"),]
mstrata.ddl$Psi=mstrata.ddl$Psi[!(mstrata.ddl$Psi$stratum=="C"&mstrata.ddl$Psi$tostratum=="C"),]
mymodel=mark(mstrata.processed,mstrata.ddl)
summary(mymodel,show.fixed=T)
<<Abbreviated output>>
- Code: Select all
Real Parameter Psi
Stratum:A To:C
1 2 3
1 0 0 0
2 0 0
3 0
Stratum:B To:C
1 2 3
1 0.2214776 0.2214776 0.2214776
2 0.2214776 0.2214776
3 0.2214776
Stratum:C To:B
1 2 3
1 0 0 0
2 0 0
3 0