-------------
       log:  /Volumes/fmwww0/cfb/stata/levpredict.smcl
  log type:  smcl
 opened on:   4 Feb 2009, 10:53:15

. // dataset from MUS ch3
. use http://fmwww.bc.edu/cfb/stata/mus03data, clear

.
. su totexp ltotexp if totexp > 0, detail

                  Total medical expenditure
-------------------------------------------------------------
      Percentiles      Smallest
 1%           81              3
 5%          300              6
10%          581              9       Obs                2955
25%         1433             14       Sum of Wgt.        2955

50%         3334                      Mean           7290.235
                        Largest       Std. Dev.      11990.84
75%         7497         104823
90%        17549         108256       Variance       1.44e+08
95%        27941         123611       Skewness       4.113807
99%        62989         125610       Kurtosis       25.64123

                  ln(totexp) if totexp > 0
-------------------------------------------------------------
      Percentiles      Smallest
 1%     4.394449       1.098612
 5%     5.703783       1.791759
10%     6.364751       2.197225       Obs                2955
25%     7.267525       2.639057       Sum of Wgt.        2955

50%     8.111928                      Mean           8.059866
                        Largest       Std. Dev.      1.367592
75%     8.922258       11.56003
90%     9.772752       11.59225       Variance       1.870308
95%     10.23785       11.72489       Skewness      -.3857887
99%     11.05072       11.74094       Kurtosis       3.842263

.
. reg ltotexp suppins phylim actlim totchr age female income

      Source |       SS       df       MS              Number of obs =    2955
-------------+------------------------------           F(  7,  2947) =  124.98
       Model |  1264.72124     7  180.674463           Prob > F      =  0.0000
    Residual |  4260.16814  2947  1.44559489           R-squared     =  0.2289
-------------+------------------------------           Adj R-squared =  0.2271
       Total |  5524.88938  2954  1.87030785           Root MSE      =  1.2023

-------------+----------------------------------------------------------------
     ltotexp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     suppins |   .2556428   .0462264     5.53   0.000     .1650034    .3462821
      phylim |   .3020598   .0569709     5.30   0.000      .190353    .4137666
      actlim |   .3560054   .0621118     5.73   0.000     .2342185    .4777923
      totchr |   .3758201   .0184227    20.40   0.000     .3396974    .4119429
         age |   .0038016   .0036561     1.04   0.299    -.0033672    .0109705
      female |  -.0843275   .0455442    -1.85   0.064    -.1736292    .0049741
      income |   .0025498   .0010194     2.50   0.012      .000551    .0045486
       _cons |   6.703737     .27676    24.22   0.000     6.161075      7.2464
-------------+----------------------------------------------------------------

.
. levpredict tenorm, print

Prediction of exp(ltotexp) from command: regress created as variable: tenorm

Mean level prediction ignoring E[exp(U_i)] = 4004.4529

Bias in mean level prediction: -4245.4746

. levpredict teduan, duan print

Prediction of exp(ltotexp) from command: regress created as variable: teduan
using method of Duan, assuming i.i.d. errors

Mean level prediction ignoring E[exp(U_i)] = 4004.4529

Bias in mean level prediction: -4001.0692

.
. su totexp ltotexp tenorm teduan if totexp > 0

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      totexp |      2955    7290.235    11990.84          3     125610
     ltotexp |      2955    8.059866    1.367592   1.098612   11.74094
      tenorm |      2955    8249.928    6805.945   1976.955   77723.15
      teduan |      2955    8005.522    6604.318   1918.388   75420.59

.
. // qui reg totexp suppins phylim actlim totchr age female income
. // levpredict testerr
.
. log close
       log:  /Volumes/fmwww0/cfb/stata/levpredict.smcl
  log type:  smcl
 closed on:   4 Feb 2009, 10:53:19
-------------