aic {rseg} | R Documentation |
Functions to aggregate the last segments in a rseg
object in order to optimize the AIC or BIC.
aic(x, criterion = c("AIC", "BIC")[1], family = c("gaussian", "binomial", "censored")[1]) bic(x, family = c("gaussian", "binomial", "censored")[1])
x |
an object of class |
criterion |
type of information criterion used. Accepted values are |
family |
a description of the error distribution/scale of the outcome. Accepted values are |
Depending on the value of the family
argument, the AIC and BIC are extracted from a generalized linear model with identity link function (= "gaussian"
), logit link function (= "binomial"
) or a Cox proportional hazards regression model (= "censored"
). The segmentation provided by x
is used as factor variable in these models.
An object of class rseg
.
airq <- subset(airquality, !is.na(Ozone)) irisseg <- cseg(Ozone ~ ., minsplit = 10L, minbucket = 3L, data = airq) irisseg ## The AIC does not suggest aggregation of segments aic(irisseg, family = 'gaussian') ## The stricter BIC suggests aggregation of segments aic(irisseg, criterion = 'BIC', family = 'gaussian') ## This is equivalent to bic(irisseg, family = 'gaussian')