BIC.gkwfit {gkwreg} | R Documentation |
Calculate Bayesian Information Criterion (BIC) for gkwfit Objects
Description
Computes the Bayesian Information Criterion (BIC), sometimes called the
Schwarz criterion (SIC), for one or more fitted model objects of class "gkwfit"
.
Usage
## S3 method for class 'gkwfit'
BIC(object, ...)
Arguments
object |
An object of class |
... |
Optionally, more fitted model objects of class |
Details
This function calculates the BIC based on the formula
-2 \times \log Likelihood + \log(n) \times df
, where n
is the number
of observations and df
represents the number of estimated parameters in the
model (degrees of freedom).
It relies on the logLik.gkwfit
method to extract the log-likelihood,
the degrees of freedom (df
), and the number of observations (nobs
)
for each model. Ensure that logLik.gkwfit
is defined and returns a valid
"logLik"
object with appropriate attributes.
When comparing multiple models fitted to the same data, the model with the lower BIC value is generally preferred, as BIC tends to penalize model complexity more heavily than AIC for larger sample sizes. The function returns a sorted data frame to facilitate this comparison when multiple objects are provided. A warning is issued if models were fitted to different numbers of observations.
Value
If only one
object
is provided: A single numeric value, the calculated BIC.If multiple objects are provided: A
data.frame
with rows corresponding to the models and columns for the degrees of freedom (df
) and the calculated BIC value (namedBIC
). The data frame is sorted in ascending order based on the BIC values. Row names are generated from the deparsed calls or the names of the arguments passed to BIC.
Author(s)
Lopes, J. E. (with refinements)
See Also
gkwfit
, BIC
, logLik.gkwfit
, AIC.gkwfit
Examples
set.seed(2203)
y <- rkw(1000, alpha = 2.5, beta = 1.5)
# Fit different models to the same data
fit1_kw <- gkwfit(y, family = "kw", silent = TRUE)
fit2_bkw <- gkwfit(y, family = "bkw", silent = TRUE)
fit3_gkw <- gkwfit(y, family = "gkw", silent = TRUE)
# Calculate BIC for a single model
bic1 <- BIC(fit1_kw)
print(bic1)
# Compare BIC values for multiple models
bic_comparison <- c(BIC(fit1_kw), BIC(fit2_bkw), BIC(fit3_gkw))
print(bic_comparison)