control_charts_pca | R Documentation |
This function builds a data frame needed to plot the Hotelling's T2 and squared prediction error (SPE) control charts based on multivariate functional principal component analysis (MFPCA) performed on multivariate functional data, as Capezza et al. (2020) for the multivariate functional covariates. The training data have already been used to fit the model. An optional tuning data set can be provided to estimate the control chart limits. A phase II data set contains the observations to be monitored with the control charts.
control_charts_pca(
pca,
components = NULL,
tuning_data = NULL,
newdata,
alpha = 0.05,
limits = "standard",
seed,
nfold = 5,
ncores = 1,
tot_variance_explained = 0.9,
single_min_variance_explained = 0,
absolute_error = FALSE
)
pca |
An object of class |
components |
A vector of integers with the components over which
to project the multivariate functional data.
If this is not NULL, the arguments |
tuning_data |
An object of class |
newdata |
An object of class |
alpha |
If it is a number between 0 and 1,
it defines the overall type-I error probability and the Bonferroni
correction is applied by setting the type-I error probability
in the two control charts equal to |
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 |
tot_variance_explained |
The minimum fraction of variance that has to be explained by the set of multivariate functional principal components retained into the MFPCA model fitted on the functional covariates. Default is 0.9. |
single_min_variance_explained |
The minimum fraction of variance that has to be explained by each multivariate functional principal component such that it is retained into the MFPCA model. Default is 0. |
absolute_error |
If FALSE, the SPE statistic, which monitors the principal components not retained in the MFPCA model, is calculated as the sum of the integrals of the squared prediction error functions, obtained as the difference between the actual functions and their approximation after projection over the selected principal components. If TRUE, the SPE statistic is calculated by replacing the square of the prediction errors with the absolute value, as proposed by Capizzi and Masarotto (2018). Default value is FALSE. |
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.
Capezza C, Lepore A, Menafoglio A, Palumbo B, Vantini S. (2020) Control charts for monitoring ship operating conditions and CO2 emissions based on scalar-on-function regression. Applied Stochastic Models in Business and Industry, 36(3):477–500. doi:10.1002/asmb.2507
Capizzi, G., & Masarotto, G. (2018). Phase I distribution-free analysis with the R package dfphase1. In Frontiers in Statistical Quality Control 12 (pp. 3-19). Springer International Publishing.
regr_cc_fof
library(funcharts)
data("air")
air <- lapply(air, function(x) x[1:220, , 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:100]
y_tuning <- y[101:200]
y2 <- y[201:220]
mfdobj_x1 <- mfdobj_x[1:100]
mfdobj_x_tuning <- mfdobj_x[101:200]
mfdobj_x2 <- mfdobj_x[201:220]
pca <- pca_mfd(mfdobj_x1)
cclist <- control_charts_pca(pca = pca,
tuning_data = mfdobj_x_tuning,
newdata = mfdobj_x2)
plot_control_charts(cclist)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.