NS: Normal Scores

Description Usage Arguments Value Examples

View source: R/UnivariateNormalScores.R

Description

Get conditional or unconditional normal score (NS) of observations (X) relative to previous observations (Y).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
NS(
  X,
  Y = NULL,
  theta = NULL,
  Ftheta = NULL,
  scoring = "Z",
  Chi2corrector = "None",
  alignment = "unadjusted",
  constant = NULL,
  absolute = FALSE
)

Arguments

X

vector. New observations to obtain the N¡normal scores.

Y

vector. If Y is not defined (no previous observation available, NULL), NS is relative to X. Default NULL.

theta

scalar. Value corresponig with the Ftheta quantile.

Ftheta

scalar. Quantile of the data distribution. The values that take are between (0,1).

scoring

character string. If "Z" (normal scores) (default). If "Z-SQ" (normal scores squared).

Chi2corrector

character string. Only when scoring is Z-SQ. Select from

  • "approx: Z^2*(m + 1 + 1.3)/(m+1).

  • "exact": Z^2/mean(Z).

  • "none": Z^2.

If "approx" () (default). If "exact" (normal scores squared).

alignment

character string. Aligment of the data X and Y. Select from

  • "unadjusted": nothing is sustracte from X and Y (default).

  • "overallmean": overall mean is sustracted from X and Y.

  • "overallmedian": overall median is sustracted from X and Y.

  • "samplemean": mean from corresponding group (X and Y) is sustracted from its corresponing vector.

  • "samplemedian": median from corresponding group (X and Y) is sustracted from its corresponing vector.

  • "referencemean": mean from Y is subtracted from X and Y.

  • "referencemedian": median from Y is subtracted from X and Y.

  • "constantvalue": a constant value is subtracted from X and Y.

constant

scalar. Only used when the alignment is selected "constantvalue". Default NULL.

absolute

logical. If TRUE, the absolute aligned values are obtained. (Default FALSE)

Value

Multiple output. Select by output$

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Y <- c(10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
X <- c(30, 35, 45)
theta <- 40
Ftheta <- 0.5
# EXAMPLE CONDITIONAL
NS(X = X, Y = Y, theta = theta, Ftheta = Ftheta)

# EXAMPLE UNCONDITIONAL
theta <- NULL
Ftheta <- NULL
NS(X = X, Y = Y, theta = theta, Ftheta = Ftheta)

SNSchart documentation built on April 7, 2021, 9:07 a.m.