Description Usage Arguments Value References Examples
clean_artifact
performs two stage and distributional automated
clean-up of artifacts in the pupil and gaze coordinate data.
1 2 3 4 |
data |
A data frame object created from |
MADWindow |
A numeric value specifying the window size (in msec) to use for the MAD calculation. |
MADConstant |
A numeric value specifying the constant (a multiplier for the third quartile) when determining MAD outlier status. |
MADPadding |
A numeric vector of length two containing values (in msec) to pad the identified artifact creating a window within which to operate the cleanup. |
MahaConstant |
A numeric value specifying the constant (a multiplier for the third quartile) when determining Mahalanobis outlier status. |
Method |
A character string ("Basic" or "Robust") indicating
which method to use for the distance calculation. Basic is a standard
Mahalanobis distance calculation based on covariance. Robust is also a
Mahalanobis distance, however, it is based on Minimum Covariance
Determinant (Rousseeuw and van Driessen, 1999) with reweighted covariance
(Pison et al., 2002). For more details, see |
XandY |
A logical value specifying whether to also use horizontal velocity and acceleration in outlier detection. |
Second |
A logical value specifying whether secondary cleaning should be applied. |
MaxValueRun |
A numeric value specifying the maximal run of existing values flanked by NAs that could be targeted for removal. |
NAsAroundRun |
A numeric vector of length two containing values (in number of subsequent NA) to be used to identify straggler runs of data that could be removed. |
LogFile |
A character string indicating the file name (with extension) of the log file to be created/written. The file keeps track of which events have been cleaned. We suggest "ArtifactCleanupLog.rds". |
An object of type data table as described in tibble.
Rousseeuw, P. J. and van Driessen, K. (1999) A fast algorithm for the minimum covariance determinant estimator. Technometrics 41, 212–223.
Pison, G., Van Aelst, S., and Willems, G. (2002) Small Sample Corrections for LTS and MCD, Metrika 55, 111–123.
1 2 3 4 5 6 7 8 9 10 11 12 | # Load example data
data("Pupilex4")
# Writing log file to temporary folder for the example
dat <- clean_artifact(Pupilex4, MADWindow = 100, MADConstant = 2,
MADPadding = c(200, 200), MahaConstant = 2,
Method = "Robust", XandY = TRUE, Second = TRUE,
MaxValueRun = 5, NAsAroundRun = c(2,2),
LogFile = paste0(tempdir(),"/ArtifactCleanupLog.rds"))
# Please see the vignettes for detailed example usage.
# vignette("PupilPre_Cleanup", package="PupilPre")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.