|  | 
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: -est combine-?
On Jul 30, 2007, at 10:30 AM, Maarten buis wrote:
Oops, -estadd- is part of -estout-, so see -ssc desc estout- and look
for -estadd-.
--- Maarten Buis <[email protected]> wrote:
-ssc desc estadd-
	Thanks, Maarten.  As I noted previously (and detail below), I had  
attempted to use the tools in the -estout- suite without success.  I  
would, of course, welcome more specific suggestions on the  
application of -estadd- to my problem.
On Jul 30, 2007, at 10:30 AM, Ben Jann wrote:
Michael,
have a look at
 http://www.stata.com/statalist/archive/2007-06/msg00636.html
Not exactly your problem, but maybe it helps.
	Thanks, Ben.  I'm looking at that now, trying to see if I can re- 
purpose it for my application.
Furthermore, the -erepost- command might be helpful (see -ssc  
describe erepost-). The
procedure would be to do something as follows:
ivreg2 ...
est sto base
matrix b = e(b)
matrix V = e(V)
nlcom ...
... add results to b and V
[... more nlcom commands ...]
est restore base
erepost b=b V=V
est sto modified
estout modified
	Thanks again;  I'm also looking into whether I can get -erepost- to  
do my bidding.  Both of these approaches are just beyond my current  
understanding of how to manipulate -estimates- results, but I plan to  
take a stab at them today.
If you provide more details, I can be more specific.
ben
	Here is a set of examples that may clarify my question.  Given the  
notation below, I'd ultimately like one table with /a0, /b0, /b1, / 
b2, /d1, and /d2 (see the end of the example) listed in a single  
column, along with the p-values (or HAC SEs) for each of these six  
estimated parameters.  My apologies in advance for the length of this  
message.
// Regression
. nl (y = (1-{a0})*({b0} + {b1}*x1 + {b2}*x2) + {a0}*Ly), vce(hac nw  
8) var(x1 x2 Ly)
(obs = 155)
Iteration 0:  residual SS =  65.09422
Iteration 1:  residual SS =  17.74304
Iteration 2:  residual SS =  17.74304
Iteration 3:  residual SS =  17.74304
Nonlinear regression                                 Number of obs  
=       155
HAC kernel (lags): Newey-West (8)                    R-squared      
=    0.9732
                                                     Adj R-squared  
=    0.9727
                                                     Root MSE       
=   .342788
                                                     Res. dev.      
=   103.919
------------------------------------------------------------------------ 
------
             |                 HAC
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf.  
Interval]
------------- 
+----------------------------------------------------------------
         /a0 |   .9031516   .0344509    26.22   0.000     . 
8350835    .9712196
         /b0 |  -.1591713   1.405989    -0.11   0.910     
-2.937123     2.61878
         /b1 |   1.929905    .428637     4.50   0.000      
1.083004    2.776805
         /b2 |   .9768766   .5850655     1.67   0.097    -. 
1790952    2.132848
------------------------------------------------------------------------ 
------
  Parameter b0 taken as constant term in model
. eststo NLreg
. esttab NLreg, p nostar ar2 aic bic mlabels(,nodepvar) eqlabels 
(,none) modelwidth(16)
-----------------------------
                          (1)
                        NLreg
-----------------------------
a0                      0.903
                      (0.000)
b0                     -0.159
                      (0.910)
b1                      1.930
                      (0.000)
b2                      0.977
                      (0.097)
-----------------------------
N                         155
adj. R-sq               0.973
AIC                     111.9
BIC                     124.1
-----------------------------
p-values in parentheses
// Attempt #1:  Completely separate -estimates- sets result
. nlcom (d1: _b[/b0]/(1-_b[/a0]) - (1-_b[/b1])*2) (d2: (_b[/b0]/(1-_b 
[/a0]) - 2)/(1-_b[/b1])), post
          d1:  _b[/b0]/(1-_b[/a0]) - (1-_b[/b1])*2
          d2:  (_b[/b0]/(1-_b[/a0]) - 2)/(1-_b[/b1])
------------------------------------------------------------------------ 
------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf.  
Interval]
------------- 
+----------------------------------------------------------------
          d1 |      .2163   14.06365     0.02   0.988     
-27.57064    28.00324
          d2 |   3.918154   14.28661     0.27   0.784     
-24.30932    32.14563
------------------------------------------------------------------------ 
------
. estadd scalar d1 = _b[d1]
. estadd scalar d2 = _b[d2]
. esttab NLreg, p nostar ar2 aic bic mlabels(,nodepvar) eqlabels 
(,none) modelwidth(16) stats(d1 d2)
-----------------------------
                          (1)
                        NLreg
-----------------------------
a0                      0.903
                      (0.000)
b0                     -0.159
                      (0.910)
b1                      1.930
                      (0.000)
b2                      0.977
                      (0.097)
-----------------------------
d1
d2
-----------------------------
p-values in parentheses
. esttab ., p nostar ar2 aic bic mlabels(,nodepvar) eqlabels(,none)  
modelwidth(16)
-----------------------------
                          (1)
-----------------------------
d1                      0.216
                      (0.988)
d2                      3.918
                      (0.784)
-----------------------------
N                         155
adj. R-sq
AIC                         .
BIC                         .
-----------------------------
p-values in parentheses
// Attempt #2:  Clumsy; no SEs / p-values in table
. nlcom (d1: _b[/b0]/(1-_b[/a0]) - (1-_b[/b1])*2) (d2: (_b[/b0]/(1-_b 
[/a0]) - 2)/(1-_b[/b1]))
         d1:  _b[/b0]/(1-_b[/a0]) - (1-_b[/b1])*2
          d2:  (_b[/b0]/(1-_b[/a0]) - 2)/(1-_b[/b1])
------------------------------------------------------------------------ 
------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf.  
Interval]
------------- 
+----------------------------------------------------------------
          d1 |      .2163   14.06365     0.02   0.988     
-27.57064    28.00324
          d2 |   3.918154   14.28661     0.27   0.784     
-24.30932    32.14563
------------------------------------------------------------------------ 
------
. mat d = r(b)
. estadd scalar d1=d[1,1]
. estadd scalar d2=d[1,2]
. esttab NLreg, p nostar ar2 aic bic mlabels(,nodepvar) eqlabels 
(,none) modelwidth(16) stats(d1 d2)
-----------------------------
                          (1)
                        NLreg
-----------------------------
a0                      0.903
                      (0.000)
b0                     -0.159
                      (0.910)
b1                      1.930
                      (0.000)
b2                      0.977
                      (0.097)
-----------------------------
d1                      0.216
d2                      3.918
-----------------------------
p-values in parentheses
	What I ultimately would like is something akin to the following  
table, which I have constructed by hand via copy-and-paste;  I'd like  
to be able to automate construction of such a table in a .do file  
(ultimately to produce tables in SMCL and LaTeX formats):
-----------------------------
                          (1)
                        NLreg
-----------------------------
a0                      0.903
                      (0.000)
b0                     -0.159
                      (0.910)
b1                      1.930
                      (0.000)
b2                      0.977
                      (0.097)
-----------------------------
d1                      0.216
                      (0.988)
d2                      3.918
                      (0.784)
-----------------------------
N                         155
adj. R-sq               0.973
AIC                     111.9
BIC                     124.1
-----------------------------
p-values in parentheses
	Thanks again for any assistance.
                                       -- Mike
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/