Download presentation
Presentation is loading. Please wait.
Published byPiers Miller Modified over 6 years ago
1
Marathon Miles per Hour at NAPA Valley 2015 Marathon by Age and Gender
Gamma Regression Marathon Miles per Hour at NAPA Valley 2015 Marathon by Age and Gender
2
Data Description Y = Race speed (Miles per Hour) at Napa Valley 2015 Marathon (3/1/2015) for 1882 Runners (977 M, 905 F) Predictor Variables: Age in Years (18-76) Gender (1=Male, 0=Female) Age x Gender Interaction Distribution: Gamma (Strictly Positive values, skewed right) Potential Link Functions Inverse Link (Conjugate) Log Link
5
Gamma Distribution – Likelihood Function
6
Gamma Distribution – Inverse Link
7
Gamma Distribution – Inverse Link
8
Estimating f
9
Gamma Distribution – Log Link
10
Results – Inverse Link The main effects of Age and gender are significant, the interaction is not Deviance, Goodness-of-Fit and Likelihood Ratio Tests are Described Below
11
Results – Log Link The main effects of Age and Gender are significant, the interaction is not. Deviance, Goodness-of-Fit and Likelihood Ratio Tests are Described Below
12
Deviance Deviance measures the discrepancy between the observed and fitted values for a model Both (link) models provide a good fit (both p > 0.50)
14
Additive Model Results – Log Link
16
R Program napaf2015 <- read.csv(" header=T) attach(napaf2015); names(napaf2015) gender <- factor(Gender) napa.mod1 <- glm(mph~1,family=Gamma); summary(napa.mod1); deviance(napa.mod1) napa.mod2 <- glm(mph~Age,family=Gamma); summary(napa.mod2) napa.mod3 <- glm(mph ~ Age, family=Gamma(link="log")); summary(napa.mod3) napa.mod4 <- glm(mph~gender,family=Gamma); summary(napa.mod4) napa.mod5 <- glm(mph~Age + gender,family=Gamma); summary(napa.mod5) napa.mod6 <- glm(mph ~ Age + gender, family=Gamma(link="log")); summary(napa.mod6) napa.mod7 <- glm(mph~Age*gender,family=Gamma); summary(napa.mod7) napa.mod8 <- glm(mph ~ Age*gender, family=Gamma(link="log")); summary(napa.mod8) age1 <- min(Age):max(Age) yhat.F <- exp( *age1) yhat.M <- exp(( ) - ( )*age1) plot(Age,mph,col=gender) lines(age1,yhat.F,col=1) lines(age1,yhat.M,col=2) anova(napa.mod5,napa.mod7,test="Chisq") anova(napa.mod6,napa.mod8,test="Chisq") par(mfrow=c(2,2)) plot(Age[Gender=="F"],log(mph[Gender=="F"])) plot(Age[Gender=="M"],log(mph[Gender=="M"])) plot(Age[Gender=="F"],1/mph[Gender=="F"]) plot(Age[Gender=="M"],1/mph[Gender=="M"])
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.