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
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: name conflict in posting a matrix
Date
Tue, 10 Jul 2012 14:23:53 +0100
What you are trying to do here is not clear. You are -bootstrap-ping
_b which you can do directly, e.g .
. bootstrap _b , reps(2) : regress mpg foreign, nocons
You don't need to write a program to do that. Conversely, what is the
point of the program? It just does the same estimation twice and you
don't ask -bootstrap- to pay attention to its results.
By the way, the stuff like
local s1 = 1
local s2 = 2
local s3 = 3
is pure indirection. Your code can be simplified down to
sysuse auto,clear
cap prog drop ddd
program ddd, eclass
tempname b1 b2 b3 betas
reg price foreign, nocons
mat `b1'=e(b)
matrix coleq `b1' = eq1
reg price foreign, nocons
mat `b2' =e(b)
matrix coleq `b2' = eq2
mat `b3'=1
mat `betas' = `b1', `b2', `b3'
ereturn post `betas'
end
On Mon, Jul 9, 2012 at 8:53 PM, Emmanouil Mentzakis
<[email protected]> wrote:
> Dear all,
>
> I am trying to -ereturn post- a matrix in order to bootstrap it but
> get an error. I d be grateful if anyone could point to my mistake.
> Below is an example.
>
> Thank you
>
> Regards
> Manos
>
>
> *** Example ***
>
> sysuse auto,clear
>
> cap prog drop ddd
> program ddd, eclass
> tempname b1 b2 b3 betas
> reg price foreign, nocons
> local s1=1
> mat `b`s1''=e(b)
> matrix coleq `b`s1'' = eq`s1'
>
> reg price foreign, nocons
> local s2=2
> mat `b`s2''=e(b)
> matrix coleq `b`s2'' = eq`s2'
>
> local s3=3
> mat `b`s3''=1
>
> mat `betas' = `b1', `b2', `b3'
> ereturn post `betas'
> end
>
> bootstrap _b, reps(2): ddd
*
* 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/