Learn R Programming

outliers (version 0.13-3)

scores: Calculate scores of the sample

Description

This function calculates normal, t, chi-squared, IQR and MAD scores of given data.

Usage

scores(x, type = c("z", "t", "chisq", "iqr", "mad"), prob = NA, lim = NA)

Arguments

x
a vector of data.
type
"z" calculates normal scores (differences between each value and the mean divided by sd), "t" calculates t-Student scores (transformed by (z*sqrt(n-2))/sqrt(z-1-t^2) formula, "chisq" gives chi-squared scores (squares of differences between
prob
If set, the corresponding p-values instead of scores are given. If value is set to 1, p-value are returned. Otherwise, a logical vector is formed, indicating which values are exceeding specified probability. In "z" and "mad" types, there is also possibi
lim
This value can be set for "iqr" type of scores, to form logical vector, which values has this limit exceeded.

Value

  • A vector of scores, probabilities, or logical vector.

References

Schiffler, R.E (1998). Maximum Z scores and outliers. Am. Stat. 42, 1, 79-80.

See Also

mad, IQR, grubbs.test,

Examples

Run this code
set.seed(1234)
x = rnorm(10)
scores(x)
scores(x,prob=1)
scores(x,prob=0.5)
scores(x,prob=0.1)
scores(x,prob=0.93)
scores(x,type="iqr")
scores(x,type="mad")
scores(x,prob=0)

Run the code above in your browser using DataLab