| mixAR_BIC {mixAR} | R Documentation |
BIC based model selection for MixAR models
Description
BIC calculations for mixture autoregressive models.
Usage
mixAR_BIC(y, model, fix = NULL, comp_loglik = TRUE, index)
BIC_comp(x, y)
Arguments
y |
a time series. |
model |
the model for which to calculate BIC, an object inheriting from
class |
fix |
If |
comp_loglik |
Should the loglikelihood be calculated? Default is
|
index |
Discard the first |
x |
a list containing a combination of |
Details
mixAR_BIC calculates the BIC criterion of a given MixAR
object with respect to a specified time series.
If index is specified, it has to be at least equal to the
largest autoregressive order. The function calculates BIC on the last
(index + 1):n data points.
BIC_comp calculates the value of BIC for the models listed in
x with respect to the specified time series y.
If the distributions of the components contain estimated parameters, then their number is included in the number of parameters for the calculation of BIC.
Value
If comp_loglik = TRUE, the function calculates BIC based on the
given model, data and index.
If comp_loglik = FALSE and model is output from
fit_mixAR, it returns object vallogf from that list.
Author(s)
Davide Ravagli
Examples
model1 <- new("MixARGaussian", prob = c(0.5, 0.5), scale = c(1, 2),
arcoef = list(-0.5, 1.1))
model2 <- new("MixARGaussian", prob = c(0.5, 0.3, 0.2), scale = c(1, 3, 8),
arcoef = list(c(-0.5, 0.5), 1, 0.4))
set.seed(123)
y <- mixAR_sim(model1, 400, c(0, 0, 0), nskip = 100)
mixAR_BIC(y, model1)
model_fit1 <- fit_mixAR(y, model1)
model_fit2 <- fit_mixAR(y, model2, crit = 1e-4)
mixAR_BIC(y, model_fit1)
mixAR_BIC(y, model_fit2)
BIC_comp(list(model1, model2, model_fit1, model_fit2), y)
mixAR_BIC(y, model_fit1, index = 20)
mixAR_BIC(y, model_fit2, index = 20)