# Re: st: Returning a p-value for simulation

 From John Antonakis To statalist@hsphsun2.harvard.edu Subject Re: st: Returning a p-value for simulation Date Sun, 10 May 2009 10:10:00 +0200

```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. }
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 <john.antonakis@unil.ch>:
```
```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/
```