Error message when calculating VIF for a model averaged model

28 views
Skip to first unread message

haileyj...@gmail.com

unread,
Oct 12, 2023, 10:15:00 AM10/12/23
to unmarked
Hello all,

I am running a single season single species occupancy model for an endemic chipmunk species with a sample size of 162 sites. I have four competitive occupancy models that I averaged. I would like to calculate VIF for this averaged model, however, I am getting an error message (highlighted in yellow). What does this error message mean (my thoughts: that there is an argument missing to select either the full or conditional model to calculate VIF) and how can I fix this error? 

Below is my code and output: 

#calculate model average of the 4 competitive models
comp_mod_list <- list(mo62, mo100, mo60, mo105)
occ_avg <- model.avg(comp_mod_list)
summary(occ_avg) #examine

Call:
model.avg(object = comp_mod_list, fit = TRUE)

Component model call:
occu(formula = <4 unique values>, data = occupancy.dataR)

Component models:
                                                             df  logLik   AICc delta weight
1/2/3/4/5/6/7/8/9/10/11/12        14 -394.28 819.41  0.00   0.35
1/2/3/4/5/6/7/9/10/11/12            13 -395.80 820.07  0.65   0.25
1/2/3/4/5/6/8/9/10/11/12            13 -395.99 820.44  1.03   0.21
1/2/3/4/5/6/9/10/11/12                12 -397.28 820.65  1.24   0.19

Term codes:
     p(scale(Coniferall_cover))                       1         
     p(scale(FA_HR))                                        2
     p(scale(Herbaceous_cover_near))         3         
     p(scale(juliandate))                                  4
     p(scale(Litter_cover_near))                     5
     p(scale(MF_DI))                                        6
     psi(MS1_cat)                                             7
     psi(scale(Euc_flowacc1200))                 8
     psi(scale(HS_DI))                                      9
     psi(scale(Rock_cover))                            10
     psi(scale(SDI_woody))                             11
     psi(scale(Slope_DI))                                 12
                              

Model-averaged coefficients:  
(full average)
                                                                      Estimate Std. Error z value Pr(>|z|)    
psi(Int)                                                          -0.7841     0.3835   2.044 0.040928 *  
psi(scale(Euc_flowacc1200))                   -0.2990     0.3620   0.826 0.408832    
psi(scale(HS_DI))                                        -0.6651     0.3521   1.889 0.058928 .  
psi(scale(Slope_DI))                                   1.3020     0.4188   3.109 0.001878 **
psi(scale(SDI_woody))                                0.9541     0.3710   2.572 0.010122 *  
psi(scale(Rock_cover))                               1.1262     0.4516   2.494 0.012643 *  
psi(MS1_cat)                                                 0.8194     0.9176   0.893 0.371917    
p(Int)                                                              -2.9712     0.1913  15.534  < 2e-16 ***
p(scale(Herbaceous_cover_near))            -0.3496     0.1745   2.004 0.045119 *  
p(scale(Litter_cover_near))                        -0.3549     0.1512   2.347 0.018911 *  
p(scale(juliandate))                                      -0.3199     0.1098   2.915 0.003558 **
p(scale(FA_HR))                                            -0.4975     0.1487   3.346 0.000819 ***
p(scale(MF_DI))                                             0.2927     0.1102   2.657 0.007881 **
p(scale(Coniferall_cover))                           -0.6301     0.2399   2.627 0.008613 **
 
(conditional average)
                                                                         Estimate Std. Error z value Pr(>|z|)    
psi(Int)                                                             -0.7841     0.3835   2.044 0.040928 *  
psi(scale(Euc_flowacc1200))                      -0.5346     0.3292   1.624 0.104315    
psi(scale(HS_DI))                                           -0.6651     0.3521   1.889 0.058928 .  
psi(scale(Slope_DI))                                       1.3020     0.4188   3.109 0.001878 **
psi(scale(SDI_woody))                                   0.9541     0.3710   2.572 0.010122 *  
psi(scale(Rock_cover))                                  1.1262     0.4516   2.494 0.012643 *  
psi(MS1_cat)                                                   1.3600     0.8139   1.671 0.094734 .  
p(Int)                                                                 -2.9712     0.1913  15.534  < 2e-16 ***
p(scale(Herbaceous_cover_near))              -0.3496     0.1745   2.004 0.045119 *  
p(scale(Litter_cover_near))                           -0.3549     0.1512   2.347 0.018911 *  
p(scale(juliandate))                                        -0.3199     0.1098   2.915 0.003558 **
p(scale(FA_HR))                                              -0.4975     0.1487   3.346 0.000819 ***
p(scale(MF_DI))                                                0.2927     0.1102   2.657 0.007881 **
p(scale(Coniferall_cover))                             -0.6301     0.2399   2.627 0.008613 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

>   #Multicollinearity
>   unmarked::vif(occ_avg, type = "det")
Error in if (full) 0 else NA_real_ :
  missing value where TRUE/FALSE needed
>   unmarked::vif(occ_avg, type = "state")
Error in if (full) 0 else NA_real_ :
  missing value where TRUE/FALSE needed

Thank you so much for your help in advance! Please let me know if I can provide any further information. 

Hailey

Jim Baldwin

unread,
Oct 12, 2023, 12:47:17 PM10/12/23
to unma...@googlegroups.com
The error is because the first line in the function unmarked::vif is

v <- vcov(mod, type)

and the vcov method is not available for objects having the structure of your occ_avg object. In the model.avg documentation is the sentence:

This results in a much faster calculation, but has certain drawbacks, because the fitted component model objects are not stored, and some methods (e.g. predictfittedmodel.matrix or vcov) would not be available with the returned object.

That, of course, doesn't fix anything.  It only says that it's not something wrong with your data but simply the object created doesn't store the necessary information.

Jim


--
*** Three hierarchical modeling email lists ***
(1) unmarked (this list): for questions specific to the R package unmarked
(2) SCR: for design and Bayesian or non-bayesian analysis of spatial capture-recapture
(3) HMecology: for everything else, especially material covered in the books by Royle & Dorazio (2008), Kéry & Schaub (2012), Kéry & Royle (2016, 2021) and Schaub & Kéry (2022)
---
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/640a8305-2776-47b3-8a84-047cf24dd3e2n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages