ASA Connect

 View Only
  • 1.  Bayesian logistic regression

    Posted 08-28-2019 17:25
    Dear all, greetings from Nigeria. Please I ran a bayesian logistic regression in R using rstanarm package. part of the output is shown bellow

     

    Estimates:

                    mean   sd     2.5%   25%    50%    75%    97.5%

    (Intercept)      1.6    1.2   -0.8    0.8    1.6    2.4    3.9

    x1              -0.1    0.0   -0.2   -0.1   -0.1   -0.1   -0.1

    x2               0.1    0.0    0.0    0.0    0.1    0.1    0.1

    x3               0.0    0.0   -0.1    0.0    0.0    0.0    0.1

    x4               0.0    0.0    0.0    0.0    0.0    0.0    0.0

    x51              1.4    0.6    0.3    1.0    1.4    1.8    2.6

    x61              2.1    0.5    1.0    1.7    2.1    2.4    3.2

    x7               0.0    0.0   -0.1    0.0    0.0    0.0    0.0

    x81             -0.1    0.5   -1.0   -0.4   -0.1    0.2    0.8

    x91              2.1    0.6    0.9    1.7    2.1    2.5    3.3

    mean_PPD         0.3    0.0    0.2    0.3    0.3    0.3    0.3

    log-posterior -186.6    2.2 -191.8 -187.8 -186.2 -185.0 -183.2

     

     

     

    Diagnostics:

                  mcse Rhat n_eff

    (Intercept)   0.0  1.0  4669

    x1            0.0  1.0  4375

    x2            0.0  1.0  5875

    x3            0.0  1.0  5486

    x4            0.0  1.0  5480

    x51           0.0  1.0  4626

    x61           0.0  1.0  4777

    x7            0.0  1.0  5850

    x81           0.0  1.0  5149

    x91           0.0  1.0  4629

    mean_PPD      0.0  1.0  4405

    log-posterior 0.1  1.0  1650

     

    For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).

    >

    > coefficients

    (Intercept)          x1          x2          x3          x4         x51

          1.569      -0.116       0.057       0.001       0.000       1.402

            x61          x7         x81         x91

          2.075      -0.022      -0.124       2.113.

    My challange here firstly is  understanding and interpreting the output above. (is it the same as in logistics regression ). Secondly, is there anything like bayesian forecast? if yes, how can it be applied here and lastly, how is bayesian logistics different from logistic models.
    Hope to see responses from you soon.
    Best,



    ------------------------------
    Ikenna Nnabue
    Research Officer
    National Root Crops Research Institute.
    ------------------------------


  • 2.  RE: Bayesian logistic regression

    Posted 08-29-2019 10:31
    Hello.  I was about to create a small example and use that to respond, but it has been done already, and much better than I could do it!  Please see the logistic regression example at the URL below, and note especially the "posterior_predict" function, which you can use to generate a distribution of outcomes useful for prediction.  In general, Bayesian models allow you to use the posterior predictive distribution for prediction.  It integrates all the possible parameter values of the model, weighted by the probability of the different values, to generate a distribution of outcome values.

    http://mc-stan.org/rstanarm/articles/rstanarm.html

    The ASA forums are great for general statistician-life questions and specific ASA questions, but for individual tools, it's sometimes helpful to go to a forum where there are more experts in that particular tool.  The mc-stan.org site has information about Stan forums where you can get Stan-specific answers, and the people there are pretty friendly.

    Good luck!

    ------------------------------
    Edward Cashin
    Research Scientist II
    ------------------------------



  • 3.  RE: Bayesian logistic regression

    Posted 08-29-2019 11:20
    Edward,

    Great suggestion!  I may just change my frequentist spots and become a Bayesian!  Thank you.

    Ikenna,

    My questions are: 1) how was this model obtained initially and what criteria were used to decide to include or drop alternative factors?  2) I am assuming the independent variable symbolism you use is x with a single subscript for main effects and x with a double subscript for two-factor interactions.  Is this correct?  3) Is the data which supports this initial model the result of a statistically designed experiment or an observational study?  4) Were the x's centered by subtracting the mean before cross-multiplying to form interactions prior to the process which arrived at the initial model above? 5) What specific procedure was used to obtain the initial model and parameter estimates?  6) Did you try a conventional ( frequentist ) logistic regression for comparison?  If so, what happened?

    Tom

    Thomas D. Sandry, PhD
    Industrial Statistical Consultant, Retired

    ------------------------------
    Thomas Sandry
    ------------------------------