Skip to contents

Calculates the Bayesian information criterion

Usage

calc_bic(loglik, data, df = 2)

Arguments

loglik

A vector or single number the loglikelihood of the model

data

A vector or data frame containing data that is required by the function specified in func argument.

df

A numeric specifying the degrees of freedom for the model in order to calculate the Akaike information criterion. Default is 2.

Value

A single or vector of numerics equal to the input vector length

Examples

# example using vector
data <- c(2, 13, 22, 25, 11, 12, 11, 23, 13, 24)
calc_bic(loglik = -110, data = data)
#> [1] 224.6052

# example using tabular data
data <- data.frame(
  c(2, 13, 22, 25, 11, 12, 11, 23, 13, 24),
  c(4, 15, 19, 1, 16, 10, 3, 17, 16, 3)
)
calc_bic(loglik = -110, data = data)
#> [1] 224.6052