{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This 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 .
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern