Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Re: save results from the simulation


From   "Supnithadnaporn, Anupit" <gtg065t@mail.gatech.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: save results from the simulation
Date   Sun, 26 Oct 2008 17:12:58 -0400 (EDT)

Hello,

Thank you Martin for pointing to the reference about -post- command.

Also, thank you Maarten for directing me to your files. I believe they will 
be useful for me in the near future. 

I really appreciate the code suggested by Kit. I would like to explain
my program a bit more.

//        mfx c : don't know what you're trying to do here, but do mfx and  
look at return list

Here, I want to save the marginal effects of a and b after running the 
logit for each repetition. I check the ereturn list and find that these are
the matrices that I would like to save:
e(Xmfx_dydx)
e(Xmfx_se_dydx)
e(Xmfx_X)

However, I am a bit confused about how to save them.

1) Do I have to use them (e()) with -post-? If yes, how to declare 
this within the -program-?

2) Are the new dataset saved by using -post- different from the one saved by
-saving- option of -simulation- command?

Thank you so much,
Anupit

----- "Kit Baum" <baum@bc.edu> wrote:

> < >
> program drop _all
> clear
> 
> program define simlogit, rclass
> 	version 9.2
> 	tempvar a b
> 	gen `a' = $k*invnorm(uniform())+ $m
> 	gen `b' = $j*invnorm(uniform())+ $n
> 	logit y `a' `b'
> 	test `a' `b'
> 	ret scalar chia = r(chi2)
> 	ret scalar pvala = r(p)
> 	test `a'=`b'
> 	ret scalar chib = r(chi2)
> 	ret scalar pvalb = r(p)
> //	mfx c : don't know what you're trying to do here, but do mfx and  
> look at return list
> end
> 
> global k=1
> global j=1
> global m=1
> global n=2
> set obs 100
> gen y = (invnorm(uniform()) > 0.7)
> 
> local reps 1000
> 
> simulate chia = r(chia) pvala = r(pvala) chib = r(chib) pvalb =  
> r(pvalb), ///
> reps(`reps') nodots saving(simlogit1.dta, replace): simlogit
> 
> use simlogit1
> desc
> su
> 
> 
> Kit Baum, Boston College Economics and DIW Berlin
> http://ideas.repec.org/e/pba1.html
> An Introduction to Modern Econometrics Using Stata:
> http://www.stata-press.com/books/imeus.html
> 
> 
> On Oct 26, 2008, at 02:33 , Anupit 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.
> 
> *
> *   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/



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