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 15275 15296 -7634 15271 15267 Random effects: Groups Name Variance Std.Dev. price (Intercept) 97.5853 9.8785 region (Intercept) 8.7641 2.9604 Residual 1113.6147 33.3709 Number of obs: 1546, groups: price, 15; region, 5 Fixed effects: Estimate Std. Error t value (Intercept) 59.026 3.064 19.26

10 October 13, 2009 Session 7Slide 10 LM1 Result, continued: Model “fixed” effects: > fixef(ML1) (Intercept) 59.02646 Model “random” effects: > ranef(ML1) $price (Intercept) 6 10.9984667 12 16.9622335 24 9.0150973 48 3.9987404 72 5.2021635 96 6.6376141 120 4.5916349 240 0.4564991 360 -3.9936648 480 0.5152638 600 -13.0358925 960 -7.6250006 1200 -9.9792552 1800 -13.3607233 2400 -10.3831771 $region (Intercept) DC 1.0115732 Midwest -2.3769052 Northeast 2.8444585 South -2.2089443 West 0.7298179 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 14625 14657 -7307 14615 14613 Random effects: Groups Name Variance Std.Dev. price (Intercept) 97.9974 9.8994 region (Intercept) 5.2794 2.2977 Residual 980.2426 31.3088 Number of obs: 1499, groups: price, 15; region, 5 Fixed effects: Estimate Std. Error t value (Intercept) 24.8625 3.8513 6.456 risk_gcc 4.3211 0.3101 13.935 income 0.7797 0.2037 3.828 Correlation of Fixed Effects: (Intr) rsk_gc risk_gcc -0.565 income -0.361 0.061

13 October 13, 2009 Session 7Slide 13 LM2 Result: > fixef(ML2) (Intercept) risk_gcc income 24.8624618 4.3211129 0.7796922 > ranef(ML2) $price (Intercept) 6 10.604908 12 15.746345 24 10.333354 48 4.403629 72 4.862797 96 7.099840 120 4.391877 240 1.214670 360 -3.002569 480 1.251219 600 -11.445885 960 -9.836373 1200 -10.447160 1800 -12.553367 2400 -12.623284 $region (Intercept) DC 0.8290169 Midwest -1.8887826 Northeast 2.2940789 South -1.0643706 West -0.1699426 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