Learn R Programming

funcharts (version 1.8.0)

simulate_data_RoMFCC: Simulate multivariate functional data with casewise and componentwise contamination

Description

Generate multivariate functional data under different contamination models (casewise, componentwise, or both) for use in simulation studies of the Robust Multivariate Functional Control Chart (RoMFCC) as described in Capezza, Centofanti, Lepore, and Palumbo (2024).

Usage

simulate_data_RoMFCC(
  nobs = 1000,
  p = 3,
  p_cellwise = 0,
  p_casewise = 0,
  sd_e = 0.005,
  sd = 0.002,
  T_exp = 0.6,
  outlier = "no",
  M_outlier_case = 0,
  M_outlier_cell = 0,
  OC = "no",
  M_OC = 0,
  P = 100,
  max_n_cellwise = Inf,
  correlation = "decreasing",
  k = 1,
  which_OC = 5
)

Value

A list with two elements:

X_mat_list

A list of length p, each element a matrix of dimension nobs × P with the simulated functional observations.

ind_out

A list of length p, each element containing the indices of observations contaminated in that component.

Capezza, C., Centofanti, F., Lepore, A., Palumbo, B. (2024) Robust Multivariate Functional Control Chart. Technometrics, 66(4):531--547, doi:10.1080/00401706.2024.2327346.

Arguments

nobs

Integer. Number of observations to simulate (default 1000).

p

Integer. Number of functional components (variables) (default 3).

p_cellwise

Numeric in \([0,1]\). Probability of cellwise contamination (componentwise outliers) for each component (default 0).

p_casewise

Numeric in \([0,1]\). Probability of casewise contamination (entire observation contaminated) (default 0).

sd_e

Numeric. Standard deviation of the additive measurement noise (default 0.005).

sd

Numeric. Standard deviation scaling of the functional part (default 0.002).

T_exp

Numeric in \((0,1)\). Expansion parameter for phase outliers (default 0.6).

outlier

Character. Type of contamination in Phase I sample: "no" (no contamination), "outlier_M" (mean shift), "outlier_E" (exponential shift), "outlier_P" (phase shift). Default "no".

M_outlier_case

Numeric. Magnitude of casewise outlier contamination (default 0).

M_outlier_cell

Numeric. Magnitude of cellwise outlier contamination (default 0).

OC

Character. Out-of-control model in Phase II data: "no" (in control), "OC_M" (mean shift), "OC_E" (exponential shift), "OC_P" (phase shift). Default "no".

M_OC

Numeric. Magnitude of out-of-control shift (default 0).

P

Integer. Number of grid points in each functional profile (default 100).

max_n_cellwise

Integer. Maximum number of components per observation allowed to be cellwise contaminated (default Inf).

correlation

Character. Correlation structure among components: typically "decreasing" (default).

k

Integer. Correlation parameter (default 1).

which_OC

Integer vector. Indices of components subject to out-of-control shifts in Phase II (default 5).

Details

The generated data mimic dynamic resistance curves (DRCs) in resistance spot welding processes and allow for controlled introduction of casewise and/or componentwise outliers, as in the Monte Carlo study presented in the RoMFCC paper.

The function generates nobs realizations of a p-variate functional quality characteristic observed on an equally spaced grid of size P. The underlying process is simulated through a Karhunen–Loève expansion with eigenfunctions and eigenvalues derived from a specified correlation structure. Outliers can be introduced at cellwise level (single components), casewise level (entire observation), or both, using probability parameters p_cellwise and p_casewise and magnitudes M_outlier_cell, M_outlier_case. Out-of-control shifts in Phase II can be introduced via the OC argument.

This setup mirrors the simulation design in Section 4 of Capezza et al. (2024) where RoMFCC was benchmarked against competing control charts under various contamination scenarios.

Examples

Run this code
# \donttest{
# Simulate uncontaminated data (Phase I)
sim <- simulate_data_RoMFCC(nobs = 200, p = 3, outlier = "no", OC = "no")
str(sim$X_mat_list)

# Simulate with componentwise outliers in Phase I
sim2 <- simulate_data_RoMFCC(nobs = 200, p = 3,
                             p_cellwise = 0.05, M_outlier_cell = 0.03,
                             outlier = "outlier_E")

# Simulate Phase II with a mean shift in one component
sim3 <- simulate_data_RoMFCC(nobs = 200, p = 3,
                             OC = "OC_M", M_OC = 0.04, which_OC = 2)
# }

Run the code above in your browser using DataLab