Download Document

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Regression analysis wikipedia , lookup

Instrumental variables estimation wikipedia , lookup

Linear regression wikipedia , lookup

Least squares wikipedia , lookup

Transcript
STATA
Introductory manual
QUIZ
•
What are the main OLS assumptions?
1.
2.
3.
4.
5.
+
On average right
Linear
Predicting variables and error term uncorrelated
No serial correlation in error term
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 fulfilled
1.
2.
3.
4.
5.
On average right => ???
Linearity => ???
X and ε uncorrelated => ???
ε serially uncorrelated => ???
ε 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, nocons
and 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)