<>
John,
apologies, I didn't actually write a myprobit before sending the post,
so I guessed about what the variable names after simulation will be
from my previous simulations. It turns out that they would be _b_x1
and _b_x2, not y_b_x1 and y_b_x2 (same for standard deviations).
Therefore, just drop the leading y everywhere in the loop, and
everything should work fine. Here is a working example.
****************
matrix mean = 2,2
matrix sd = 1,4
matrix corr = 1,0.5\0.5,1
capture program drop myprobit
program myprobit
drop _all
set obs 1000
drawnorm x1 x2, mean(mean) sd(sd) corr(corr) cstorage(full)
gen eps = rnormal(0,1)
gen ystar = 5+3*x1-2*x2+eps
gen y = normal(ystar)>0.5
probit y x1 x2
end
simulate _b _se, reps(50) seed(123) : myprobit
foreach v in x1 x2 {
gen t_`v' = _b_`v'/_se_`v'
gen p_`v' = 2*(1-normal(abs(t_`v')))
}
*****************
Hope this helps,
Eva
Eva
2009/5/10 John Antonakis <[email protected]>:
Hi Eva:
Working with your solution first--it seems to be simple to use. So I have
three RHS variables. Everything works fine until this point:
. foreach v in x z q {
2. gen t_`v' = y_b_`v'/y_se_`v'
3. gen p_`v' = 2*(1-normal(abs(t_`v'))
4. }
y_b_x not found
r(111);
Can you tell what's wrong?
Thanks,
John.
____________________________________________________
Prof. John Antonakis
Associate Dean Faculty of Business and Economics
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland
Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305
Faculty page:
http://www.hec.unil.ch/people/jantonakis&cl=en
Personal page:
http://www.hec.unil.ch/jantonakis
____________________________________________________
On 10.05.2009 09:53, Eva Poen wrote:
<>
If John wishes to return coefficients and associated statistics after
estimation for a simulation he might want employ an eclass program.
This way, he can easily access coefficients and standard errors, and
calculate t-statistics and p-values afterwards. Here is an example:
*******************
program myprobit, eclass
...
probit y x1 x2
end
simulate _b _se , reps(1000) seed(123) saving(myprobit, replace
every(50)) : myprobit
use myprobit
foreach v in x1 x2 {
gen t_`v' = y_b_`v'/y_se_`v'
gen p_`v' = 2*(1-normal(abs(t_`v'))
}
**********************
Hope this helps,
Eva
2009/5/9 John Antonakis <[email protected]>:
I am running an rclass program that I wish to simulate.
After estimating a probit, I want to save the coefficients, along with
the
t-stats and the p-values for later simulation. I figured out the former
but
not the latter two. What I have so far is:
probit y x1 x2
return scalar b1 =_b[x1]
return scalar b2 =_b[x2]
Thanks,
John.
--
____________________________________________________
Prof. John Antonakis
Associate Dean Faculty of Business and Economics
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland
Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305
Faculty page:
http://www.hec.unil.ch/people/jantonakis&cl=en
Personal page:
http://www.hec.unil.ch/jantonakis
____________________________________________________
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/