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]
Re: st: name conflict in posting a matrix
From
Emmanouil Mentzakis <[email protected]>
To
[email protected]
Subject
Re: st: name conflict in posting a matrix
Date
Tue, 10 Jul 2012 16:39:16 +0100
Dear Maarten,
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.
Thank you very much for your time
Regards
Manos
********************
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 <[email protected]> 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 -------------------------------
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
>
> http://www.maartenbuis.nl
> --------------------------
>
> *
> * 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/