colext - variance-covariance matrix of epsilon and gamma

31 views
Skip to first unread message

Kreshnike Maloku

unread,
Jul 1, 2021, 8:07:28 AM7/1/21
to unmarked

Dear colleagues,

 

We are fitting multy-year patch occupancy models using the colext function. To estimate the variance in psi, we would like to extract the variance-covariance matrix of epsilon and gamma, so as to use it in addition to the estimates and SE of the two variables (provided by colext). Unfortunately, we did not find a command extracting this matrix from the colext function.

Any help would be greatly appreciated.

Kind regards,


Kreshnike MALOKU

Jim Baldwin

unread,
Jul 1, 2021, 12:25:31 PM7/1/21
to unma...@googlegroups.com
Here are the brute force ways to get the covariance matrices.  Note that these approaches might be fragile in that the structure of the colext output might change (although I think it has been pretty stable - of course, the authors would know better.)

My recommendation is to always obtain the full covariance matrix rather than the individual parts related to just psi, colonization, extinction, or detection.  Here is how to do that using an example from the colext documentation:

library(unmarked)
data(frogs)
umf <- formatMult(masspcru)
obsCovs(umf) <- scale(obsCovs(umf))

## Use 1/4 of data just for run speed in example
umf <- umf[which((1:numSites(umf)) %% 4 == 0),]

## constant transition rates
(fm <- colext(psiformula = ~ 1,
  gammaformula = ~ 1,
  epsilonformula = ~ 1,
  pformula = ~ JulianDate + I(JulianDate^2),
  umf, control = list(trace=1, maxit=1e4)))
 
# Covariance matrix for all parameters
  solve(fm@opt$hessian)
#              [,1]         [,2]         [,3]         [,4]         [,5]         [,6]
#[1,]  0.157233764 -0.015852279  0.005617684 -0.002293078  0.002499374  0.001291073
#[2,] -0.015852279  0.247115560  0.074642827  0.004091612 -0.003769442 -0.003015345
#[3,]  0.005617684  0.074642827  0.230822847  0.011362919 -0.010602254 -0.002347965
#[4,] -0.002293078  0.004091612  0.011362919  0.022007161 -0.006686086 -0.017201613
#[5,]  0.002499374 -0.003769442 -0.010602254 -0.006686086  0.055609784  0.038921565
#[6,]  0.001291073 -0.003015345 -0.002347965 -0.017201613  0.038921565  0.048542605

# Covariance matrix for psi formula
  fm@estimates@estimates$psi@covMat
#          [,1]
#[1,] 0.1572338

# Covariance matrix for gamma (colonization) formula
  fm@estimates@estimates$col@covMat
#          [,1]
#[1,] 0.2471156

# Covariance matrix for epsilon (extinction) formula
  fm@estimates@estimates$ext@covMat
#          [,1]
#[1,] 0.2308228  
   
# Covariance matrix for p formula
  fm@estimates@estimates$det@covMat
#             [,1]         [,2]        [,3]
#[1,]  0.022007161 -0.006686086 -0.01720161
#[2,] -0.006686086  0.055609784  0.03892157
#[3,] -0.017201613  0.038921565  0.04854260


   

Jim





--
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/unmarked/12eb06af-6033-4bc1-9333-590cf2cc6f79n%40googlegroups.com.

Kreshnike Maloku

unread,
Jul 2, 2021, 9:06:53 AM7/2/21
to unmarked
Thanks, Jim !
Reply all
Reply to author
Forward
0 new messages