convert_bayesian_as_frequentist: Convert (refit) a Bayesian model to frequentist

Description Usage Arguments Examples

View source: R/convert_bayesian_to_frequentist.R

Description

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

Usage

1
2
3

Arguments

model

A Bayesian model.

data

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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)

DominiqueMakowski/bayestestR documentation built on July 27, 2021, 4:12 p.m.