Owl Data Explore Owl Data (28.5,29.3] (27.7,28.5] (27,27.7] (26.2,27] (25.5,26.2] (24.7,25.5] (24,24.7] (23.2,24] (22.5,23.2] (21.7,22.5] M Sat F Sat M Dep Biologists observer 27 nests of barn owls. Response: Number of Calls Predictors: Size of brood (1 to 7) Sex of parent( 245 female, 354 male) Food ”Treatment” (satiated vs deprived) Arrival Time (21.7 to 29.2 hours) F Dep 0 2 4 6 8 0 2 4 6 8 8 CallsPrChick 6 4 2 0 22 24 26 28 ArrvTime Possible interaction between treatment and gender. Stat 506 & Hill, Chapter 15 Calls per chick seems to have peaksGelman at 2230 and 2530. I’m using a Random Effects? cubic spline of degree 5 to model the curve. fit1 fit2 fit3 BIC 4895 4750 4733 logLik -2416 -2337 -2312 deviance 4831 4673 4624 Chisq 157.7 49.2 Chi Df Pr(>Chisq) 2 5 Evidence that slopes vary from nest to nest. Large interaction. Stat 506 Gelman & Hill, Chapter 15 0.0000 0.0000 Random Slopes 0.4 Random Intercepts ● ●● ●● ● ● ● ● −2 ● 0.2 0.5 ● ●● ●●●● ●● ●● ●● ●● ● ● 0.0 ● ● Sample Quantiles AIC 4851 4697 4658 1], main = "Random Intercepts") 1]) 2], main = "Random Slopes") 2]) ● ● ● ●●● ● ●● ●●● ● ●● ● ●● ●● ● ● ● −0.4 Df 10 12 17 par(mfrow = c(1, 2)) qqnorm(ranef(fit3)$Nest[, qqline(ranef(fit3)$Nest[, qqnorm(ranef(fit3)$Nest[, qqline(ranef(fit3)$Nest[, 0.0 fit1 <- glmer(Ncalls ~ offset(log(BroodSize)) + FoodTrt * SexParent + bs(cTime, df = 5) + (1 | Nest), data = owls, family = poisson) fit2 <- glmer(Ncalls ~ offset(log(BroodSize)) + FoodTrt * SexParent + bs(cTime, df = 5) + (1 + cTime | Nest), data = owls, family = poisson) fit3 <- glmer(Ncalls ~ offset(log(BroodSize)) + FoodTrt * SexParent + SexParent * bs(cTime, df = 5) + (1 + cTime | Nest), data = owls, family = poisson) xtable(anova(fit1, fit2, fit3), digits = c(0, 0, 0, 0, 0, 0, 1, 0, 4)) −0.5 Fit Owl Data −1.0 Gelman & Hill, Chapter 15 Sample Quantiles Stat 506 ● ● −1 0 1 2 Theoretical Quantiles −2 −1 0 1 Theoretical Quantiles May not be “Gaussian” errors. Are we missing a predictor? Stat 506 Gelman & Hill, Chapter 15 2 Gelman §15.1 Traffic Stops Gelman Frisk 2 We don’t have access to the data. The Poisson Mixed Model: yi ∼ Poisson(ui e Xi β+i ), i ∼ N(0, σ2 ) Their example adds random effects [βp ∼ N(0, σp2 )] for Precints and (indep of) and extra overdispersion. Race effects, αe are of interest, and there is an general intercept, µ. Stat 506 Gelman & Hill, Chapter 15 Gelman Storable Votes §15.2 invlogit[Pr(yi > 1) = Xi β; invlogit[Pr(yi > 2) = Xi β − c2 1 if zi < c1.5 2 if zi ∈ (c1.5 , c2.5 ) ; zi ∼ logistic(xi , σ 2 ) yi = 3 if zi > c2.5 Use Normal distributions for each of cj1.5 , cj,2.5 , log(σj ) to allow varying cutoffs and variances for each student. Estimate σ1.5 , σ2.5 , µlog(σ) , σlog(σ) from the data. Figure 15.6 looks at optimal versus observed strategies for 2, 3, 6 player games. Stat 506 Gelman & Hill, Chapter 15 Social Networks §15.3 Multinomial is like 2 logistic regressions: or Stat 506 Gelman & Hill, Chapter 15 How many people do you know? If you know 2 Nicoles out of 358K in the US, we compute size of your network as: 2 × 280000000 = 1560 358000 Cross check with other names. But there are “clumps” of data (JayCees), so we need overdispersed Poisson. Additional analysis looks at selective memory, positive/negative experiences and residuals. Stat 506 Gelman & Hill, Chapter 15