Statalist The Stata Listserver

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

st: RE: Accumulating results under -simulate-

From   "Nick Cox" <>
To   <>
Subject   st: RE: Accumulating results under -simulate-
Date   Wed, 4 Oct 2006 14:57:52 +0100

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' ... 


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:

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