MEAoutlier {rMEA}R Documentation

Replace outliers with given values

Description

Sometimes motion energy analysis generates excessively high peaks resulting from video artifacts or other anomalies in the video source.

Usage

MEAoutlier(
  mea,
  threshold = function(x) {     stats::sd(x) * 10 },
  direction = c("greater", "less"),
  replace = NA
)

Arguments

mea

an object of class MEA or a list of MEA objects (see function readMEA)

threshold

a numeric value, or a function returning the threshold value to consider data as outliers.

direction

a text string. One of "greater" or "less": can be abbreviated.

replace

a numeric, NULL, or NA value to use as substitution.

Value

The same mea object with all extreme values substituted.

Examples

## read the first 4 minutes of the normal sample
##   (intake interviews of patients that carried on therapy)
path_normal <- system.file("extdata/normal", package = "rMEA")
mea_raw <- readMEA(path_normal, sampRate = 25, s1Col = 1, s2Col = 2,
                     s1Name = "Patient", s2Name = "Therapist",
                     idOrder = c("id","session"), idSep="_", skip=1, nrow = 6000)

## Remove extreme values, higher than 10 times the standard deviation
mea_clean = MEAoutlier(mea_raw, threshold=function(x){sd(x)*10}, direction = "greater")

[Package rMEA version 1.2.2 Index]