Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: I can't get estout to post e(at) results after margins


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: I can't get estout to post e(at) results after margins
Date   Mon, 17 May 2010 16:10:45 -0400

Carlos Zambrana <czstata@gmail.com> :
I think I left out a line:

clear all
prog relabat, eclass
 version 11
 if replay() {
 error 198
 }
 tempname a b v
 loc N=e(N)
 mat `b'=e(b)
 mat `v'=e(V)
 mat `a'=e(at)
 forv i=1/`=rowsof(`a')' {
  loc n `n' `=`a'[`i',1]'
  }
 mat colnames `b'=`n'
 mat rownames `v'=`n'
 mat colnames `v'=`n'
 eret post `b' `v', obs(`N')
 eret local cmd="relabat"
 end
sysuse auto
qui regress mpg c.weight##c.weight
qui margins, dydx("weight") at(weight=(1760(200)4840)) post chainrule
est sto r0
mat a=e(at)
forv i=1/`=rowsof(a)' {
 loc l `l' `=a[`i',1]'
 }
esttab r0, labcol2(`l')
relabat r1
est sto r1
esttab r1



On Mon, May 17, 2010 at 4:10 PM, Austin Nichols <austinnichols@gmail.com> wrote:
> Carlos Zambrana <czstata@gmail.com> :
> You can always manipulate the -ereturn- output and repost inside an
> eclass program (see also
> http://repec.org/bocode/e/estout/advanced.html#advanced907 and
> following topics); try e.g. these two methods:
>
> clear all
> prog relabat, eclass
>  version 11
>  if replay() {
>  error 198
>  }
>  tempname a b v
>  loc N=e(N)
>  mat `b'=e(b)
>  mat `v'=e(V)
>  mat `a'=e(at)
>  forv i=1/`=rowsof(`a')' {
>  loc n `n' `=`a'[`i',1]'
>  }
>  mat colnames `b'=`n'
>  mat rownames `v'=`n'
>  mat colnames `v'=`n'
>  eret post `b' `v', obs(`N')
>  eret local cmd="relabat"
>  end
> sysuse auto
> qui regress mpg c.weight##c.weight
> margins, dydx("weight") at(weight=(1760(200)4840)) post chainrule
> est sto r0
> forv i=1/`=rowsof(a)' {
>  loc l `l' `=a[`i',1]'
>  }
> esttab r0, labcol2(`l')
> relabat r1
> est sto r1
> esttab r1
>
> On Mon, May 17, 2010 at 3:06 PM, Carlos Zambrana <czstata@gmail.com> wrote:
>> Hi all,
>>
>> Suppose I'm trying to do something like:
>>
>> clear
>> webuse auto
>> regress mpg weight c.weight#c.weight
>> margins, dydx("weight") at("weight"=(1760(200)4840)) post chainrule
>>
>> And after that I would like to export a table with the e(at) points
>> together with the e(b) coefficients and their respective significance
>> stars. I tried
>>
>> estout, cells("b&_star at")
>>
>> and
>>
>> estadd matrix At=e(at)'
>> estout, cells("b&_star at At")
>>
>>  (I also tried "estadd matrix At=e(at)" just in case matrix dimensions mattered)
>>
>> But i always get a table with the e(b) coefficients and empty spaces
>> for the e(at) or e(At) points. I can turn e(b) into a matrix and
>> estout the joined (AT\e(b)) matrix but then I can't add the
>> significance stars to this matrix.
>>
>> How can I get e(at) to be treated as an estimates matrix so that I can
>> just use estout to post the results to an excel file?
>>
>> Thanks in advance.
>

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