if (FALSE) {
# Simulate an occupancy dataset
forms <- list(state=~elev, det=~1)
coefs <- list(state=c(intercept=0, elev=-0.4), det=c(intercept=0))
design <- list(M=300, J=8) # 300 sites, 8 occasions per site
occu_umf <- simulate("occu", formulas=forms, coefs=coefs, design=design)
# Fit occupancy model to simulated data
template_model <- occu(~1~elev, occu_umf)
# Set desired effect sizes to pass to coefs
effect_sizes <- list(state=c(intercept=0, elev=-0.4), det=c(intercept=0))
# Run power analysis
pa <- powerAnalysis(template_model, coefs=effect_sizes, alpha=0.05)
# Look at summary
summary(pa)
# Update the analysis with new arguments
(pa2 <- update(pa, alpha=0.01))
}
Run the code above in your browser using DataLab