We have a multi-state live dead model that estimates survival and transitions among three different breeding states. We also assess how these are affected by environmental covariates and use covariate.predictions to plot these relationships. When calling the indices for the covariate.predictions, it is obviously only possible to include transitions among others states, whilst the probability of remaining in the same state is 1 - x1 - x2. We have been asked to included standard errors for remaining in the same state, and a suggestion was to use the delta method. We have been reading Appendix B, the workshop notes and various topics on the forum but the context tends to be different (e.g. most focus is on product of estimates). I thought that perhaps our example is similar to applying the delta method with "sum", where it is actually a subtraction. So for example, following this example, https://www.montana.edu/rotella/documen ... 4RMark.rmd, I tried
- Code: Select all
rr <- get.real(ms.results[[6]], "Psi", se = TRUE, vcv = TRUE) ##reals of top model
sigma <- rr$vcv.real
SN2002 <- rr$estimates$estimate[1] ##first time stamp for SN
SF2002 <- rr$estimates$estimate[121] ##first tim stamp for SF
Diff <- 1 - SN2002 - SF2002
seDiff <- deltamethod(~1 - x1 - x2, c(SN2002, SF2002),sigma)
Here I meet a couple of issues. One is that we have 15 years of data, and three states, meaning it is a quite a large matrix. Meanwhile, the delta method function is expecting a 2x2 matrix. So I retried the above again, but this time created my own matrix using the appropriate values from the vcv as follows
- Code: Select all
rr <- get.real(ms.results[[6]], "Psi", se = TRUE, vcv = TRUE)
sigma <- matrix(c(rr$vcv.real[1,1], rr$vcv.real[121,1], rr$vcv.real[121,1], rr$vcv.real[1,1]), nrow = 2, ncol = 2) ##vcv matrix is thus r1 = 0.0005912684, -0.0003690198, r2 = -0.0003690198, 0.0005912684
##note that rr$vcv.real[121,1] = rr$vcv.real[1,121]
SN2002 <- rr$estimates$estimate[1] ##S to N for 2002, value is 0.2339315
SF2002 <- rr$estimates$estimate[121] ##S to F for 2002, value is 0.1520598
Diff <- 1 - SN2002 - SF2002 ##Mlogit hence S to S is 1 - SF - SN
seDiff <- deltamethod(~1 - x1 - x2, c(SN2002, SF2002),sigma)
The above gives an SE of 0.0210831, which is the region of the SE of SN (0.02431601) and SF (0.02725081). However, if I change the above formula to simply x1 - x2, the SE is 0.04382438 - which happens to be the same as the comparison on the above link, i.e.
- Code: Select all
(se.diff.direct=sqrt(sum(diag(sigma))-2*sigma[1,2])).
Lastly, the SE of deltamethod(~1 - x1 - x2) = the SE of deltamethod(~x1 + x2).
Firstly, is my current notation correct for implementing and specifying the formula of the delta method. Secondly, will I need to rinse and repeat this process 45 times (i.e. 3 states x 15 years), creating a new vcv matrix everytime to obtain these SEs? Is there a more efficient approach that I am missing?
Many thanks in advance for any guidance you are able to provide.