- Code: Select all
the-name-of-the-model$results$real
For comparison, when extracting the real parameters from a model fitted using marked::crm, the grouping variables are given in separate columns, as desired. However, now only the estimates are shown, but not se, lcl and ucl.
Here's a small example using the dipper data. Models are fitted with both RMark and marked to obtain sex- and time-specific estimates.
Create processed data and design data:
- Code: Select all
library(RMark)
data(dipper)
# process data
proc_rmark = RMark::process.data(data = dipper, groups = ("sex"))
proc_marked = marked::process.data(data = dipper)
# create design data
design_rmark = RMark::make.design.data(proc_rmark)
design_marked = marked::make.design.data(proc_marked)
Fit models:
- Code: Select all
m_rmark = RMark::mark(
data = proc_rmark,
ddl = design_rmark,
model.parameters = list(
Phi = list(formula = ~sex + time),
p = list(formula = ~1)))
m_marked = marked::crm(
data = proc_marked,
ddl = design_marked,
model.parameters = list(
Phi = list(formula = ~sex + time),
p = list(formula = ~1)),
accumulate = FALSE)
m_marked = marked::cjs.hessian(m_marked)
Get real values from models:
RMark:
- Code: Select all
m_rmark$results$real
estimate se lcl ucl
Phi gFemale c1 a0 t1 0.6184423 0.1154337 0.3832299 0.8087247
Phi gFemale c1 a1 t2 0.4480347 0.0699014 0.3180764 0.5855008
Phi gFemale c1 a2 t3 0.4717226 0.0628891 0.3525469 0.5942113
Phi gFemale c1 a3 t4 0.6179090 0.0617793 0.4919537 0.7297892
Phi gFemale c1 a4 t5 0.6010942 0.0601805 0.4795367 0.7113504
Phi gFemale c1 a5 t6 0.5762779 0.0624635 0.4516836 0.6918740
Phi gMale c1 a0 t1 0.6317731 0.1128463 0.3986916 0.8161656
Phi gMale c1 a1 t2 0.4621412 0.0724222 0.3267790 0.6033250
Phi gMale c1 a2 t3 0.4859184 0.0642372 0.3634640 0.6100871
Phi gMale c1 a3 t4 0.6312473 0.0615073 0.5049171 0.7418247
Phi gMale c1 a4 t5 0.6146534 0.0593749 0.4938954 0.7227713
Phi gMale c1 a5 t6 0.5901054 0.0617602 0.4660395 0.7036738
p gFemale c1 a1 t2 0.9021693 0.0290292 0.8287662 0.9461511
marked:
- Code: Select all
m_marked$results$real$Phi
sex time occ estimate
1 Female 6 6 0.5762781
2 Male 6 6 0.5901055
3 Female 5 5 0.6010941
4 Male 5 5 0.6146532
5 Female 4 4 0.6179089
6 Male 4 4 0.6312471
7 Female 3 3 0.4717224
8 Male 3 3 0.4859181
9 Female 2 2 0.4480346
10 Male 2 2 0.4621411
11 Female 1 1 0.6184402
12 Male 1 1 0.6317710
Using RMark
Pros: values of estimates are given with se, lcl and ucl.
Cons: values of the grouping variables (sex and time) are given as concatenated string in rownames.
Using marked
Pros: values of grouping variables (sex and time) are given in separate columns.
Cons: only estimates, no se, lcl and ucl
What would be the canonical way to get estimates of real parameters with se, lcl and ucl, and the grouping variables as explicit columns? Although the main part of my work is performed in RMark, I'm happy to see solutions for both RMark and marked.
Thank you for your great work!