Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Estout and predicted signs

From   "Herve STOLOWY" <>
To   <>
Subject   Re: st: RE: Estout and predicted signs
Date   Sun, 13 Feb 2005 16:56:18 +0100

Dear Ben:

As usual, I sincerely appreciate your help. I tried the two solutions
and they both work. I prefer the second one for the following reason: in
my table, I get the results from two regressions:

- model 1: with var1 and var2
- model 2: with var1, var2 and var3.

With your solution 1, I get twice the predicted sign column (once with
each model).
With your solution 2, I get it once and where I want, i.e. before the
model 1 with two variables but with the signs for three variables. (I
"cheat" by using the model 2 only for generating the signs column before
prsign - + -).

I still have a little remaining problem. In my real estimation (see
below), I need to have the b and p values published. 

estout signs m1 m2 m3 m4 using estout_test3, replace substitute(-999 -
999 +) cells ("b p(fmt(%9.3f))") stats (N F p r2 r2_a, fmt(%9.0f %9.3f
%9.3f %9.3f %9.3f) labels ("Number of observations" "F" "Prob>F"
"R-square" "Adjusted R-square")) label  varlabels(_cons Constant)

Then, I get for the predicted signs two columns: one with the b and one
with the p. I don't know if I can write -estout- in such a way that, for
the "signs" model, I only get the "b" (i.e. the signs). I looked at the
-estout- help and found something with -drop- and -estimates- but I
don't know what to do.

Another minor element: when I precise the format for the b, the signs
disappear and are replaced by a 0. So, I decided not to add a precise
format for the b. (I can manage the format in excel later).

Excuse me again for these "fine tuning" questions but -estout- is such a
tremendous tool that if you've used it once, you would like to get
everything from it.

Best regards


Coordinateur du Département/Head of Department
HEC Paris
Département Comptabilité Contrôle de gestion / Dept of Accounting and
Management Control
1, rue de la Liberation
78351 - Jouy-en-Josas
Tel: +33 1 39 67 94 42 - Fax: +33 1 39 67 70 86
>>> 02/12/05 9:17 PM >>>
Hervé wrote:
>In a regression table, I would like to insert a column with predicted
>signs after the var names. I know that I can do it manually in my excel
>sheet after -estout- but I would like to know if it is possible to do
>with -estout-.

There is no simple solution to the problem. You can, for example, 
add a matrix indicating the predicted signs to the estimates and then 
use -estout- to table both the estimates and the predicted signs. 
The problem is of course that you cannot have strings in a matrix.
Thus, use, say, "999" for "positive sign" and "-999" for "negative
sign" and then apply -estout-'s -substitute()- option. An example:

  sysuse auto
  regress price mpg weight foreign
  tempname b
  matrix `b' = e(b)
  matrix `b' = `b'[1,1..3] //get rid of constant
  matrix `b'[1,1] = -999   //neg. sign for mpg
  matrix `b'[1,2] = +999   //pos. sign for weight
  matrix `b'[1,3] = +999   //pos. sign for foreign
  eret2 matrix signs = `b'
  estimates store model1
  estout model1, cells("signs b") substitute(-999 - 999 +)

Alternatively, store the predictes signs as an own set of
"fake" estimates: 

  capture program drop prsign
  program define prsign, eclass
    tempname b V
    matrix `b' = e(b)
    matrix `V' = e(V)
    local i = 0
    foreach sign of local 0 {
      matrix `b'[1,`++i'] = `sign'999
    ereturn post `b' `V'
    ereturn local cmd sham

  sysuse auto
  regress price mpg weight foreign
  estimates store model1
  regress price mpg weight foreign, noconstant
  prsign - + +
  estimates store signs
  estout signs model1, substitute(-999 - 999 +)


*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index