Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Accumulating results under -simulate-


From   Herb Smith <[email protected]>
To   [email protected]
Subject   Re: st: RE: Accumulating results under -simulate-
Date   Wed, 4 Oct 2006 10:04:55 -0400 (EDT)

Thanks--your understanding is similar to mine.  I was in process of
writing loops for the command when I got to wondering if there might not
be another way....

Herbert L. Smith
Professor of Sociology and
Director, Population Studies Center
230 McNeil Building
3718 Locust Walk CR
University of Pennsylvania
Philadelphia, PA  19104-6298

[email protected]

215.898.7768 (office)
215.898.2124 (fax)

On Wed, 4 Oct 2006, Nick Cox wrote:

> As I understand it, you can write a program that returns
> matrices, but -simulate- does not offer a way to catch
> them and store them. In any case, what you appear to want
> would just solve one problem by creating another.
>
> If the pain is typing out a long specification, then just
> use a loop upstream of your command to produce the part of
> the command that is repetitive.
>
> forval i = 1/99 {
> 	local call "`call' b`i'=r(b`i')"
> }
>
> simulate ... `call' ...
>
> Nick
> [email protected]
>
> Herb Smith
>
> > I am -simulate-ing a routine that returns numerous parameters
> > of (at least
> > potential) interest:  99 right now (11 coeffs x 9 aspects of estimated
> > sampling distributions...)
> >
> > The example under -help simulate- is comparatively homely:  only two
> > parameters returned, as scalars, e.g.,
> >
> > ". simulate mean=r(mean) var=r(Var), reps(10000): lnsim, obs(100)"
> >
> > (Both -mean- and -Var- are -return-ed as scalars in the program called
> > under -simulate-.)
> >
> > Is there a more elegant way to do this?  For example, can I
> > -return- to
> > -simulate- one (or more) matrixes?  If nothing else, this saves me a
> > statement with 99 iterations:
> >
> > -b11=r(b11) b12=r(b12) ... b21=r(b21) ... b99=r(b99)
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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