Description Usage Arguments Details References Examples
calc_pppd
returns the partial prior predictive
distribution for a logistic regression.
1 2 |
formula |
A formula for a logistic regression model. |
data |
A data frame. |
prior_sims |
Simulations from the desired prior distribution. |
sep_var_name |
The name of the separating variable. |
treat_one_low |
Treat |
X_pred_list |
A named list of values at which to set variables. The function set_at_median() facilitates creating this list. |
prior_label |
The name of the prior used. |
Researchers can use this function to convert simulations from the prior distribution to simulations from the partial prior predictive distribution See Rainey (2014) for the details.
Rainey, Carlisle. 2014. "Dealing with Separation in Logistic Regression Model." Working paper. Available at http://crain.co/papers/separation.pdf.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # load data from Barrilleaux and Rainey (2014)
data(politics_and_need)
# prior simulations
normal1 <- rnorm(10000, sd = 1)
# formula
f <- oppose_expansion ~ gop_governor + percent_favorable_aca + percent_uninsured
# convert prior simulations of the coefficient to simulations of the
# quantitie of interest
pppd <- calc_pppd(f, data = politics_and_need, prior_sims = normal1,
sep_var_name = "gop_governor", prior_label = "N(0, 1)")
# plot and print summaries of the PPPD
print(pppd)
par(mfrow = c(1, 1))
plot(pppd) # predicted probability is the default
plot(pppd, qi_name = "rr") # risk-ratio
plot(pppd, qi_name = "fd") # first-difference
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.