flag.by.sds: Identify Extreme Values Based on Mean and Standard Deviation

View source: R/flag.by.sds.R

flag.by.sdsR Documentation

Identify Extreme Values Based on Mean and Standard Deviation

Description

Identifies which elements of x are a certain number of standard deviations from the mean (e.g., values more than 3 standard deviations from the mean).

Usage

flag.by.sds(x, sds = 3, print = TRUE, na.rm = FALSE)

Arguments

x

vector of values.

sds

number of standard deviations away from the mean at which "extreme" values should be identified.

print

a logical value indicating whether to display the number and percentage of identified elements.

na.rm

a logical value indicating whether NA values should be ignored when computing the mean and standard deviation.

Value

logical vector indicating whether each element of x is more than the specificed number of deviations away from the mean.

See Also

trim to treat such elements as missing data.

fence to replace such elements with the threshold value.

flag.by.group to identify values a certain number of standard deviations away from a group mean (e.g., the mean within a condition or the mean for a research participant) rather than the overall mean.

Examples

my.data <- data.frame(RT=rnorm(300, mean=789, sd=150))
my.data$OutlyingRT <- flag.by.sds(my.data$RT, sds=2)

sfraundorf/psycholing documentation built on April 23, 2022, 2:50 a.m.