control_charts_sof_pc | R Documentation |
This function builds a data frame needed to plot control charts for monitoring a monitoring a scalar quality characteristic adjusted for the effect of multivariate functional covariates based on scalar-on-function regression, as proposed in Capezza et al. (2020).
In particular, this function provides:
the Hotelling's T2 control chart,
the squared prediction error (SPE) control chart,
the scalar regression control chart.
This function calls control_charts_pca
for the control charts on
the multivariate functional covariates and regr_cc_sof
for the scalar regression control chart.
The training data have already been used to fit the model. An optional tuning data set can be provided that is used to estimate the control chart limits. A phase II data set contains the observations to be monitored with the control charts.
control_charts_sof_pc(
mod,
y_test,
mfdobj_x_test,
mfdobj_x_tuning = NULL,
alpha = list(T2 = 0.0125, spe = 0.0125, y = 0.025),
limits = "standard",
seed,
nfold = NULL,
ncores = 1
)
mod |
A list obtained as output from |
y_test |
A numeric vector containing the observations of the scalar response variable in the phase II data set. |
mfdobj_x_test |
An object of class |
mfdobj_x_tuning |
An object of class |
alpha |
A named list with three elements, named |
limits |
A character value.
If "standard", it estimates the control limits on the tuning
data set. If "cv", the function calculates the control limits only on the
training data using cross-validation
using |
seed |
If |
nfold |
If |
ncores |
If |
A data.frame
with as many rows as the number of
multivariate functional observations in the phase II data set and
the following columns:
one id
column identifying the multivariate functional observation
in the phase II data set,
one T2
column containing the Hotelling T2 statistic calculated
for all observations,
one column per each functional variable, containing its contribution to the T2 statistic,
one spe
column containing the SPE statistic calculated
for all observations,
one column per each functional variable, containing its contribution to the SPE statistic,
T2_lim
gives the upper control limit of the
Hotelling's T2 control chart,
one contribution_T2_*_lim
column per each
functional variable giving the
limits of the contribution of that variable to the
Hotelling's T2 statistic,
spe_lim
gives the upper control limit of the SPE control chart
one contribution_spe*_lim
column per
each functional variable giving the
limits of the contribution of that variable to the SPE statistic.
y_hat
: the predictions of the response variable
corresponding to mfdobj_x_new
,
y
: the same as the argument y_new
given as input to this function,
lwr
: lower limit of the 1-alpha
prediction interval on the response,
pred_err
: prediction error calculated as y-y_hat
,
pred_err_sup
: upper limit of the 1-alpha
prediction interval on the prediction error,
pred_err_inf
: lower limit of the 1-alpha
prediction interval on the prediction error.
C. Capezza
control_charts_pca
, regr_cc_sof
## Not run:
#' library(funcharts)
data("air")
air <- lapply(air, function(x) x[201:300, , drop = FALSE])
fun_covariates <- c("CO", "temperature")
mfdobj_x <- get_mfd_list(air[fun_covariates],
n_basis = 15,
lambda = 1e-2)
y <- rowMeans(air$NO2)
y1 <- y[1:60]
y2 <- y[91:100]
mfdobj_x1 <- mfdobj_x[1:60]
mfdobj_x_tuning <- mfdobj_x[61:90]
mfdobj_x2 <- mfdobj_x[91:100]
mod <- sof_pc(y1, mfdobj_x1)
cclist <- control_charts_sof_pc(mod = mod,
y_test = y2,
mfdobj_x_test = mfdobj_x2,
mfdobj_x_tuning = mfdobj_x_tuning)
plot_control_charts(cclist)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.