Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: regression simulation


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: Re: regression simulation
Date   Tue, 21 Dec 2004 07:10:56 -0500

Certainly, the simulate command could be used here, and for more complicated simulations it is essential. I wanted to illustrate how one could do what was requested from first principles, which in this case does not involve much overhead vis-a-vis simulate: only an understanding of how the 'post' command works, which is a good thing to acquire IMHO.

Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html

On Dec 21, 2004, at 2:33 AM, maartenbuis wrote:


One way to make Kit's code more elegant is to use the -simulation-
command:

program define sim, rclass
drop _all
set obs 100
drawnorm y x
reg y x
return scalar se = _se[x]
return scalar t  = _b[x]/_se[x]
end

simulate "sim" se=r(se) t=r(t), dots reps(1000)
desc
sum
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index