Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

convert_bayesian_as_frequentist

Convert (refit) a Bayesian model to frequentist


Description

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

Usage

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

# Rstanarm ----------------------
if (require("rstanarm")) {
  # Simple regressions
  model <- stan_glm(Sepal.Length ~ Species,
    data = iris, chains = 2, refresh = 0
  )
  bayesian_as_frequentist(model)
}


## Not run: 
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)
}

## End(Not run)

bayestestR

Understand and Describe Bayesian Models and Posterior Distributions

v0.10.0
GPL-3
Authors
Dominique Makowski [aut, cre] (<https://orcid.org/0000-0001-5375-9967>, @Dom_Makowski), Daniel Lüdecke [aut] (<https://orcid.org/0000-0002-8895-3206>, @strengejacke), Mattan S. Ben-Shachar [aut] (<https://orcid.org/0000-0002-4287-4801>, @mattansb), Indrajeet Patil [aut] (<https://orcid.org/0000-0003-1995-6531>, @patilindrajeets), Michael D. Wilson [aut] (<https://orcid.org/0000-0003-4143-7308>), Paul-Christian Bürkner [rev], Tristan Mahr [rev] (<https://orcid.org/0000-0002-8890-5116>), Henrik Singmann [ctb] (<https://orcid.org/0000-0002-4842-3657>), Quentin F. Gronau [ctb] (<https://orcid.org/0000-0001-5510-6943>), Sam Crawley [ctb] (<https://orcid.org/0000-0002-7847-0411>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.