cp_BIC {gspcr}R Documentation

Compute bayesian information criterion

Description

Computes bayesian information criterion for comparing competing models.

Usage

cp_BIC(ll, n, k)

Arguments

ll

numeric vector of length 1 (or an object of class 'logLik') storing the log-likelihood of the model of interest

n

numeric vector of length 1 storing the sample size of data used to compute the log-likelihood

k

numeric vector of length 1 storing the number of estimated parameters by the model

Value

numeric vector of length 1 storing the computed BIC.

Author(s)

Edoardo Costantini, 2023

Examples

# Fit some model
lm_out <- lm(mpg ~ cyl + disp, data = mtcars)

# Compute BIC with your function
BIC_M <- cp_BIC(
    ll = logLik(lm_out),
    n = nobs(lm_out),
    k = length(coef(lm_out)) + 1 # intercept + reg coefs + error variance
)

[Package gspcr version 0.9.5 Index]