Bookmark and Share

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: rename estimate coefficients: ereturn repost


From   Johannes Breckenfelder <Johannes.Breckenfelder@hhs.se>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: rename estimate coefficients: ereturn repost
Date   Wed, 23 Jan 2013 18:04:57 +0000

Thank you very much, Aljar, for the comments below. Unfortunately it doesn't solve my problem, it would be awesome if you could have another look:

I'm starting off with these stored estimates:
****************************************************************************
.         eret list

scalars:
                  e(N) =  534

macros:
                e(cmd) : "regress"
             e(depvar) : "Excess Return"
         e(properties) : "b V"

matrices:
                  e(b) :  1 x 5
                  e(V) :  5 x 5

functions:
             e(sample)   
***************************************************************************

Next, I'm running this procedure to change column names:
****************************************************************************
program drop disp2
program disp2, eclass
	matrix betass=e(b)
	matrix colnames betass = "aa" "bb" "cc" "DD" "ee" "ff"
	mat list betass 
	ereturn repost b = betass, rename
end
****************************************************************************

Then, I check whether it actually did change -and it didn't....
****************************************************************************

	matrix betass=e(b)
	mat list betass

betass[1,6]
           r1         r2         r3         r4         r5         r6
y1  1.0086253  .76111561  .00520306  .26619872  .02242498          0
****************************************************************************

... even though the individual step does work:
****************************************************************************

          matrix colnames betass = "aa" "bb" "cc" "DD" "ee" "ff"
          mat list betass 

betass[1,6]
           aa         bb         cc         DD         ee         ff
y1  1.0086253  .76111561  .00520306  .26619872  .02242498          0
****************************************************************************

Somehow it doesn't go through... Any ideas?

Thanks again,

Jay




-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Aljar Meesters
Sent: den 23 januari 2013 18:23
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: rename estimate coefficients: ereturn repost

I do not know what you exactly want to do, but in order to get your program running you should:
1) rename disp
disp is already a Stata build-in command.

2) Not use ereturn post b V
You do not have a matrix b so you can not ereturn it.

This should do what I think that you have in mind:

program disp2, eclass
	matrix betass=e(b)
	matrix colnames betass = "aa" "bb" "cc" "DD" "ee" "ff"
	mat list betass
	ereturn repost b= betass, rename
end

Best,

Aljar


2013/1/23 Johannes Breckenfelder <Johannes.Breckenfelder@hhs.se>:
>
>
> Dear Statalist,
>
>
>
> I'm in urgent need of help. I've got stuck with this for days now and 
> can't figure out what goes wrong...
>
>
>
> I would like to create a multi-column table with outreg2 from stored 
> estimates. There are no labels stored with the estimates, just the b 
> V. For each stored set of estimates, I run:
>
>
>
> program disp, eclass
>
>                              ereturn post b V
>
>                              matrix betass=e(b)
>
>                              matrix colnames betass = "aa" "bb" "cc" "DD"
> "ee" "ff"
>
>                              mat list betass
>
>                              ereturn repost b = betass, rename
>
> end
>
>
>
> Every step seems to produce the desired outcome, except the last one:
> ereturn repost b = betass, rename.
>
>
>
> Where is my coding/conceptual error?
>
>
>
> Thank you very much in advance!
>
>
>
> Jay
>
>
>
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index