110 likes | 250 Vues
Econometrics (NA3011). Reza Mortazavi 2014 Stata Lecture 1. Stata. There is a short introduction to Stata document on the course webpage on Fronter . It is very brief and intends to get you started and not to be comprehensive.
E N D
Econometrics (NA3011) Reza Mortazavi 2014 Stata Lecture 1
Stata • There is a short introduction to Stata document on the course webpage on Fronter. It is very brief and intends to get you started and not to be comprehensive. • You can download the data files that we are going to practice from http://users.du.se/~rem/ or from course webpage (see the map Data sets).
Getting started with Stata • Start the software • You can make a working directory and change to it to save your work. For example in my case: • mkdir"C:\mystata“ • cd "C:\mystata" • Open a log file: log using session1.log • (note *.log makes it editable in other programs such as Notepad)
Getting started with Stata • Open a Stata data file say: wages1.dta • From Menu Select File > Open... • (You may also type use filename in the command window. Note that this would work if the file is located in the current working directory otherwise you need to give the complete path of the file.) • In the following we are going to run commands: • use http://users.du.se/~rem/wages1.dta
Getting familiar with your data • browse • Data browsing window • Rows are cases and columns are variables • Cells with a “.” are missing values. • inspect • A quick way to gain familiarity with the data
Descriptive statistics • summarize wage exper school • summarize wage exeper,detail • hist wage You can shorten commands in Stata. For example sum age • tabulate male
Regression by OLS • correlate wage male • regr wage male • regrwage male experschool
The estimated model • Parameter estimates • Statistical significance • Overall fit of the model • Testing: • test exper=0 • test exper=school=male=0 • test (exper +school=1) (male=exper) • This test is only an example and has no real meaning here. • We could also write: test _b[exper]=0
Predicted values and residuals • predict yhat, xb • predict ehat, residuals • twoway (scatterehatyhat)
Multicollinearity • regr wage male exper school • estatvif
Closing the log file • log close • view session.log • log using session.log, append