I am doing a power analysis to determine how many sites I need to sample (recording an animal’s presence/absence) to detect a difference between the animal's presence before and after a fire has gone through. We have already surveyed the sites (around 200) before the fire and so I want to know if we can do less post-burn sampling (to save money). The results will be analysed using a binomial glm. I am using the simr packing and powersim function. Here is the model that will be used:
m3 <- glm(animal.present ~ fire, family=binomial, data=data)
I am predicting there to be a reduction in animal presence of 50% post fire. Given it’s a binomial model and the coefficient represents a logit, I think the coefficient should be -0.7 (as the exponentiate of that is -0.5):
exp(-0.7)
[1] 0.4965853
I do this to change the coefficient:
coef(m3)['firepost'] <- -0.7
Running the model I get the below output. I want to know if I have specified the correct effect size and have I put the effect in the correct direction (e.g. less animals in post fire):
Call:
glm(formula = koala.present ~ fire, family = binomial, data = koala.fire)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.8949 -0.8949 -0.6614 1.4892 1.8040
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.7084 0.1515 -4.675 2.94e-06 ***
firepost -0.7000 0.2143 -3.267 0.00109 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 499.7 on 393 degrees of freedom
Residual deviance: 499.7 on 392 degrees of freedom
AIC: 503.7
Number of Fisher Scoring iterations: 4
Running the power analysis then shows we should sample the same number of sites as before (197) to have have enough power
powerSim(m3)
Power for predictor 'fire', (95% confidence interval):================================================|
85.00% (82.63, 87.16)
Test: Likelihood ratio
Based on 1000 simulations, (0 warnings, 0 errors)
alpha = 0.05, nrow = 394
Time elapsed: 0 h 0 m 12 s