Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: estout, OLS and multiple Heckman selection models


From   "Ben Jann" <[email protected]>
To   [email protected]
Subject   Re: st: estout, OLS and multiple Heckman selection models
Date   Thu, 22 Nov 2007 01:04:20 +0100

Here is an example which comes pretty close, I think (not very simple
I have to admit):

sysuse auto, clear
reg price mpg
est store ols, title(Price)
heckman price mpg, select(foreign = mpg trunk weight length) twostep
est store ss2step, title(Price)
est store ss2step2, title(Car type)
heckman price mpg, select(foreign = mpg trunk weight length)
est store ssmle, title(Price)
est store ssmle2, title(Car Type)
estout ols ss2step ss2step2 ssmle ssmle2, style(smcl) ///
    cells(b(star fmt(3)) se(par)) ///
    label eq(1:1:2:1:2, .:.:3:.:., .:.:.:.:3, .:.:.:.:4) ///
    keep(#1: #2: #3: #4:) eqlabels("", none) ///
    varlabels(#3:_cons athrho #4:_cons lnsigma) ///
    mgroups(OLS 2-step MLE, pattern(1 1 0 1 0))

One issue is that athrho and lnsigma are displayed for the MLE model,
instead of rho and lambda. There are three different approached to
change this (all are somewhat involved; ask me if you need details):
- use the transform() option
- include the number as scalars in e() (using -estadd-; not that some
of the numbers are already there) and then tabulate them in the bottom
of the table using the stats()
- get the e(b) (and e(V)) from the model, modify it, and repost using
-erepost- (see -ssc d erepost-)

(Note that the last approach could also be used to extract single
equations from the models, so that the complicated -equations()-
option could be avoided.)

One more thing: it seems from you example that the -vacant()- cells
suboption does not work if -unstack- is specified. I'll try to fix
that.
ben

On Nov 21, 2007 9:19 PM, Dimitriy V. Masterov <[email protected]> wrote:
> Here's an example of some nonsensical code:
>
> #delimit;
> use auto, clear;
> reg price mpg;
> est store ols, title(OLS);
> heckman price mpg, select(foreign = mpg trunk weight length) twostep;
> est store ss2step, title(2-Step);
> heckman price mpg, select(foreign = mpg trunk weight length);
> est store ssmle, title(MLE);
> estout ols ss2step ssmle using est.tex, style(tex) cells(b(star
> fmt(%12.3f) vacant(-)) se(par fmt(%12.3f) vacant(-))) unstack label
> replace collabels(, none)
> varlabels(_cons Constant ) starlevels(* 0.10 ** 0.05 *** 0.01)
> drop(athrho: lnsigma:);
>
>
> Here's the output:
>                     &         OLS   &      2-Step   &               &
>              &         MLE   &               \\
>                     &           _   &       Price   &    Car type   &
>      mills   &       Price   &    Car type   \\
> Mileage (mpg)       &    -238.894***&    -240.659** &      -0.104** &
>              &    -272.494***&      -0.145***\\
>                     &    (53.077)   &   (119.333)   &     (0.052)   &
>              &    (74.468)   &     (0.048)   \\
> Trunk space (cu. ft.)&               &               &       0.016   &
>               &               &      -0.039   \\
>                     &               &               &     (0.065)   &
>              &               &     (0.062)   \\
> Weight (lbs.)       &               &               &      -0.002** &
>              &               &      -0.003** \\
>                     &               &               &     (0.001)   &
>              &               &     (0.001)   \\
> Length (in.)        &               &               &      -0.003   &
>              &               &      -0.008   \\
>                     &               &               &     (0.034)   &
>              &               &     (0.037)   \\
> lambda              &               &               &               &
>   3886.502***&               &               \\
>                     &               &               &               &
> (1485.568)   &               &               \\
> Constant            &   11253.061***&    9691.184***&       8.537** &
>              &   11805.390***&      11.720** \\
>                     &  (1170.813)   &  (3454.182)   &     (4.346)   &
>              &  (1921.850)   &     (4.697)   \\
>
> I would like lambda estimate from the mills collumn to be part of the
> price equation for the 2-Step, and for the MLE price column to have
> the lambda, rho and sigma estimates with their std. errors.
>
> *
> *   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/
>
*
*   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/



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