A convenience wrapper for extracting interpretable features from the kinetic tremor activity measured using smartphone raw accelerometer and gyroscope sensors.

get_kinetic_tremor_features(
  accelerometer_data = NULL,
  gyroscope_data = NULL,
  gravity_data = NULL,
  time_filter = NULL,
  detrend = F,
  frequency_filter = NULL,
  IMF = 2,
  window_length = NULL,
  window_overlap = NULL,
  derived_kinematics = F,
  funs = NULL,
  models = NULL
)

Arguments

accelerometer_data

An n x 4 data frame with columns t, x, y, z containing accelerometer measurements. Here n is the total number of measurements, t is the timestamp of each measurement, and x, y and z are linear acceleration measurements.

gyroscope_data

An n x 4 data frame with columns t, x, y, z containing gyroscope measurements. Here n is the total number of measurements, t is the timestamp of each measurement, and x, y and z are linear velocity measurements.

gravity_data

An n x 4 data frame with columns t, x, y, z containing gravity measurements. Here n is the total number of measurements, t is the timestamp of each measurement, and x, y and z are linear gravity measurements.

time_filter

A length 2 numeric vector specifying the time range of measurements to use during preprocessing and feature extraction after normalizing the first timestamp to 0. A NULL value means do not filter any measurements.

detrend

A logical value indicating whether to detrend the signal. By default the value is FALSE.

frequency_filter

A length 2 numeric vector specifying the frequency range of the signal (in hertz) to use during preprocessing and feature extraction. A NULL value means do not filter frequencies.

IMF

The number of IMFs used during an empirical mode decomposition (EMD) transformation. The default value of 1 means do not apply EMD to the signal.

window_length

A numerical value representing the length (in number of samples) of the sliding window used during the windowing transformation. Both window_length and window_overlap must be set for the windowing transformation to be applied.

window_overlap

Fraction in the interval [0, 1) specifying the amount of window overlap during a windowing transformation. Both window_length and window_overlap must be set for the windowing transformation to be applied.

derived_kinematics

A logical value specifying whether to add derived kinematic measurements (displacement, velocity or acceleration, and jerk) to accelerometer_data and gyroscope_data after the transform defined by the above parameters has been applied to the raw sensor measurements.

funs

A function or list of functions that each accept a single numeric vector as input. Each function should return a dataframe of features (normally a single-row datafame, with column names as feature names). The input vectors will be the axial measurements from accelerometer_data and/or gyroscope_data after the transform defined by the above parameters has been applied.If no argument is supplied to either funs or models, a default set of feature extraction functions (as described in default_kinematic_features) will be supplied for this parameter.

models

A function or list of functions that each accept sensor_data as input after the transform defined by the above parameters has been applied and returns features. Useful for functions which compute individual features using multiple input variables.

Value

A list. The outputs from funs will be stored under $extracted_features and the outputs from models will be stored under $model_features. If there is an error during the transform process, an error dataframe will be stored under $error. If gravity_data is passed and window_length and window_overlap are set, phone rotation information will be stored under $outlier_windows.

Details

The kinetic tremor activity (also known as the finger/hand to nose test) entails participants holding the mobile device in their hand (either right or left) with both the mobile device and the participants elbow at nose level. The participant then moves the mobile device away from the nose, with both mobile device and elbow parallel to the ground and the elbow joint acting as an axis of rotation. When the arm is fully extended, the participant moves the mobile device back to the nose. This happens in a continuous motion and the motion is repeated for approximately 10 seconds.

See also

Examples

kinetic_tremor_features <- get_kinetic_tremor_features( accelerometer_data, gyroscope_data)
#> Joining, by = c("axis", "IMF", "window")
#> Joining, by = c("axis", "IMF", "window")
kinetic_tremor_features <- get_kinetic_tremor_features( accelerometer_data, gyroscope_data, time_filter = c(2,4), detrend = TRUE, frequency_filter = c(0.5, 25), window_length = 256, window_overlap = 0.2, derived_kinematics = TRUE)
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Joining, by = c("axis", "IMF", "window")
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Joining, by = c("axis", "IMF", "window")
kinetic_tremor_features <- get_kinetic_tremor_features( accelerometer_data, gyroscope_data, funs = list(time_domain_summary))
#> Joining, by = c("axis", "IMF", "window")
#> Joining, by = c("axis", "IMF", "window")