Stata-basics_by_example-3 - If I change the definition of...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Stata - Basics by example-3 This handout describes two new Stata features. First, I’ll write a small program to generate artificial data and estimate a regression. Then, I’ll use the simulate command to conduct a Monte Carlo analysis of the properties of the regression estimates. program montecarlo args c drop _all set obs 100 gen x1=invnorm(uniform()) gen x2=invnorm(uniform()) gen u=`c'*invnorm(uniform()) gen y = 0 + 1*x1 -1*x2 + u regress y x1 x2 end I have chosen to name the program “montecarlo” and this program has one argument, c . I will need to input this argument if we want to execute the program. The program statement begins with program and ends with end. To execute this program, I would type montecarlo 2 where 2 is the chosen value of the argument c .
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: If I change the definition of the program, I need to either give it a new name, or drop the old program using program drop montecarlo Monte Carlo experiments provide ways to evaluate the statistical properties of estimators, either to verify theorems, or to examine properties in cases where theorems do not exist. In the program above, data are generated under the assumptions of the CLRM, so the Gauss-Markov Theorem should apply to estimates of parameters generated by OLS. To verify these, we can use the simulate command as shown below. In this experiment, data will be generated 1000 times and the regression coefficients ( _b ) and their standard errors ( _se ) will be saved. simulate "montecarlo 2" _b _se, reps(1000)...
View Full Document

Ask a homework question - tutors are online