Download presentation

Presentation is loading. Please wait.

Published byKelli Pickrel Modified over 3 years ago

1
AMMBR - final stuff xtmixed (and xtreg) (checking for normality, random slopes)

2
xtreg (with assumption checking)

3
We have the standard regression model (here with only one x): but think that the data are clustered, and that the intercept (c 0 ) might be different for different clusters … where the S-variables are dummies per cluster. Because k can be large, this is not always feasible to estimate. Instead we estimate: … with the delta normally distributed with zero mean and variance to be estimated. We knew already...

4
And this you can do with xtreg xtset xtreg y x1 … and by doing this, we are trying to take into account the fact that the errors are otherwise not independent.

5
A note on xtreg: Replacing the dummies by a delta This is only allowed when the dummies themselves follow a normal distribution TO CHECK THIS: First run your model with all the dummies included (if possible) Then check whether the coefs of these dummies follow a normal distribution through the following Stata-code:

6
* Run a regression (with numbered dummies) reg y d2... d40 x1 x2 * Write the coefficients to a new variable gen coef =. forvalues i=2/40 { replace coef = _b[d`i’]if _n==`i’ } swilk coef // test for normality

7
xtmixed

8
What if c1 varies as well? The same argument applies. We already had: … and now make the c 1 coefficient dependent on the cluster (“random slopes”) This is not feasible to estimate for large k, so instead we want to model: … with zeta a normally distributed variable with zero mean and variance to be estimated

9
And this you can do with xtmixed xtmixed y x1 || : is just like the xtreg command, but if you want random slopes for x1, you add x1 after the “:” xtmixed y x1 || : x1 Your output then gives you estimates for the variance (or standard deviation) of delta and zeta.

11
xtmixed can deal with nested clusters (here: “classes within schools”) Again the same kind of argument applies. We already had: … and we want separate constant terms per class and per school So we estimate instead: … where delta is again a normally distributed variable at the school level with zero mean and variance to be estimated, and tau is a normally distributed variable at the class level with zero mean and variance to be estimated.

12
And this you can do with xtmixed as well xtmixed y x1 || school: || class: Remember to put the bigger cluster on the left!

14
[show this in Stata] (compare empty xtmixed with xtreg)

15
Horrors xtmixed finds its estimates using an iterative process. This can complicate matters: – it might not converge – it might converge but to the wrong values (and you can’t tell) – it might converge to different estimates for different algorithms in the iterative process You have only a couple of weapons against that: – run again using a different algorithm (use option “, mle”) – Allow estimation of correlations as well (use option “, cov(unstr)” ) – run the dummy-variant (with lots of dummies) anyway I do not know if any of these horrors will happen in the data you get! This is also something you can pre-check yourselves. (first: you now have a wealth of opportunities with clustered data. All effects might depend on the cluster-level.)

16
Splitting up variables (within vs across clusters) Basically this is completely unrelated to the previous. The important thing is that it can be done in clustered data, and can lead to different interpretations (see before) There are two separate issues: - which coefficients do you want to vary per cluster? - which variables do you want to include?

Similar presentations

Presentation is loading. Please wait....

OK

Chapter 10 Simple Regression.

Chapter 10 Simple Regression.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on models of marketing communication Ppt on number system for class 10 Ppt on coalition government canada Ppt on two point perspective worksheet Ppt on chapter 12 electricity and magnetism Ppt on eisenmenger syndrome causes Ppt on human resources accounting Ppt on international accounting standards Chemistry ppt on hydrogen Download ppt on teamviewer 9