perSubjectTrim.fnc: Per-subject Trimming of Response Variable.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/perSubjectTrim.fnc.R

Description

For each subject, removes data points that are, e.g., 2.5 standard deviations above or below the subject mean.

Usage

1
perSubjectTrim.fnc(data, response, subject, trim = 2.5)

Arguments

data

The data frame containing the data to be trimmed.

response

The quoted name of the column containing the to-be-trimmed data.

subject

The quoted name of the column contain subject identifiers.

trim

Threshold at which data points will be removed. Defaults to 2.5 (standard deviations above and below each subject's mean).

Value

The function returns the following objects:

data

The data with outliers removed.

data0

The original data prior to removing the outliers.

n.removed

The number of data points removed.

percent.removed

The percentage of removed data points.

Author(s)

Antoine Tremblay, Statistics Canada, trea26@gmail.com.

See Also

mcp.fnc romr.fnc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
if("LCFdata" %in% .packages(all.available=TRUE)){
data(eegWide)
dat<-eegWide
rm(eegWide)
gc(TRUE,TRUE)
# per subject trimming
dat <- perSubjectTrim.fnc(dat, response = "Fz", 
      subject = "Subject", trim = 2.5)$data
# ......
# n.removed = 5130 
# percent.removed = 1.584507 
}

## End(Not run)

LMERConvenienceFunctions documentation built on Oct. 23, 2020, 5:12 p.m.