perSubjectTrim.fnc {LMERConvenienceFunctions} | R Documentation |
Per-subject Trimming of Response Variable.
Description
For each subject, removes data points that are, e.g., 2.5 standard deviations above or below the subject mean.
Usage
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
Examples
## 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)
[Package LMERConvenienceFunctions version 3.0 Index]