# compare p-value from two different glm (with the same response variable)

I am currently analyzing the occupancy of bat boxes and the factors that are influencing the occupancy. To determine the most significant variables influencing the occupancy I am running a glm with occupancy as my response variable (0=occupied / 1=not occupied) and different explanatory variables which are numerical except one categorical variable.

On the one hand I have the p-values from the glm with the highest AIC and the lowest residual deviance, which is following model (I already dropped a few variables, such as height)

modelg <- glm(Occupancy ~ TreeCov5er + number_of_boxes + mounted_on, family = binomial(link="cloglog"))

that results in:

                       Estimate Std. Error z value Pr(>|z|)
(Intercept)            -4.97792    0.78083  -6.375 1.83e-10 ***
TreeCover               0.03075    0.01074   2.864 0.004183 **
number_of_boxes         0.27427    0.07427   3.693 0.000221 ***
mounted_onPOLES         2.54868    0.59730   4.267 1.98e-05 ***
mounted_onBALCONY     -12.44792 1146.20349  -0.011 0.991335
mounted_onFACADE        1.87433    0.50045   3.745 0.000180 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 184.60  on 177  degrees of freedom
Residual deviance: 140.15  on 172  degrees of freedom
AIC: 152.15

Number of Fisher Scoring iterations: 15


For all other variables which were dropped (e.g. Height) I have no p value. Would it be correct if I compute the p-value for height with:

modelhoehe <- glm(Besatz ~ Height, family = binomial(link="cloglog"))

Because now I would compare p-values from two different models. Is that correct. If not how can I compute the p-value for height?

I hope the question is understandable.

• No, that's not correct. – Roland Oct 5 '19 at 15:15
• You're using a different response variable in the second model? – Dason Oct 5 '19 at 16:40
• @Roland: How else can I compute the p-value fpr height? – Freddy94 Oct 7 '19 at 10:56
• @Dason: In my first model I included all variables I had (TreeCover, number of boxes, mounted on, height, age, exposition). I dropped the variables with the highest p value (height, age, exposition) to get the most simple model possible. But for my paper I also need the p values from the variables I dropped, such as height. I am asking now how do I compute the p-values from the variables I dropped? – Freddy94 Oct 7 '19 at 10:59
• Your model selection approach already ensures that the p-values of the remaining parameters are not correct. Using p-value as a selection measure is wrong. You should look into using the LASSO. Anyway, if you need a p-value for height (why, if it is removed from the model?), you'll have to include it in a model together with all other "significant" variables. – Roland Oct 7 '19 at 11:05

If you want to compare p-values properly with the variables shown above, you should include Height and the other variables on this glm model and analyse.