test a b
return scalar chi20 = r(chi2)
test a=b
return scalar chi2equal = r(chi2)
For more see the example in -help simulate- and -help return-, also see
my presentation at the last Summer North American Stata Users' meeting:
http://ideas.repec.org/p/boc/nsug08/14.html (in the zip-file there is a
readme.txt explaining how to use Stata to view that presentation).
Hope this helps,
Maarten
--- "Supnithadnaporn, Anupit" <[email protected]> wrote:
> I am testing a simple simulation before using it with the real data.
> In the program, there are some results that I would like to save.
> Would anybody please give me some suggestions of how to do this,
> especially when there are 2 values of chi2.
>
> Thank you,
> Anupit
>
>
> -----Results needed to save-----
> test a b
> - chi2( 1)
> - Prob > chi2
>
> test a=b
> - chi2( 1)
> - Prob > chi2
>
> mfx c
> - dy/dx
> - Std. Err.
> - x
>
> -----Program simlogit-----
>
> program define simlogit, rclass
> version 9.2
> gen a = k*invnorm(uniform())+ m
> gen b = j*invnorm(uniform())+ n
> logit y a b
> test a b
> test a=b
> mfx c
> drop a b
> end
>
> simulate _b _se, reps(10) saving(simlogit1.dta, replace): simlogit,
> obs(100)
>
>
>
> *
> * 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/
>
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/