Refit Bayesian model as frequentist. Can be useful for comparisons.

convert_bayesian_as_frequentist(model, data = NULL)

bayesian_as_frequentist(model, data = NULL)

Arguments

model

A Bayesian model.

data

Data used by the model. If NULL, will try to extract it from the model.

Examples

# \donttest{ # Rstanarm ---------------------- if (require("rstanarm")) { # Simple regressions model <- stan_glm(Sepal.Length ~ Species, data = iris, chains = 2, refresh = 0 ) bayesian_as_frequentist(model) }
#> Loading required package: rstanarm
#> Loading required package: Rcpp
#> This is rstanarm version 2.21.1
#> - See https://mc-stan.org/rstanarm/articles/priors for changes to default priors!
#> - Default priors may change, so it's safest to specify priors, even if equivalent to the defaults.
#> - For execution on a local, multicore CPU with excess RAM we recommend calling
#> options(mc.cores = parallel::detectCores())
#> #> Call: #> stats::lm(formula = formula, data = data) #> #> Coefficients: #> (Intercept) Speciesversicolor Speciesvirginica #> 5.006 0.930 1.582 #>
# } if (FALSE) { if (require("rstanarm")) { model <- stan_glm(vs ~ mpg, family = "binomial", data = mtcars, chains = 2, refresh = 0 ) bayesian_as_frequentist(model) # Mixed models model <- stan_glmer(Sepal.Length ~ Petal.Length + (1 | Species), data = iris, chains = 2, refresh = 0 ) bayesian_as_frequentist(model) model <- stan_glmer(vs ~ mpg + (1 | cyl), family = "binomial", data = mtcars, chains = 2, refresh = 0 ) bayesian_as_frequentist(model) } }