Chapter 9 Binomial GLM and proportions
Sometimes, proportion data are more similar to logistic regression than you think.
In discrete counts, we can, for instance, measure the number of presence of individuals in relation to the total number of populations sampled.
We will thus obtain a proportional number of “success” in observing individuals by dividing the counts by the total counts.
In glm()
, we have to provide prior weights if the response variable is the proportion of successes.
Proportions can be modelled by providing both the number of “successes” and prior weights in the function
<- glm(cbind(Galumna, totalabund - Galumna) ~ Topo + WatrCont,
prop.reg data = mites,
family = binomial)
summary(prop.reg)
##
## Call:
## glm(formula = cbind(Galumna, totalabund - Galumna) ~ Topo + WatrCont,
## family = binomial, data = mites)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.4808 -0.9699 -0.6327 -0.1798 4.1688
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -3.288925 0.422109 -7.792 6.61e-15 ***
## TopoHummock 0.578332 0.274928 2.104 0.0354 *
## WatrCont -0.005886 0.001086 -5.420 5.97e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 140.702 on 69 degrees of freedom
## Residual deviance: 85.905 on 67 degrees of freedom
## AIC: 158.66
##
## Number of Fisher Scoring iterations: 5
The weights can also be set explicitly in glm()
:
<- glm(prop ~ Topo + WatrCont,
prop.reg2 data = mites,
family = binomial,
weights = totalabund) # provide prior weights
summary(prop.reg2)
##
## Call:
## glm(formula = prop ~ Topo + WatrCont, family = binomial, data = mites,
## weights = totalabund)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.4808 -0.9699 -0.6327 -0.1798 4.1688
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -3.288925 0.422109 -7.792 6.61e-15 ***
## TopoHummock 0.578332 0.274928 2.104 0.0354 *
## WatrCont -0.005886 0.001086 -5.420 5.97e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 140.702 on 69 degrees of freedom
## Residual deviance: 85.905 on 67 degrees of freedom
## AIC: 158.66
##
## Number of Fisher Scoring iterations: 5