Download presentation
Presentation is loading. Please wait.
Published byColleen Parsons Modified over 9 years ago
1
A preliminary exploration into the Binomial Logistic Regression Models in R and their potential application Andrew Trant PPS Arctic - Labrador Highlands Research Group
2
One presentation in two parts Part 1 (today) -comparing binomial logistical regressions in R and Minitab -binomial GLMs and Odds Ratios Part 2 (next time) -using GLMs in conservation biology -an exploration of the past
3
Start off small….. before …and after Kettlewell, H B D (1956)
4
Research Question: Are the odds of survival higher for dark form (Melanic) than the light form (Typical)? Odds = e ( o) + e ( Type) + error (link = logit)
5
In Minitab: In R…
6
glm(formula = Nrecap/Nrel ~ type, family = binomial, data = moth,weights = Nrel) Call: Coefficients: (Intercept) typeTyp -0.6584 -0.9332 Degrees of Freedom: 1 Total (i.e. Null); 0 Residual Null Deviance: 22.98 Residual Deviance: 1.592e-13 AIC: 15.93 > summary(moth) Deviance Residuals: [1] 0 0 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -0.65840 0.08604 -7.652 1.98e-14 *** typeTyp -0.93323 0.20689 -4.511 6.46e-06 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 2.2977e+01 on 1 degrees of freedom Residual deviance: 1.5921e-13 on 0 degrees of freedom AIC: 15.929 Number of Fisher Scoring iterations: 3
7
In Minitab: In R… Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
8
Odds = e ( o) + e ( Type) + error BUT R assumes that o = melanistic NOT typical > exp(-0.6584) = 0.5176 R: MINITAB: >exp(-1.5916+0.9332) = 0.5177
9
Odds = e ( o) + e ( Type) + error BUT R assumes that o = melanistic NOT typical > exp(-0.6584) = 0.5176 R: MINITAB: >exp(-1.5916+0.9332) = 0.5177 SAME(ish)
10
R: MINITAB: >exp(0.9332) = 2.5426 Odds Ratio >exp(-0.9332) = 0.3933 >1/exp(-0.9332)=2.5426
11
Calculating 95% Confidence Intervals CI = e Estimate±(SE*z-value) >exp(0.9332±(0.2069*1.96)) Lower = 1.694989 Upper= 3.814174
12
You have reached the end of part one But there is a preliminary stab at part two
13
Dave’s Barnacles Tetraclita squamosa Acanthia sp. >avthickathole<-glm(formula=Npartial/N~AvThickAtHole,family=binomial, weights=N,data=test)
14
Average thickness at hole LM GLM
15
Average thickness at hole General Linear Model: >lm.avthickathole<-lm(w.wbar~AvThickAtHole,data=test) Generalized Linear Model: >avthickathole<-glm(formula=Npartial/N~AvThickAtHole,family=binomial, weights=N,data=test) Odds Ratio: 1.13 (remember…exp(0.1249))
16
Average thickness residuals plots LM GLM
17
Summary of model comparison…GLM vs LM
18
Height of barnacle General Linear Model: >lm(w.wbar ~ Ht, data = height) Generalized Linear Model: >glm.height<-glm(Npartial/N~Ht,family=binomial,weights=N,data=height)) Odds Ratio: 1.26
19
Height of barnacle residuals plots LM GLM
20
Summary of model comparisons…GLM vs LM
21
Max Diameter General Linear Model: >lm(w.wbar ~ MaxDiam, data = maxdiam) Generalized Linear Model: >glm(Npartial/N ~ MaxDiam, family = binomial, data = maxdiam,weights = N) Odds Ratio: 1.073
22
Max Diameter residuals plots LM GLM
23
Summary of model comparisons…GLM vs LM
24
Okay, that’s it…
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.