Statalist


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

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


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Re: Using -simulate- with returned matrices from estimation commands
Date   Tue, 14 Apr 2009 23:23:20 +0200

<>

Well, you probably want the col names of the matrix e(b), and a -program- can return those, but you are not getting me started on another round of our weekly discussion whether -stepwise- is a good command or idea. See http://www.stata.com/support/faqs/stat/stepwise.html


***
//drop the thing
capt prog drop sim

//program definition

   program define sim, rclass
       version 10.1
       drop _all
       sysuse auto
   generate weight2 = weight^2
stepwise, pr(.1): regress mpg weight weight2 displ gear turn headroom foreign price, vce(boot)
        return local names : colnames e(b)
   end
***


HTH
Martin
_______________________
----- Original Message ----- From: "moleps islon" <moleps2@gmail.com>
To: <statalist@hsphsun2.harvard.edu>
Sent: Tuesday, April 14, 2009 10:48 PM
Subject: Re: st: Re: Using -simulate- with returned matrices from estimation commands


OK.. that was helpful. Didnt know the matrix automatically found its
way into simulate.

However, my objective here is to use stepwise,pr (0.1): regress x y z
d f and to return the matrix for each run so that I in the end can see
how often the variable was selected in the model and also see whether
it had a pos or neg beta (Similar to Sauerbreis selection and
stability procedure). So preferably I'd like -simulate- to return the
final matrix for each run with its associated betas for each model.


On Tue, Apr 14, 2009 at 10:09 PM, Martin Weiss <martin.weiss1@gmx.de> wrote:
<>

This certainly works, the betas are returned by default...

***
cap prog drop bootbeta

sysuse auto, clear

program bootbeta

preserve
bsample
reg price weight rep for tr turn
restore

end

simulate, r(100):bootbeta
***

Although it makes you wonder why you do not use the -vce(boot)- option
directly...


HTH
Martin
_______________________
----- Original Message ----- From: "moleps islon" <moleps2@gmail.com>
To: <statalist@hsphsun2.harvard.edu>
Sent: Tuesday, April 14, 2009 9:58 PM
Subject: st: Using -simulate- with returned matrices from estimation
commands


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/


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


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