Description Usage Arguments Details Value Examples
View source: R/pretty_bayesian_output.R
pretty_bayesian_regression_tests takes a stanreg fit object ( family = binomial or guassian), and conducts tests
1 | pretty_bayesian_regression_tests(fit, model_data)
|
fit |
stanreg (currently only tested on linear model and logistic stan_glm fit) |
model_data |
data.frame or tibble used to create model fits. Used for capturing variable labels, if they exist |
Model type is determined by fit
class, and also family if. If family is binomial,
then the output is designed for a Logistic model (i.e. Odd Ratios), otherwise the output is designed for a linear model.
A tibble with: Mean Est/OR/HR(CI)
,
pd
(probabiity of direction),
ROPE (CI)
(R.O.P.E and CI),
2.5
(R.O.P.E.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Basic linear model example
set.seed(542542522)
ybin <- sample(0:1, 100, replace = TRUE)
y <- rexp(100,.1)
x1 <- rnorm(100)
x2 <- y + rnorm(100)
x3 <- factor(sample(letters[1:4],100,replace = TRUE))
my_data <- data.frame(y, ybin, x1, x2, x3)
library(rstanarm)
lm_fit <- stan_glm(y ~ x1+ x2 + x3, data = my_data )
pretty_bayesian_regression_tests(fit = lm_fit, model_data = my_data)
library(dplyr)
# Logistic Regression
my_fit <- stan_glm(ybin ~ x1 + x2 + x3, data = my_data, family = binomial)
my_pretty_model_output_tests <-pretty_bayesian_regression_tests(fit = my_fit, model_data = my_data)
# Printing of Fancy table in HTML
kableExtra::kable(my_pretty_model_output_tests, 'html', caption = 'My Table') %>%
kableExtra::collapse_rows(c(1:2), row_group_label_position = 'stack')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.