Statalist


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

Re: st: Using -simulate- with returned matrices from estimation commands


From   Stas Kolenikov <skolenik@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Using -simulate- with returned matrices from estimation commands
Date   Tue, 14 Apr 2009 17:08:00 -0500

Aside from -bootstrap- doing what you need (by default, it stores the
estimated coefficients), what you can do might be:

1. make it return values:

program beta2r, rclass
   local vars : colnames e(b)
   tokenize `vars'
   while "`1'"!="" {
      return scalar b_`1' = _b[`1']
      mac shift
   }
end

for single equation models

2. Accumulate your results in Mata:

mata : bb = st_matrix( "e(b)" )
mata : simul = J(0, length(bb), . )
...
mata : bb = st_matrix( "e(b)" )
mata : simul = simul \ bb

and then -st_store()- the results.

On 4/14/09, moleps islon <moleps2@gmail.com> wrote:
> I've been fiddling around searching for solutions to this but to no
>  avail. Is this at all possible?
>
>  E.g. program sketch
>
>  program a
>
>  preserve
>  bsample
>  e-command
>
>  return beta-matrix
>  restore
>
>  end
>
>  simulate beta-matrix,r(100):bootbeta
>
>
>  Regards,
>
>  Moleps
>  *
>  *   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/
>


-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
*   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