Presentation is loading. Please wait.

Presentation is loading. Please wait.

October 13, 2009 Session 7Slide 1 PSC 5940: Elaborating Multi- Level Models in R Session 7 Fall, 2009.

Similar presentations


Presentation on theme: "October 13, 2009 Session 7Slide 1 PSC 5940: Elaborating Multi- Level Models in R Session 7 Fall, 2009."— Presentation transcript:

1 October 13, 2009 Session 7Slide 1 PSC 5940: Elaborating Multi- Level Models in R Session 7 Fall, 2009

2 October 13, 2009 Session 7Slide 2 Workshop Topic #1 Plot Building: Complex in R Pushing boundaries Present your initial group-level models

3 October 13, 2009 Session 7Slide 3 Workshop Topic #2 Presentations of initial group- level models Deterrence Group Geographic Group-of-One GCC Group

4 October 13, 2009 Session 7Slide 4 BREAK

5 October 13, 2009 Session 7Slide 5 Why use ML Models? Allows direct estimation of effects of group membership Avoids overwhelming number of coefficients (and multicolinearity) of OLS Allows partial pooling in the estimated intercepts and slopes Results in more precise estimated standard errors of the coefficients

6 October 13, 2009 Session 7Slide 6 Matrix form of Multilevel Models Models in which: J groups are identified Variation by groups for all estimated slopes and intercepts In matrix form, with observations N, 1 thru n Unit-level measures, indexed as i units (n i ) Y is the independent variable (predicted values are y i ) X is an n×K matrix of individual level predictors: K’s are individual-level predictors (first column all 1s) B is J×K matrix of estimated individual-level coefficients U is a J×L matrix of group-level predictors G is a L×K matrix of estimated group-level coefficients j is group indicator; l is group predictor Σ is a covariance matrix (of variation in intercepts, slopes)

7 October 13, 2009 Session 7Slide 7 Model Structure y i ~ N(X i B j[i],σ y 2 ), for i=1, … n B j ~ N(U j G,Σ B ), for j=1, … J Fixed effect variables (not permitted to vary by group) can also be included: y i ~ N(X i 0 β 0 + X i B j[i],σ y 2 ), for i=1, … n Where X 0 is a matrix of added fixed predictors, and β 0 is a vector of coefficients

8 October 13, 2009 Session 7Slide 8 Example in R Predicting votes in referendum on alternative energy tax (erdf100<-e63_erdf) by price and region: Explanatory variables: Randomly assigned values: ($6 to $2400 p/y) price<-random_p Region (already so named) ML1<-lmer(erdf100~1+(1|price)+(1|region))

9 October 13, 2009 Session 7Slide 9 LM1 Result: > summary(ML1) Linear mixed model fit by REML Formula: erdf100 ~ 1 + (1 | price) + (1 | region) AIC BIC logLik deviance REMLdev Random effects: Groups Name Variance Std.Dev. price (Intercept) region (Intercept) Residual Number of obs: 1546, groups: price, 15; region, 5 Fixed effects: Estimate Std. Error t value (Intercept)

10 October 13, 2009 Session 7Slide 10 LM1 Result, continued: Model “fixed” effects: > fixef(ML1) (Intercept) Model “random” effects: > ranef(ML1) $price (Intercept) $region (Intercept) DC Midwest Northeast South West Notice that price has a general but not monotonic downward effect on voting for the referendum

11 October 13, 2009 Session 7Slide 11 A slightly more elaborate example in R Predicting votes in referendum on alternative energy tax (erdf100<-e63_erdf) by price and region: Added (fixed) explanatory variables: Income Perceived risk of climate change ML2<- lmer(erdf100~1+(1|price)+(1|region)+risk_gc c+income)

12 October 13, 2009 Session 7Slide 12 Linear mixed model fit by REML Formula: erdf100 ~ 1 + (1 | price) + (1 | region) + risk_gcc + income AIC BIC logLik deviance REMLdev Random effects: Groups Name Variance Std.Dev. price (Intercept) region (Intercept) Residual Number of obs: 1499, groups: price, 15; region, 5 Fixed effects: Estimate Std. Error t value (Intercept) risk_gcc income Correlation of Fixed Effects: (Intr) rsk_gc risk_gcc income

13 October 13, 2009 Session 7Slide 13 LM2 Result: > fixef(ML2) (Intercept) risk_gcc income > ranef(ML2) $price (Intercept) $region (Intercept) DC Midwest Northeast South West Notice that price now has a somewhat more monotonic downward effect on voting for the referendum than was true for the simpler model. Regional differences are still pronounced.

14 October 13, 2009 Session 7Slide 14 Workshop: Continuing Elaborations Add political ideology as a new “fixed” variable Formula: lmer(erdf100 ~ (1 | price) + (1 | region) + risk_gcc + income + ideology) What happens to the effect of price and region on willingness to vote for the referendum? A caution: with multiple groups, you run into limits when you allow slope to vary within the groups; loss of degrees of freedom


Download ppt "October 13, 2009 Session 7Slide 1 PSC 5940: Elaborating Multi- Level Models in R Session 7 Fall, 2009."

Similar presentations


Ads by Google