Statalist


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

st: Re: save results from the simulation


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: save results from the simulation
Date   Mon, 27 Oct 2008 09:13:12 -0400

< >
I believe you will have to extract the desired elements from those matrices and return them as scalars, e.g. within your program,

	mfx
	mat xmfxx = e(Xmfx_X)
	ret scalar xmfxx1 = xmfxx[1,1]
	ret scalar xmfxx2 = xmfxx[1,2]
	eret clear

Something I did not know is that -simulate- will pick up everything in r() if it has been changed but e() has not. Of course -logit- and - mfx- change e(). That's why I include -eret clear- here. Then you can just say

simulate, reps(`reps') nodots saving(simlogit1.dta, replace): simlogit

and it will pick up all the scalars that you have created in the program.

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 27, 2008, at 02:33 , Anupit wrote:


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?

*
*   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