Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Producing Regression Table from bayesmh Using esttab

    Dear Statalist members,

    I would like to know how to produce a publishable regression table from bayesmh command. For example, I can easily produce a regression table from simple regress command like:


    sysuse auto
    foreach var of varlist mpg weight trunk length {
    2. eststo: qui reg price `var'
    3. }
    (est1 stored)
    (est2 stored)
    (est3 stored)
    (est4 stored)

    . esttab, b(%9.3f) se(%7.3f) eqlabel(none) ar2 label

    ------------------------------------------------------------------------------------
    (1) (2) (3) (4)
    Price Price Price Price
    ------------------------------------------------------------------------------------
    Mileage (mpg) -238.894***
    (53.077)

    Weight (lbs.) 2.044***
    (0.377)

    Trunk space (.. ft.) 216.748**
    (77.146)

    Length (in.) 57.202***
    (14.080)

    Constant 11253.061*** -6.707 3183.504** -4584.899
    (1170.813) (1174.430) (1110.728) (2664.437)
    ------------------------------------------------------------------------------------
    Observations 74 74 74 74
    Adjusted R-squared 0.209 0.280 0.086 0.175
    ------------------------------------------------------------------------------------
    Standard errors in parentheses
    * p<0.05, ** p<0.01, *** p<0.001

    .
    end of do-file

    .
    But, I cannot do it after I run bayesmh command.


    foreach v of varlist mpg weight trunk length {
    2. eststo: qui bayesmh price `v', likelihood(normal({var})) prior({price: _cons `v'}, flat) prior({var}, jeffrey) saving(`v'model)
    3. }
    file mpgmodel.dta could not be opened
    r(603);


    Do you have any idea of how to produce a regression table from bayesmh command? Thank you



    Best regards,


    Afri
    Last edited by afri afrimadona; 24 Jul 2017, 23:20.

  • #2
    Welcome to the Stata Forum/Statalist,

    I believe that is not possible.

    Besides, the SSC - esttab/estout - help files did not mention Bayesian analysis.

    I cannot tell for sure about - bayesmh - (you may "save" results before using - estimates store, but not exactly the "regular" ones we see in the "frequentist" regression table). However, with - bayes - I gather the reason is the (quite different) items stored after the estimation.

    By the way, even - estimates store - won't provide - estimates table - for that matter:


    Code:
    . bayes: reg price mpg
      
    Burn-in ...
    Simulation ...
    
    Model summary
    ------------------------------------------------------------------------------
    Likelihood:
      price ~ regress(xb_price,{sigma2})
    
    Priors:
      {price:mpg _cons} ~ normal(0,10000)                                      (1)
               {sigma2} ~ igamma(.01,.01)
    ------------------------------------------------------------------------------
    (1) Parameters are elements of the linear form xb_price.
    
    Bayesian linear regression                       MCMC iterations  =     12,500
    Random-walk Metropolis-Hastings sampling         Burn-in          =      2,500
                                                     MCMC sample size =     10,000
                                                     Number of obs    =         74
                                                     Acceptance rate  =      .4133
                                                     Efficiency:  min =      .1063
                                                                  avg =      .1177
    Log marginal likelihood = -727.25184                          max =      .1335
     
    ------------------------------------------------------------------------------
                 |                                                Equal-tailed
                 |      Mean   Std. Dev.     MCSE     Median  [95% Cred. Interval]
    -------------+----------------------------------------------------------------
    price        |
             mpg |  241.2524   21.16202    .62844   241.4937   198.4834   281.2732
           _cons |  49.63901   98.56165   3.02362   46.12188  -136.9005    248.258
    -------------+----------------------------------------------------------------
          sigma2 |  1.58e+07    2723835   74553.2   1.55e+07   1.13e+07   2.20e+07
    ------------------------------------------------------------------------------
    Note: Default priors are used for model parameters.
    Note: Adaptation tolerance is not met in at least one of the blocks.
    
    . estimates store mymodel
    
    . estimates table mymodel
    mymodel estimation results do not have e(b) and e(V)
    r(321);
    It seems the reason is stated in the last sentence.
    Last edited by Marcos Almeida; 25 Jul 2017, 08:57.
    Best regards,

    Marcos

    Comment


    • #3
      I just wish to add an extra comment: it seems the user-written - estout - was updated in 2014, hence, if I'm not wrong, the year before the release of Stata 14, when - bayesmh - was launched.
      Best regards,

      Marcos

      Comment


      • #4
        Thank you, Marcos. Yes, it seems that esttab does not anticipate this. In bayesmh, we use mcmc mean, mcmc SE, and so on rather than e(b) or e(V). I just wonder if there is a code that transfer them to esttab (or outreg maybe) or any way to transfer them into a standard regression table automatically.

        Comment

        Working...
        X