DataQuality | R Documentation |
Provides methods for assessing the quality of gaze data, including accuracy, precision, data loss, and effective sampling frequency.
timestamps
Vector of timestamps in seconds. Samples with missing data should not be removed, or the RMS calculation would be incorrect.
azi
Vector of azimuth angles in degrees (Fick angles). Missing data should be coded as NA, not using some special value such as (0,0) or (-xres,-yres).
ele
Vector of elevation angles in degrees (Fick angles). Missing data should be coded as NA, not using some special value such as (0,0) or (-xres,-yres).
new()
Creates a new DataQuality object from gaze data and timestamps.
DataQuality$new(gaze_x, gaze_y, timestamps, unit, screen = NULL)
gaze_x
Horizontal gaze positions (pixels or degrees).
gaze_y
Vertical gaze positions (pixels or degrees).
timestamps
Vector of timestamps in seconds.
unit
Unit of gaze data: either "pixels"
or "degrees"
.
screen
Optional ScreenConfiguration
object, required if unit is "pixels"
.
A new DataQuality object.
dq <- DataQuality$new(gaze_x, gaze_y, timestamps, unit = "pixels", screen = sc)
accuracy()
Calculates the accuracy of gaze data relative to a known target location.
DataQuality$accuracy(target_azi, target_ele, central_tendency_fun = mean)
target_azi
Target azimuth in degrees.
target_ele
Target elevation in degrees.
central_tendency_fun
Function to compute central tendency (e.g., mean
, median
).
Accuracy in degrees.
dq$accuracy(0, 0)
precision_RMS_S2S()
Calculates precision as root mean square of sample-to-sample distances
DataQuality$precision_RMS_S2S(central_tendency_fun = mean)
central_tendency_fun
Function to compute central tendency (e.g., mean
, median
).
Precision in degrees.
dq$precision_RMS_S2S()
precision_STD()
Calculates precision as standard deviation of gaze positions.
DataQuality$precision_STD()
Standard deviation in degrees.
dq$precision_STD()
precision_BCEA()
Calculates the Bivariate Contour Ellipse Area (BCEA) and ellipse parameters for gaze precision.
DataQuality$precision_BCEA(P = 0.68)
P
Proportion of data to include in the ellipse (default is 0.68).
BCEA in degrees-squared.
dq$precision_BCEA()
data_loss_from_invalid()
Calculates the proportion of missing data (coded as NA).
DataQuality$data_loss_from_invalid()
Proportion of missing samples.
dq$data_loss_from_invalid()
data_loss_from_expected()
Estimates data loss based on expected number of samples given the duration and sampling frequency.
DataQuality$data_loss_from_expected(frequency)
frequency
Expected sampling frequency in Hz.
Proportion of missing samples.
dq$data_loss_from_expected(500)
effective_frequency()
Calculates the effective sampling frequency based on timestamps.
DataQuality$effective_frequency()
Effective frequency in Hz.
dq$effective_frequency()
get_duration()
Computes the total duration of the gaze recording, including the last sample.
DataQuality$get_duration()
Duration in seconds.
dq$get_duration()
precision_using_moving_window()
Calculates precision using a moving window approach.
DataQuality$precision_using_moving_window( window_length, metric, aggregation_fun = median, ... )
window_length
Length of the moving window in number of samples.
metric
Precision metric to use ("RMS-S2S"
, "STD"
, or "BCEA"
).
aggregation_fun
Function to aggregate windowed precision values (e.g., median
).
...
Additional arguments passed to the precision metric function.
Precision value.
dq$precision_using_moving_window(0.2, "RMS-S2S")
clone()
The objects of this class are cloneable with this method.
DataQuality$clone(deep = FALSE)
deep
Whether to make a deep clone.
sc <- ScreenConfiguration$new(500, 300, 1920, 1080, 600)
gaze_x <- c(0, 1, -1)
gaze_y <- c(0, 1, -1)
timestamps <- c(0, 1, 2)
dq <- DataQuality$new(gaze_x, gaze_y, timestamps, unit = "pixels", screen = sc)
dq$accuracy(0, 0)
dq$precision_RMS_S2S()
dq$data_loss_from_invalid()
## ------------------------------------------------
## Method `DataQuality$new`
## ------------------------------------------------
dq <- DataQuality$new(gaze_x, gaze_y, timestamps, unit = "pixels", screen = sc)
## ------------------------------------------------
## Method `DataQuality$accuracy`
## ------------------------------------------------
dq$accuracy(0, 0)
## ------------------------------------------------
## Method `DataQuality$precision_RMS_S2S`
## ------------------------------------------------
dq$precision_RMS_S2S()
## ------------------------------------------------
## Method `DataQuality$precision_STD`
## ------------------------------------------------
dq$precision_STD()
## ------------------------------------------------
## Method `DataQuality$precision_BCEA`
## ------------------------------------------------
dq$precision_BCEA()
## ------------------------------------------------
## Method `DataQuality$data_loss_from_invalid`
## ------------------------------------------------
dq$data_loss_from_invalid()
## ------------------------------------------------
## Method `DataQuality$data_loss_from_expected`
## ------------------------------------------------
dq$data_loss_from_expected(500)
## ------------------------------------------------
## Method `DataQuality$effective_frequency`
## ------------------------------------------------
dq$effective_frequency()
## ------------------------------------------------
## Method `DataQuality$get_duration`
## ------------------------------------------------
dq$get_duration()
## ------------------------------------------------
## Method `DataQuality$precision_using_moving_window`
## ------------------------------------------------
dq$precision_using_moving_window(0.2, "RMS-S2S")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.