I am dredging an unmarked occupancy model and have run into a few obstacles:
1) After first dredging the detection component of the model, I am trying to dredge the occupancy component of the model with the fixed subset of predictors previously selected for the detection component, as follows:
global_occ <-occu( ~ Freq + I(Freq^2) + n +mean_tree_d9 + mean_tree_kurt ~ C1 + C2 + C3 + C4 + S1 + S2 + S3 + S4 + Hour + I(Hour^2) + Deg_class + Freq_fire + age + Freq + mean_tree_d9 + mean_tree_d4 + mean_tree_d2 + mean_shrub_stdev + mean_tree_kurt + mean_tree_mad, umf_all)
system.time(dredge_occ<-pdredge(global_occ, rank=AIC, m.max=5, cluster=clust, fixed=`p(Freq)`&`p(I(Freq^2))`&`p(n)`&`p(mean_tree_d9)`&`p(mean_tree_kurt)`))
> dredge_occ
Global model call: occu(formula = ~Freq + I(Freq^2) + n + mean_tree_d9 + mean_tree_kurt ~
C1 + C2 + C3 + C4 + S1 + S2 + S3 + S4 + Hour + I(Hour^2) +
Deg_class + Freq_fire + age + Freq + mean_tree_d9 + mean_tree_d4 +
mean_tree_d2 + mean_shrub_stdev + mean_tree_kurt + mean_tree_mad, data = umf_all)
---
Model selection table
p(Int) psi(Int) p(Frq) p(I(Frq^2)) p(men_tre_d9) p(men_tre_krt) p(n) df logLik AIC delta weight
31 -8.68 -1.93 -8.518 -2.439 -0.2369 -0.2295 0.07039 7 -9664.791 19343.6 0 1
Models ranked by AIC(x)
UPDATE: I tried using Kamil's solution below, but it wasn't working because the "m.max" parameter imposes a universal constraint (across both p and psi components) on the maximum number of variables for any individual model and therefore was not permitting any psi covariates to be fitted...
?dredge
says: fixed
is "either a single sided formula
or a character vector giving names of terms". In your case it is an expression (suitable as the subset
argument). So, your code should read:
pdredge(global_occ, rank=AIC, m.max=5, cluster=clust, fixed=c("p(Freq)", "p(I(Freq^2))", "p(n)", "p(mean_tree_d9)", "p(mean_tree_kurt)"))