STATA
-
Upload
rinah-england -
Category
Documents
-
view
21 -
download
3
description
Transcript of STATA
STATA
Introductory manual
QUIZ
• What are the main OLS assumptions?1. On average right2. Linear3. Predicting variables and error term uncorrelated4. No serial correlation in error term5. Homoscedasticity+ Normality of error term
QUIZ
• Do we know the error term?• Do we know the coefficients?• How can we know whether all the
assumptions are fulfilled1. On average right => ???2. Linearity => ???3. X and ε uncorrelated => ???4. ε serially uncorrelated => ???5. ε homoscedastic => ???
STATA as calculator
• Multiplication and other simple operations– display (7*(6+5)/4)^(-0.3)
• Statistical calculations– display norm(1.96)
• Generating variables– gen t=year-1967
• Etc...
STATA for matrices
• Writing down matrix– matrix X=(1,4\1,-2\1,3\1,-5)
• Reading a matrix (you have to know its name)– matrix list X
• Learning what matrices there are– matrix dir
• Multiplications – matrix XX=X’*X– matrix IXX=inv(XX)
• Etc...
Getting data to STATA
• How to get data to STATA?– From Excel [Copy&Paste, remember „commas”]– Manually [if one has the time ... ]– From other sources [import function]
• How to know what it is?– Describe [read the texts]– summarize [statistical properties]
• Learning more about your data set– correlate x1 y [just to see how it works]– histogram x1 [graphing is easier from the menu]– scatter x1 y [as above ]
Regression with STATA
• How to do regression?– regress y x– regress y x, noconsand that’s it
Diagnostics with STATA
• Normality of the residual– predict e, residual [directly after regress]– sktest e [Jarque-Bery test]
• RESET test– ovtest, rhs
Diagnostics with STATA
• Heteroscedasticity– hettest, rhs [Breush-Pagan test]– imtest, white [White test]
• Autocorrelation– tsset t – dwstat [Durbin-Watson test]– bgodfrey, lags(1 2 3) [Breush-Godfrey test]
Diagnostics with STATA
• Structural stability [Chow]– gen d=0– gen dx1=0– gen dx2=0– gen dx3=0– replace d=1 if t>50– replace dx1=x1 if t>50– replace dx2=x2 if t>50– replace dx3=x3 if t>50– reg y x1 x2 x3 d dx1 dx2 dx3– test (d=0) (dx1=0) (dx2=0) (dx3=0)