Description Usage Arguments Value Examples
This function uses stan to allow the user to make a bayesian model from a frequentist one, allowing for easy bayesian conclusions (intervals, estimates, etc.). It will return the bayesian model, and output a couple plots - an estimate of the population's y-value distribution, and confidence intervals for the model parameters. Be aware of shinystan::launch_shinystan for a more interactive environment - use bayes_explore %>% shinystan::launch_shinystan
1 2 | bayes_explore(model, show_intercept = T, extra_plots = F, chains = 4,
chain_length = 1000)
|
model |
a model, in lm or glm format |
show_intercept |
boolean. Toggles if the intercept is included in plots |
extra_plots |
boolean. Toggles trace and hex plots, if applicable (hex plot needs only two parameters) |
chains |
number of markov chains to calculate. Lower numbers trade accuracy for speed |
chain_length |
length of calculated markov chains. Lower numbers trade accuracy for speed |
a model and a series of plots
This plot shows the estimated values of the dependent (y) variable in the population at large
This shows confidence intervals for each of the model's coefficients. These distributions can be used to make proper bayesian predictions - e.g. we are 80% confident that the true value of β_i is in this interval - as opposed to frequentist ones which use the calculated value and uncertainty to a null hypothesis' probabilty of error.
1 2 3 4 | bayes_explore(lm(mpg~., mtcars))
bayes_explore(lm(stack.loss~., stackloss), show_intercept=FALSE)
bayes_explore(lm(Fertility~0+., swiss))
bayes_explore(glm(am~0+mpg+wt, mtcars, family=binomial(link='logit')), extra_plots=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.