plot_mcc {ctsfeatures}R Documentation

Constructs a control chart for the marginal distribution of a categorical series

Description

plot_mcc constructs a control chart for the marginal distribution of a categorical series

Usage

plot_mcc(
  series,
  c,
  sigma,
  lambda = 0.99,
  k = 3.3,
  min_max = FALSE,
  plot = TRUE,
  title = "Control chart (marginal)",
  ...
)

Arguments

series

An object of type tsibble (see R package tsibble), whose column named Value contains the values of the corresponding CTS. This column must be of class factor and its levels must be determined by the range of the CTS.

c

The hypothetical marginal distribution.

sigma

A matrix containing the variances for each category (columns) and each time t (rows).

lambda

The constant lambda to construct the EWMA estimator.

k

The constant k to construct the k sigma limits.

min_max

Logical. If min_max = FALSE (default), the standard control chart for the marginal distribution is plotted. Otherwise, the reduced control chart is plotted, i.e., only the minimum and maximum values of the standardized statistics (with respect to the set of categories) are considered.

plot

Logical. If plot = TRUE (default), returns the control chart. Otherwise, returns the standardized statistics or their maximum and minimum value for each time t.

title

The title of the graph.

...

Additional parameters for the function.

Details

Constructs a control chart of a CTS with range \mathcal{V}=\{1, \ldots, r\} based on the marginal distribution. The chart relies on the standardized statistic T_{t, i}=\frac{\hat{\pi}_{t, i}^{(\lambda)}-p_i}{k \cdot \sigma_{t, i}}, where the \hat{\pi}_{t, i}^{(\lambda)}, i=1,\ldots,r, are the components of the EWMA estimator of the marginal distribution, p_i is the marginal probability of category i, \sigma_{t,i} is the variance of \hat{\pi}_{t, i}^{(\lambda)} and k is a constant set by the user. If min_max = FALSE, then only the statistics T_t^{\min }=\min_{i \in \mathcal{V}} T_{t, i} and T_t^{\max }=\max_{i \in \mathcal{V}} T_{t, i} are plotted. An out-of-control alarm is signalled if the statistics are below -1 or above 1.

Value

If plot = TRUE (default), represents the control chart for the marginal distribution. Otherwise, the function returns a matrix with the values of the standardized statistics for each time t

Author(s)

Ángel López-Oriona, José A. Vilar

References

Weiß CH (2008). “Visual analysis of categorical time series.” Statistical Methodology, 5(1), 56–71.

Examples

sequence_1 <- SyntheticData1[which(SyntheticData1$Series==1),]
cycle_cc <- plot_ccc(series = sequence_1, mu_t = c(1, 1.5, 1),
lcl_t = rep(10, 600), ucl_t = rep(10, 600))
cycle_md <- plot_mcc(series = sequence_1, c = c(0.3, 0.3, 0.4),
sigma = matrix(rep(c(1, 1, 1), 600), nrow = 600)) # Representing
# a control chart for the marginal distribution
cycle_md <- plot_mcc(series = sequence_1, c = c(0.3, 0.3, 0.4),
sigma = matrix(rep(c(1, 1, 1), 600), nrow = 600), plot = FALSE) # Computing the
# corresponding standardized statistic

[Package ctsfeatures version 1.2.2 Index]