scout: scout

Description Usage Arguments Value Examples

View source: R/scout.R

Description

Shift of an observation following a selected pattern.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
scout(
  X,
  pcaref,
  T2.y = NA,
  SPE.y = NA,
  nsteps = 1,
  nsteps.spe = 1,
  nsteps.t2 = 1,
  gspe = 1,
  gt2 = 1,
  mode = "simple"
)

Arguments

X

Matrix with observations that will be shifted as rows.

pcaref

List with the elements of a PCA model:

  • m: mean.

  • s: standard deviation.

  • prepro: preprocessing: "none", "cent" or "autosc".

  • P: loading matrix.

  • lambda: vector with variances of each PC.

T2.y

A number indicating the target value for the Hotelling's T^2_A after the shift. Set to NA by default.

SPE.y

A number indicating the target value for the Squared Prediction Error after the shift. Set to NA by default.

nsteps

A number indicating the number of steps between the reference and target values of the SPE and the T^2. Set to 1 by default.

nsteps.spe

An integer indicating the number of steps in which the shift from the reference to the target value of the SPE will be performed. Set to 1 by default.

nsteps.t2

An integer indicating the number of steps in which the shift from the reference to the target value of the T^2_A will be performed. Set to 1 by default.

gspe

A number indicating the term that will tune the spacing between steps for the SPE. Set to 1 by default (linear spacing).

gt2

A number indicating the term that will tune the spacing between steps for the SPE. Set to 1 by default (linear spacing).

mode

A character indicating the type of shift that will be performed: "simple", "steps" or "grid".

Value

list with elements:

Examples

1
2
3
4
5
6
7
8
X <- as.matrix(X)
pcamodel.ref <- pcamb_classic(X, 3, 0.1, "autosc") # PCA-MB with all observations
# Shift the first observation:
outscout <- scout(X[1,], pcamodel.ref, T2.y = 40, SPE.y = 50, nsteps.spe = 3, nsteps.t2 = 2, 
gspe = 3, gt2 = 0.5, mode = "grid")

# Shift a set of observations increasing only the T^2 in one step:
outscout <- scout(X, pcamodel.ref, T2.y = matrix(40, nrow(X), 1), mode = "simple")

SCOUTer documentation built on July 1, 2020, 6:27 p.m.