Load neighborhood data and create complete cases variables
#DATA$complete = complete.cases(DATA)
#Neigh=DATA
#save(Neigh,file ="/Users/meganwilliams/Desktop/Neighborhood and Cognitive Function/Data/Neigh.Rda")
load(file ="/Users/meganwilliams/Desktop/Neighborhood and Cognitive Function/Data/Neigh.Rda")
library(lme4)
## Loading required package: Matrix
Run mixed effects logistic regression with complete cases as the outcome
gm2 <- glmer(complete~age + Race + PovStat + Sex +(1|HNDid),data=Neigh,family=binomial)
summary(gm2)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: complete ~ age + Race + PovStat + Sex + (1 | HNDid)
## Data: Neigh
##
## AIC BIC logLik deviance df.resid
## 6807.3 6846.3 -3397.6 6795.3 4930
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.2386740 -0.9419528 0.7494828 0.9090893 1.1656016
##
## Random effects:
## Groups Name Variance Std.Dev.
## HNDid (Intercept) 0.2841336 0.5330418
## Number of obs: 4936, groups: HNDid, 2468
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.190742778 0.061714559 3.09073 0.0019967
## age -0.014942545 0.003405067 -4.38833 1.1423e-05
## RaceAfrAm -0.198309405 0.065728252 -3.01711 0.0025520
## PovStatBelow 0.011653180 0.065132952 0.17891 0.8580054
## SexMen -0.043967102 0.063799710 -0.68914 0.4907335
##
## Correlation of Fixed Effects:
## (Intr) age RcAfrA PvSttB
## age -0.072
## RaceAfrAm -0.588 0.018
## PovStatBelw -0.348 0.046 -0.161
## SexMen -0.459 0.010 -0.006 0.058