Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

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

From |
Nick Cox <n.j.cox@durham.ac.uk> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: name conflict in posting a matrix |

Date |
Wed, 11 Jul 2012 11:31:03 +0100 |

You used a temporary name. If you want to pick up e(xb_s), you need to define it as such. Not ereturn scalar `xb_s'= r(mean) but ereturn scalar xb_s = r(mean) I guess you are a point in your learning programming when you waste more time not reading the relevant chapters in [U] than you do by trying code changes to see what works and then puzzling at length over why it doesn't work. Nick n.j.cox@durham.ac.uk Emmanouil Mentzakis Thank you for the example. If on top of the betas I wanted to also bootstrap e.g. the y_fit how would I do it in the same program? Below I ve edited your example to show what I d like to do but as expected it produces an error. ******************** clear all sysuse auto program define toboot, eclass tempname b xb xb_s reg price mpg foreign matrix `b' = e(b) reg rep78 mpg foreign matrix `b' = `b', e(b) matrix colnames `b' = price:mpg price:foreign price:_cons /// rep78:mpg rep78:foreign rep78:_cons ereturn post `b' predict `xb', xb sum `xb' ereturn scalar `xb_s'= r(mean) end bootstrap _b xb=e(xb_s), reps(100) :toboot On Tue, Jul 10, 2012 at 4:07 PM, Maarten Buis <maartenlbuis@gmail.com> wrote: > On Tue, Jul 10, 2012 at 4:11 PM, Emmanouil Mentzakis wrote: >> I think the problem is that I don't tell -ereturn- correctly that I >> have two equations with the same covariates (I try to rename them >> using -matrix coleq-) and it therefore sees the same covariates names >> appear multiple times, hence the name conflict. However, I often >> models in Stata use the same covariates in multiple equations and >> naming them with a prefix similar to eq1 etc. > > *------------------------- begin example ------------------------------ > clear all > sysuse auto > > program define toboot, eclass > tempname b > reg price mpg foreign > matrix `b' = e(b) > reg rep78 mpg foreign > matrix `b' = `b', e(b) > matrix colnames `b' = price:mpg price:foreign price:_cons /// > rep78:mpg rep78:foreign rep78:_cons > ereturn post `b' > end > > bootstrap _b, reps(100) :toboot > *-------------------------- end example ------------------------------- > * * 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/

**References**:**st: name conflict in posting a matrix***From:*Emmanouil Mentzakis <ementzakis@gmail.com>

**Re: st: name conflict in posting a matrix***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: name conflict in posting a matrix***From:*Emmanouil Mentzakis <ementzakis@gmail.com>

**Re: st: name conflict in posting a matrix***From:*Maarten Buis <maartenlbuis@gmail.com>

**Re: st: name conflict in posting a matrix***From:*Emmanouil Mentzakis <ementzakis@gmail.com>

- Prev by Date:
**Re: st: change default date base (1 jan 1960)** - Next by Date:
**RE: st: change default date base (1 jan 1960)** - Previous by thread:
**Re: st: name conflict in posting a matrix** - Next by thread:
**st: Quadratics and FD?** - Index(es):