Galton<-read.csv("http://www.cknudson.com/data/Galton.csv")
attach(Galton)
names(Galton)
## [1] "FamilyID" "FatherHeight" "MotherHeight" "Gender" "Height"
## [6] "NumKids"
How many kids were part of the study? 898
What is our primary sampling unit? Family
What are the elements? Children
What kind of correlation structure do we have? Repeated measures
In the context of this study, what does intraclass correlation measure? Measures similarity between siblings
‘Gender’ defines our fixed effects (2)
‘FamilyID’ defines our random effects
197 random effects
fixedmod<-lm(Height~0+Gender, data=Galton)
library(lme4)
## Loading required package: Matrix
mixedmod<-lmer(Height~0+Gender + (1|FamilyID), data=Galton)
summary(fixedmod)
##
## Call:
## lm(formula = Height ~ 0 + Gender, data = Galton)
##
## Residuals:
## Min 1Q Median 3Q Max
## -9.2288 -1.6102 -0.1102 1.7712 9.7712
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## GenderF 64.1102 0.1206 531.7 <2e-16 ***
## GenderM 69.2288 0.1164 595.0 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.509 on 896 degrees of freedom
## Multiple R-squared: 0.9986, Adjusted R-squared: 0.9986
## F-statistic: 3.184e+05 on 2 and 896 DF, p-value: < 2.2e-16
summary(mixedmod)
## Linear mixed model fit by REML ['lmerMod']
## Formula: Height ~ 0 + Gender + (1 | FamilyID)
## Data: Galton
##
## REML criterion at convergence: 4007.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.9475 -0.5661 0.0067 0.5937 3.5069
##
## Random effects:
## Groups Name Variance Std.Dev.
## FamilyID (Intercept) 2.448 1.564
## Residual 3.843 1.960
## Number of obs: 898, groups: FamilyID, 197
##
## Fixed effects:
## Estimate Std. Error t value
## GenderF 64.1489 0.1542 415.9
## GenderM 69.3019 0.1505 460.5
##
## Correlation of Fixed Effects:
## GendrF
## GenderM 0.567
The mixed model has larger standard errors. This makes sense because of sample size.
The variance of the error not captured by the gender factor and created by the random family ID effect.
The variance in the height factors of family IDs. Between group variance.
Negative
Negative
Note: Most of this is from Cheyanne