{ Multilevel Modeling using Stata Andrew Hicks CCPR Statistics and Methods Core Workshop based on...
-
Upload
elisa-hager -
Category
Documents
-
view
219 -
download
2
Transcript of { Multilevel Modeling using Stata Andrew Hicks CCPR Statistics and Methods Core Workshop based on...
{
Multilevel Modeling using
StataAndrew HicksCCPR Statistics and Methods Core
Workshop based on the book:
Multilevel and Longitudinal ModelingUsing Stata(Second Edition)
bySophia Rabe-HeskethAnders Skrondal
200
300
400
500
600
700
Min
i Wrig
ht M
eas
ure
me
nts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17Subject ID
Occasion 1 Occasion 2
Within-Subject Dependence
Within-Subject Dependence: We can predict occasion 2 measurement ifwe know the subjectβs occasion 1 measurement.
Between-Subject Heterogeneity: Large differences between subjects(compare subjects 9 and 15)
Within-subject dependence is due to between-subject heterogeneity
Standard Regression Model
π¦ ππ=π½+π ππ
Measurement of subject i on occasion j
Population Mean
Residuals (error terms)Independent over subjects and occasions
Clearly ignores information aboutwithin-subject dependence
{{
{ { π·
Variance Component Model
π¦ ππ=π½+π ππ
π π π πππ¦ ππ=π½+ΒΏ +ΒΏRandom Intercept: deviation of subjectjβs mean from overall mean
Within-subject residual: deviation of observation i from subject jβs mean
Variance Component Model
π¦ ππ=π½+π ππ
π π π πππ¦ ππ=π½+ΒΏ +ΒΏRandom Intercept: deviation of subjectjβs mean from overall mean
Within-subject residual: deviation of observation i from subject jβs mean
Variance Component Model
π π π πππ¦ ππ=π½+ΒΏ +ΒΏRandom Intercept: deviation of subjectjβs mean from overall mean
Within-subject residual: deviation of observation i from subject jβs mean
π·π π
π½+π ππ2 π
π1 π
Variance Component Model
π π π πππ¦ ππ=π½+ΒΏ +ΒΏπ π βΌ π (0 ,π)π ππβΌ π (0 ,π)
πππ ( π¦ ππ )=πππ ( π½)+πππ (π π)+πππ (π ππ)0 π π
πππ ( π¦ ππ )=π+π
Variance Component Model
π π π πππ¦ ππ=π½+ΒΏ +ΒΏProportion of Total Variance due to subject differences:
=
=
Intraclass Correlation: within cluster correlation
=
Random or Fixed Effect?
Since every subject has a different effect we can think of subjects as categorical explanatory variables. Since the effectsof each subject is random, we have been using a random effect model:
, π πβΌ π (0 ,π)What if we want to fix our model so that each effect is for a specific subject? Then we would use a fixed effect model:
,
.xtreg wm, fe
Random or Fixed Effect?
random effect model:
if the interest concerns the population of clusters
βgeneralize the potential effectβ i.e. nurse giving the drug
fixed effect model:
if we are interest in the βeffectβ of the specific clusters in a particulardataset
βreplicable in lifeβ i.e. the actual drug
Random Intercept Model with Covariates
π¦ ππ=π½+π ππ
π π π πππ¦ ππ=π½+ΒΏ +ΒΏwithout covariates:
Random Intercept Model with Covariates
with covariates:
π¦ ππ=π½1+π½2 π₯2 ππ+β¦ π½π π₯πππ+π ππ
π ππ+ΒΏπ¦ ππ=π½1+π½2 π₯2 ππ+β¦ π½π π₯πππ+π π
π ππ+ΒΏ
random parameter not estimated with fixed parameters
but whose variance is estimated with variance of
Ecological Fallacyoccurs when between-cluster relationships differ substantially from within-cluster relationships.
β’ Can be caused by cluster-lever confounding
For example, mothers who smoke during pregnancy may also adoptother behaviors such as drinking and poor nutritional intake, or have lowersocioeconomic status and be less educated. These variables adversely affectbirthweight and have not be adequately controlled for. In these cases thecovariate is correlated with the error term. (endogeneity)
β’ Because of this, the between-effect may be an overestimate of thetrue effect.
β’ In contrast, for within-effects each mother serves as her own control, so within mother estimates may be closer to the true causal effect.
How to test for endogeneity?
Use the Hausman test to compare two alternative estimators of
Random-coefficient model
Weβve already considered random intercept models where the interceptis allowed to vary over clusters after controlling for covariates.
What if we would also like the coefficients (or slopes) to vary across clusters?
Models the involve both random intercepts and random slopes are called Random Coefficient Models
Random-coefficient model
Random Intercept Model:
π¦ ππ=π½1+π½2 π₯ππ+π π+πππ
Random Coefficient Model:
π¦ ππ=π½1+π½2 π₯ππ+π 1 π+π2 π π₯ ππ+π ππ
π¦ ππ=(π½ΒΏΒΏ1+π1 π)+(π½2+π2 π)π₯ππ+π ππΒΏ
cluster-specific random intercept
cluster-specific random slope