Learn R Programming

Analysing Accelerometer Data Using Hidden Markov Models (HMMpa)

HMMpais an R-package providing function to analyses accelerometer data (known as a time-series of (impulse)-counts) to quantify length and intensity of physical activity using hidden Markov models. It also contains the traditional cut-off point method.

Usually, so called activity ranges are used to classify an activity as 'sedentary', 'moderate' and so on. Activity ranges are separated by certain thresholds (cut-off points). The choice of these cut-off points depends on different components like the subjects' age or the type of accelerometer device.

Cut-off point values and defined activity ranges are important input values of the following analyzing tools provided by this package:

  1. Cut-off point method (_assigns an activity range to a count given its

total magintude_). This traditional approach assigns an activity range to each count of the time-series independently of each other given its total magnitude.

  1. HMM-based method (_assigns an activity range to a count given its

underlying PA-level_). This approach uses a stochastic model (the hidden Markov model or HMM) to identify the (Markov dependent) time-series of physical activity states underlying the given time-series of accelerometer counts. In contrast to the cut-off point method, this approach assigns activity ranges to the estimated PA-levels corresponding to the hidden activity states, and not directly to the accelerometer counts.

The new procedure for analyzing accelerometer data can be roughly described as follows:

a) First, a hidden Markov model (HMM) is trained to estimate the number m of hidden physical activity states and the model specific parameters (delta, gamma, distribution_theta).

b) Then, a user-sepcified decoding algorithm decodes the trained HMM to classify each accelerometer count into the m hidden physical activity states.

c) Finally, the estimated distribution mean values (PA-levels) corresponding to the hidden physical activity states are extracted and the accelerometer counts are assigned by the total magnitudes of their corresponding PA-levels to given physical activity ranges (e.g. 'sedentary', 'light', 'moderate' and 'vigorous') by the traditional cut-off point method.

To see examples, type (after installation)

?HMMpa

Installation

To install, type in R

install.packages("HMMpa")
# or
devtools::install_github("bips-hb/HMMpa")

Reference

Witowski V, Foraita R, Pitsiladis Y, Pigeot I, Wirsik N (2014). Using Hidden Markov Models to Improve Quantifying Physical Activity in Accelerometer Data – A Simulation Study PLOS One. doi:10.1371/journal.pone.0114089

Copy Link

Version

Install

install.packages('HMMpa')

Monthly Downloads

454

Version

1.0.2

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Ronja Foraita

Last Published

January 31st, 2025

Functions in HMMpa (1.0.2)

BIC_HMM

BIC Value for a Discrete Time Hidden Markov Model
HMM_training

Training of Hidden Markov Models
Viterbi_algorithm

Algorithm for Decoding Hidden Markov Models (global)
HMMpa-package

Analysing Accelerometer Data Using Hidden Markov Models
HMM_based_method

Hidden Markov Method for Predicting Physical Activity Patterns
AIC_HMM

AIC Value for a Discrete Time Hidden Markov Model
HMM_decoding

Algorithm for Decoding Hidden Markov Models (local or global)
HMM_simulation

Generating Realizations of a Hidden Markov Model
cut_off_point_method

Cut-Off Point Method for Assigning Physical Activity Patterns
Baum_Welch_algorithm

Estimation Using the Baum-Welch Algorithm
rgenpois

The Generalized Poisson Distribution
dgenpois

The Generalized Poisson Distribution
forward_backward_algorithm

Calculating Forward and Backward Probabilities and Likelihood
local_decoding_algorithm

Algorithm for Decoding Hidden Markov Models (local)
pgenpois

The Generalized Poisson Distribution
direct_numerical_maximization

Estimation by Directly Maximizing the log-Likelihood
initial_parameter_training

Algorithm to Find Plausible Starting Values for Parameter Estimation