| plot.tune_vlmc {mixvlmc} | R Documentation |
Plot the results of automatic (CO)VLMC complexity selection
Description
This function plots the results of tune_vlmc() or tune_covlmc().
Usage
## S3 method for class 'tune_vlmc'
plot(
x,
value = c("criterion", "likelihood"),
cutoff = c("quantile", "native"),
...
)
## S3 method for class 'tune_covlmc'
plot(
x,
value = c("criterion", "likelihood"),
cutoff = c("quantile", "native"),
...
)
Arguments
x |
a |
value |
the criterion to plot (default "criterion"). |
cutoff |
the scale used for the cut off criterion (default "quantile") |
... |
additional parameters passed to |
Details
The standard plot consists in showing the evolution of the criterion
used to select the model (AIC() or BIC()) as a function of the
cut off criterion expressed in the quantile scale (the quantile is used
by default to offer a common default behaviour between vlmc() and
covlmc()). Parameters can be used to display instead the loglikelihood()
of the model (by setting value="likelihood") and to use the native
scale for the cut off when available (by setting cutoff="native").
Value
the tune_vlmc object invisibly
Customisation
The function sets several default before calling base::plot(), namely:
-
type: "l" by default to use a line representation; -
xlab: "Cut off (quantile scale)" by default, adapted to the actual scale; -
ylab: the name of the criterion or "Log likelihood".
These parameters can be overridden by specifying other values when calling
the function. All parameters specified in addition to x, value and
cutoff are passed to base::plot().
Examples
dts <- sample(as.factor(c("A", "B", "C")), 100, replace = TRUE)
tune_result <- tune_vlmc(dts)
## default plot
plot(tune_result)
## likelihood
plot(tune_result, value = "likelihood")
## parameters overriding
plot(tune_result,
value = "likelihood",
xlab = "Cut off", type = "b"
)
pc <- powerconsumption[powerconsumption$week %in% 10:12, ]
dts <- cut(pc$active_power, breaks = c(0, quantile(pc$active_power, probs = c(0.5, 1))))
dts_cov <- data.frame(day_night = (pc$hour >= 7 & pc$hour <= 17))
dts_best_model_tune <- tune_covlmc(dts, dts_cov, criterion = "AIC")
plot(dts_best_model_tune)
plot(dts_best_model_tune, value = "likelihood")