# A Bayesian Circadian Hidden Markov Model to Infer Rest-Activity Rhythms
Using 24-hour Actigraphy Data

Jiachen Lu  Qian Xiao  Department of Epidemiology, Human Genetics, and
Environmental Sciences, The University of Texas Health Science Center at
Houston School of Public Health  Cici Bauer corresponding author

###### Abstract

24-hour actigraphy data collected by wearable devices offer valuable insights
into physical activity types, intensity levels, and rest-activity rhythms
(RAR). RARs, or patterns of rest and activity exhibited over a 24-hour period,
are regulated by the body’s circadian system, synchronizing physiological
processes with external cues like the light-dark cycle. Disruptions to these
rhythms, such as irregular sleep patterns, daytime drowsiness or shift work,
have been linked to adverse health outcomes including metabolic disorders,
cardiovascular disease, depression, and even cancer, making RARs a critical
area of health research.

In this study, we propose a Bayesian Circadian Hidden Markov Model (BCHMM)
that explicitly incorporates 24-hour circadian oscillators mirroring human
biological rhythms. The model assumes that observed activity counts are
conditional on hidden activity states through Gaussian emission densities,
with transition probabilities modeled by state-specific sinusoidal functions.
Our comprehensive simulation study reveals that BCHMM outperforms frequentist
approaches in identifying the underlying hidden states, particularly when the
activity states are difficult to separate. BCHMM also excels with smaller
Kullback-Leibler divergence on estimated densities. With the Bayesian
framework, we address the label-switching problem inherent to hidden Markov
models via a positive constraint on mean parameters. From the proposed BCHMM,
we can infer the 24-hour rest-activity profile via time-varying state
probabilities, to characterize the person-level RAR. We demonstrate the
utility of the proposed BCHMM using 2011-2014 National Health and Nutrition
Examination Survey (NHANES) data, where worsened RAR, indicated by lower
probabilities in low-activity state during the day and higher probabilities in
high-activity state at night, is associated with an increased risk of
diabetes.

#### Keywords:

Rest-activity rhythms, hidden Markov models, Bayesian inference, actigraphy
data, diabetes.

##  1 Introduction

Biological rhythms are rhythmic patterns inherent in all living organisms at
molecular, cellular, physiological, and behavior levels (Lamont and Amir,
2010). Of these, circadian rhythms, with an oscillation of approximately 24
hours, are critical within the human body. Other biological rhythms include
ultradian and infradian rhythms, which respectively have periods shorter or
longer than 24 hours (Hobson and Pace-Schott, 2002; Blum et al., 2014). A
diminished or weakened circadian rhythmicity has been linked to significantly
increased risks of metabolic, neurodegenerative, and cardiovascular diseases
(Montaruli et al., 2021; Cheng et al., 2021; Xiao et al., 2021; Morris et al.,
2012).

The assessment of circadian rhythmicity has been advanced through established
circadian biomarkers such as circulating melatonin level (Pandi-Perumal et
al., 2007; Figueiro et al., 2014). However, such biomarkers require a
laboratory standard environment to collect and store the bio-samples from
which melatonin levels are measured, yielding only sparse measurements per
24-hour cycle. Alternatively, wearable devices offer the monitoring of
circadian fluctuations in a free-living environment. They provide long-time
use over multiple days and generate high-resolution data. These wearable
devices offer measurements such as body temperature, heart rate, blood
pressure and activity movements. The latter, also known as the accelerometer
or actigraphy data, have been extensively explored in sleep and circadian
research, and demonstrated alignment with standard approaches such as
polysomnography (PSG) (Ancoli-Israel et al., 2003; Li et al., 2020).

Hidden Markov models (HMMs) have been extensively applied to feature
extraction and classification applications such as speech recognition (Gales
and Young, 2007), bioinformatics (Chen et al., 2016), healthcare surveillance
systems (Luo and Stephens, 2021), and network analysis (Mor et al., 2021;
Bouguila et al., 2022). In actigraphy research, HMMs have been used to
characterize the rest-activity cycle (Huang et al., 2018; Li et al., 2020;
Wiggin et al., 2020), activity modes classification (Witowski et al., 2014;
Pober et al., 2006), and identify activity intensity levels (Bernard et al.,
2019; Chaumaray et al., 2020; Xu et al., 2020). These applications view
actigraphy data as the observations generated by the underlying hidden states
via emission distributions, including both parametric (e.g., Gaussian, Poisson
and Gamma) and non-parametric approaches (e.g., spline-based models). Witowski
et al. (2014) demonstrated the HMM-based methods more accurately classify
activity modes and energy expenditure levels than traditional cutoff points
methods. Xu et al. (2020) proposed a hierarchical continuous-time HMM that
assumed Poisson emission distributions. In this model, the authors considered
six distinct hidden states and zero-inflation was imposed on the state with
the lowest mean activity, and subject-level covariates were utilized to model
the mean parameters. When applied to the 2003-2006 National Health and
Nutrition Examination Survey (NHANES) actigraphy dataset, this model suggested
a significant heterogeneity in rest-activity patterns across the population,
denoted by the substantial variance in mean activity counts of the same state
across different subjects. Li et al. (2020) used an unsupervised machine
learning algorithm to identify sleep and wake states from actigraphy data.
When juxtaposed with the standard polysomnography (PSG) measurements, their
algorithm demonstrated considerable robustness in accurately classifying sleep
and wake states. However, Li et al. (2020) also pointed out potential
limitations within the two-state model, primarily due to the left-skewed
distribution of the observations in the wake state and a heavy-tailed
distribution in the sleep state, both influenced by subtle movement variations
in behavior during sleep and sedentary periods.

The studies mentioned above largely concentrated on classifying activity modes
or intensity levels, while assuming time-invariant transition probabilities.
This assumption may fail to effectively capture the temporal dynamics inherent
in rest-activity patterns. A recent study by Xiao et al. (2022), with the
2011-2014 NHANES dataset, concluded that rest-activity profiles can be
distinctly characterized by both the overall activity amplitude, as well as
distinct temporal features such as early-rising and prolonged daytime activity
periods. Therefore, it is important and of great interest to characterize the
rhythmicity in the rest-activity patterns beyond merely doing classification.
Towards this end, Huang et al. (2018) proposed a novel harmonic HMM
incorporating time-varying transition probabilities, building upon the
biological mechanism of the circadian rhythm. The empirical oscillatory
patterns in the actigraphy data were further explored by Hadj-Amar et al.
(2022) using a Bayesian Hidden Semi-Markov model. While they successfully
identified oscillations in the mean activity levels by each state, a
comprehensive understanding of individual rest-activity profiles in relation
to health outcomes was not investigated.

In this study, we propose a Bayesian Circadian Hidden Markov Model (BCHMM)
designed to incorporate 24-hour circadian oscillator reflecting inherent human
biological rhythms. The Bayesian inference framework utilizes prior
specification to facilitate the identification of the hidden activity states,
whilst avoiding substantial computational burden. The proposed BCHMM is
implemented using the Stan programming language via the R interface (Stan
Development Team, 2023). Our study differs significantly from the majority of
previous research (e.g., Witowski et al. (2014); Hadj-Amar et al. (2022); Xu
et al. (2020)) in that our key focus is to use 24-hour actigraphy in
characterizing the rest-activity rhythms (RAR), in order to understand how
weakened RAR may impact the health outcomes. For this objective, we first
apply the BCHMM to the 24-hr actigraphy data to determine the rest-activity
profiles, and then investigate these profiles between individuals with
diabetes and those without.

The rest of the article is organized as follows. In Section 2, we introduce
the dataset that motivated the proposed work. Section 3.1 discusses the
standard HMMs and the incorporation of circadian oscillators. In Section 3.2,
we present the Bayesian framework and posterior inference method facilitated
by Stan programming language. Section 4 includes a comprehensive simulation
study to demonstrate the performance of the proposed BCHMM and compare it with
the frequentist alternative. In Section 5, we illustrate the application of
BCHMM on the motivating dataset. R scripts and Stan file will be made
available on Github.

##  2 Motivating Example

Our motivating dataset was the National Health and Nutrition Examination
Survey (NHANES) study between 2011 and 2014, where actigraphy data were
collected 10,000 participants. Participants wore ActiGraph GT3X (by ActiGraph,
LLC of Pensacola, FL) continuously for nine days. On the first and last days
of this period, data collection typically did not span a full 24 hours,
leading to partial observations on these two days. We hence excluded these two
days and used the remaining seven days in this analysis.

The actigraphy device was engineered to capture triaxial accelerations (i.e.,
$x$-, $y$-, and $z$-axes) at a sampling rate of 80 Hz. The collected data was
subsequently summarized on a minute-by-minute basis. Summary measures from
triaxial accelerations were then calculated in Monitor Independent Movement
Summary (MIMS) units, which is a non-proprietary, open-source, and device-
independent universal summary metric (John et al., 2019). In our analysis, we
further aggregated the data into 5-min epochs. Examples of the resulting
actigraphy data are presented in Figure 1.

Figure 1: Example of the observed 24-hour actigraphy data from two selected
subjects in the 2011-2014 NHANES study.

We classified participants’ diabetic status based on their Hemoglobin A1c
(HbA1c) levels, following the established clinical guidelines for diabetes
diagnosis. Specifically, we classified participants as having diabetes (HbA1c
$\geq$ 6.5%), prediabetes (HbA1c between 5.7% and 6.4%), normal (HbA1c between
5% and 5.6%), or low (HbA1c $<$ 5%) (Palta et al., 2017). Here, we focus on
diabetes and normal HbA1c groups only, and employed a matched-control study
design to select the analytical samples for our analysis objective. Among the
adult participants aged over 20, we randomly selected 100 individuals from the
diabetes group first. These participants were subsequently matched to a group
of individuals with normal HbA1c levels in a 2:1 ratio, stratified by age and
gender. The demographic characteristics of the selected samples used for this
analysis are provided in Table 1. Our goal is to use the model-based approach
to extracting meaningful parameters to understand the associations between
diabetes risk and weakened rest-activity rhythms (RARs).

Table 1: Summary of the demographics of the analytical sample used in this study. | Diabetics | Normal | P-value†
---|---|---|---
| (N=100) | (N=200) |
Age
Mean (SD) | 60.7 (12.2) | 60.3 (11.9) | 0.804
Median (Min, Max) | 62.0 (21.0, 80.0) | 62.0 (21.0, 80.0) |
Age Category
21-30 | 1 (1.0%) | 2 (1.0%) |  $>$ 0.999
31-40 | 3 (3.0%) | 6 (3.0%) |
41-50 | 17 (17.0%) | 34 (17.0%) |
51-60 | 24 (24.0%) | 48 (24.0%) |
61-70 | 35 (35.0%) | 70 (35.0%) |
71-80 | 20 (20.0%) | 40 (20.0%) |
Gender
Female | 48 (48.0%) | 96 (48.0%) |  $>$ 0.999
Male | 52 (52.0%) | 104 (52.0%) |
Race
Mexican American | 17 (17.0%) | 34 (17.0%) |  $>$ 0.999
NH Asian | 11 (11.0%) | 22 (11.0%) |
NH Black | 33 (33.0%) | 66 (33.0%) |
NH White | 39 (39.0%) | 78 (39.0%) |
†Two sample $t$-tests or $\chi^{2}$ tests are used to test the independence of
continuous or discrete variables between diabetes and normal HbA1c groups.

##  3 Method

In this section, we first briefly review the Hidden Markov Models (HMMs),
notations and inference. We then introduce the proposed Bayesian Circadian
Hidden Markov Model (BCHMM), and describe its formulation and implementation.

###  3.1 Circadian Hidden Markov Models

Hidden Markov Model (HMM) is a type of dependent mixture model with two
components: an unobserved state process denoted by
$\\{S_{t}:t\in\mathbb{N}\\}$, and observed state-dependent process denoted by
$\\{Y_{t}:t\in\mathbb{N}\\}$. In our analysis, we wish to use the observed
individual-level 24-hour actigraphy data to infer the unobserved rest-activity
states (such as low-, moderate-, or high-activity states). The observed
variable $\boldsymbol{y}=(y_{1},y_{2},\dots,y_{T})$ is independent of other
observations conditional on the current state and has the emission
distribution $f$, $y_{t}|S_{t}\sim f(\theta_{S_{t}})$. We consider the
Gaussian distributions for $f$ where

$y_{t}|(S_{t}=i)\sim N(\mu_{i},\sigma^{2}_{i}),i=1,2,...,m,$ (1)

where $\mu_{i}$s and $\sigma^{2}_{i}$s are stated-specific mean and variance
parameters. Other distributions (e.g., Poisson and Gamma) could also be
considered (Chaumaray et al., 2020; Witowski et al., 2014) as the emission
distribution $f$. The unobserved state process is assumed to satisfy the
Markov property, where the current state $S_{t}$ depends on the previous state
$S_{t-1}$ via the transition probability matrix $\Gamma=\\{\gamma_{ij}\\}$,
with $\gamma_{ij}=P(S_{t}=j|S_{t-1}=i)$ from state $i$ to $j$, where
$i,j=1,...,m$. The state-specific vector
$\boldsymbol{\gamma}_{i}=(\gamma_{ij})$ is a simplex with
$\sum^{m}_{j=1}\gamma_{ij}=1$.

To emulate the circadian oscillation inherent in 24-hour actigraphy data, we
incorporate a set of harmonic functions as covariates in the transition
probabilities, an approach similar to Huang et al. (2018). The time-varying
transition probability from state $i$ to state $j$ at time point $t$ is then

$\begin{split}\gamma_{t,ij}&=P(S_{t}=j|S_{t-1}=i)=\frac{\exp(\eta_{t,ij})}{\sum^{m}_{s=1}{\exp(\eta_{t,is})}},\\\
\eta_{t,ij}&=\beta_{0,ij}+\sum_{l=1}^{L}\Big{[}\beta_{1,ij}^{(l)}\cos\left(2\pi\omega_{l}t\right)+\beta_{2,ij}^{(l)}\sin\left(2\pi\omega_{l}t\right)\Big{]},\end{split}$
(2)

where $l=1,...,L$ and $\omega_{l}$ is the inverse of the period parameter. For
example, $\omega_{l}=1/24$ is equivalent to a period of 24-hour. These
harmonic functions can model additional biological rhythms such as ultradian
and infradian rhythms. The circadian coefficients of
$\boldsymbol{\beta_{ij}}=(\beta_{0,ij},\beta_{1,ij}^{(l)},\beta_{2,ij}^{(l)})$
are explicitly associated with the transition from state $i$ to state $j$.
Larger values of $\eta_{t,ij}$ yield greater transition probabilities. To
ensure the identifiability of the $\eta_{t,ij}$, one would impose
$\boldsymbol{\beta_{ii}}=\boldsymbol{0}$. The identifiability of
$\boldsymbol{\beta_{ij}}$ is not a concern in our case as long as the entity
of interest $\eta_{t,ij}$ is identifiable (Wang et al., 2023; Holsclaw et al.,
2017). This model, which we refer to as CHMM, can be implemented using R
package depmixS4 (Visser and Speekenbrink, 2010) for frequentist inference.

Non-identifiability of the hidden states concerning the membership of the
underlying mixtures is due to the label-switching issue. Specifically, hidden
states are arbitrarily labeled such that different orderings of the states can
lead to the exact same model (Celeux et al., 2000). Consequently, the model
inference can suffer from severe multimodality and substantially increased
computational burden. This problem can be addressed by the specification of
the priors in a Bayesian framework, as we will discuss in detail next.

###  3.2 Bayesian Inference

Our proposed Bayesian Circadian Hidden Markov Models, or BCHMM, can be
specified in a two-stage hierarchical form consisting data model and parameter
model. The Bayesian framework has several advantages. First, the
identifiability of the hidden activity states is facilitated by the
specification of appropriate priors. Second, missing data on the observations
(e.g., the actigraphy data) could be handled directly via predictive inference
in the Bayesian framework.

The data model is the same as described in Section 3.1, with the Gaussian
emission distributions in equation (1) and time-varying transition
probabilities in equation (2). In the parameter model, we specify the priors
for the parameters in the data model. We assume the mean parameters of
$\boldsymbol{\mu}=(\mu_{1},\mu_{2},...,\mu_{m})$ independently come from the
higher level distribution $\mu_{i}\sim Gamma(\mu_{0},\nu_{0})$ with
hyperparameters $\mu_{0}$ and $\nu_{0}$. The variances
$\boldsymbol{\sigma^{2}}=(\sigma^{2}_{1},\sigma^{2}_{2},...,\sigma^{2}_{m})$
independently come from scaled inverse-$\chi^{2}$ distribution, i.e.,
$\sigma^{2}_{i}\sim Inv\chi^{2}(\kappa_{0},\sigma^{2}_{0})$ with
hyperparameters $\kappa_{0}$ and $\sigma^{2}_{0}$. The circadian coefficients
are specified as $\boldsymbol{\beta_{ij}}\sim
N(\mu_{\beta},\sigma^{2}_{\beta})$, where $i,j=1,...,m$ and $i\neq j$. The
initial state probabilities, denoted as
$\boldsymbol{\delta}=(\delta_{1},...,\delta_{m})^{T}$, follow a flat prior of
Dirichlet distribution with concentration parameters
$\boldsymbol{\alpha}=(\alpha_{1},...,\alpha_{m})$ being all equal.

In our Bayesian framework, label-switching can be fixed by either specifying
non-exchangeable priors that are strongly informative or placing ordering
constraints on exchangeable priors (Betancourt, 2017). The latter
specification results in a non-exchangeable prior as,

$p^{{}^{\prime}}(\boldsymbol{\mu})=\begin{cases}p(\boldsymbol{\mu}),&0<\mu_{1}<\mu_{2}<...<\mu_{m}\\\
0,&otherwise\end{cases}$

Recall that, different orderings of the hidden states can yield the exact same
model. By placing the ordering constraint on the mean parameters $\mu$s, the
mixture likelihood is restricted to be explored under a single ordering rather
than arbitrary orderings, such that the inference remains unaffected and the
label-switching issue is therefore solved (Richardson and Green, 1997;
Betancourt, 2017). Furthermore, it can be easily implemented in Stan by
applying positive_ordered on the mean parameter vectors.

The marginal likelihood of observations given all parameters
$\Theta=(\boldsymbol{\mu},\boldsymbol{\sigma^{2}},\boldsymbol{\beta},\boldsymbol{\delta})$
can be presented in matrix multiplication as (Zucchini et al. (2016)) as

$L(\boldsymbol{y}|\Theta)=\boldsymbol{\delta}\boldsymbol{P}(y_{1})\Gamma_{1}\boldsymbol{P}(y_{2})\Gamma_{2}\dots\Gamma_{T-1}\boldsymbol{P}(y_{T})\boldsymbol{1}^{{}^{\prime}}$
(3)

where $\boldsymbol{P}(y_{t})$, $t=1,...,T$ is the emission probability given
all possible states, and $\Gamma_{t}$ is the transition probability matrix at
time $t$ with $\Gamma_{t}=\\{\gamma_{t,ij}\\}$. The posterior distribution of
$\Theta$ can then be expressed as

$\begin{split}p(\Theta|\boldsymbol{y})\propto&L(\boldsymbol{y}|\Theta)p(\boldsymbol{\mu}|\mu_{0},\nu_{0})p(\boldsymbol{\sigma^{2}}|\kappa_{0},\sigma^{2}_{0})p(\boldsymbol{\beta}|\mu_{\beta},\sigma^{2}_{\beta})p(\boldsymbol{\delta}|\boldsymbol{\alpha})\\\
=&L(\boldsymbol{y}|\Theta)\prod_{i=1}^{m}\Bigg{\\{}\Big{[}\frac{\nu_{0}^{\mu_{0}}}{\Gamma(\mu_{0})}\mu_{i}^{\mu_{0}-1}\text{exp}\big{(}-\nu_{0}\mu_{i}\big{)}\Big{]}\Big{[}\frac{(\frac{\kappa_{0}}{2})^{\frac{\kappa_{0}}{2}}}{\Gamma(\frac{\kappa_{0}}{2})}(\sigma_{0}^{2})^{\kappa_{0}}(\sigma^{2}_{i})^{-(\frac{\kappa_{0}}{2}+1)}\text{exp}\Big{(}-\frac{1}{2}\kappa_{0}(\sigma^{2}_{0})^{2}\frac{1}{\sigma^{2}_{i}}\Big{)}\Big{]}\\\
&\Bigg{[}\prod_{j=1,j\neq
i}^{m}{\frac{1}{\sqrt{2\pi\sigma^{2}_{\beta}}}\text{exp}\Big{(}-\frac{(\beta_{ij}-\mu_{\beta})^{2}}{2\sigma^{2}_{\beta}}\Big{)}\Bigg{]}}{\frac{\delta_{i}^{\alpha_{i}-1}}{\Gamma(\alpha_{i})}\Gamma\Big{(}\sum_{i=1}^{m}{\alpha_{i}}\Big{)}}\Bigg{\\}}\end{split}$
(4)

Inference on parameters relies on integrating out the hidden states which are
unknown in the data-generating process. Forward algorithm is used for
inference, see details in Supplementary Materials S1. Since the posterior
distributions outlined in equation (4) are analytically intractable, numerical
methods such as Markov Chain Monte Carlo (MCMC) algorithm are required to make
inference. We implement the proposed model with Stan programming language
(Stan Development Team, 2023), which uses Hamiltonian Monte Carlo (HMC)
algorithm and no-U-turn sampler (NUTS) for improved computation efficiency
(Betancourt, 2018; Neal, 2011). Specifically, it uses Hamiltonian dynamics
simulation with a Metropolis acceptance step so that proposed values can
achieve the targeted distribution more rapidly. The NUTS sampler is an
adaptive form of HMC sampling that is implemented in the warm-up steps to
optimize parameters in the later HMC iterations. We use the posterior median
for inference in the BCHMM and model performance evaluation.

##  4 Simulation Study

We conduct an extensive simulation study to assess the performance of the
proposed Bayesian Circadian Hidden Markov Model (BCHMM), comparing it with its
frequentist counterpart, the CHMM. This simulation design draws inspiration
from the 2011-2014 NHANES actigraphy data, taking into account the circadian
fluctuations seen in the observed activity counts. The true values used in
this simulation, such as the mean and variance of the hidden activity states,
have been carefully selected to mirror those found in our preliminary data
analysis, ensuring that the results offer relevant insights into the
application of the proposed model for the analysis of 24-hour actigraphy data.

###  4.1 Simulation Setup

We consider three scenarios, each with identical circadian coefficients
$\boldsymbol{\beta}$ yet differing underlying hidden states and Gaussian
emission distributions. Table 2 presents true parameter values used in this
simulation study. In all scenarios, we assume three hidden activity states of
low (state 1), moderate (state 2), and high (state 3) activity, and introduce
greater overlap between the underlying hidden states from scenarios 1 to 3 by
increasing the variance. The mean values are chosen based on the existing
literature (Huang et al., 2018; Li et al., 2021) and the empirical
distribution of the actigraphy data from the analytical dataset described in
Section 2, with a sample median of 5.5 (interquartile range [IQR] 0.5, 14.6)
MIMS/min. Therefore, we choose the mean values of 2, 6, and 11 for low-,
moderate- and high-activity states, respectively. In Scenario 1, we assume
equal variability of actigraphy values across hidden states (i.e.,
$\sigma^{2}_{i}=0.5,i=1,2,3$). In Scenario 2, we increase the variability by
employing a larger value of $\sigma^{2}_{i}$ to increase the overlapping of
the Gaussian emission distributions. In Scenario 3, the variability within the
hidden states increases with the activity level, creating further overlap
between the hidden states. Based on the assumed values of circadian
coefficients $\boldsymbol{\beta}$ (Supplementary Table S1), we back-calculate
the time-varying transition probability matrices
$\Gamma_{t}=\\{\gamma_{t,ij}\\}$ according to equation (2). We simulate the
participant-level actigraphy data for 5 consecutive days at 5-min epoch per
day, resulting in a total of $T=5\times 288=1440$ observations per
participant. For each scenario, we generate 100 participants. Figure 2
presents an example of such simulated actigraphy data.

For comparison, we apply both the proposed BCHMM and CHMM to the simulated
data, with CHMM implemented using R package depmixS4 (Visser and Speekenbrink,
2010). We run BCHMM with two MCMC chains and monitor every 5,000 iterations
for convergence check. We run each chain for 20,000 iterations with the first
10,000 discarded as the burnins, and collect every 4th sample for a total of
2,500 samples. The convergence is assessed by trace plots, a split-$\hat{R}$
statistic of less than 1.05 and a ratio of effective size greater than 0.5
(Vehtari et al., 2021; Gelman et al., 2013). Example trace plots are provided
in the Supplementary Figures S1 and S2.

Table 2: True values of the mean and variance parameters of the hidden activity states used in the simulation study. Scenario | Parameters | low-activity | moderate-activity | high-activity
---|---|---|---|---
|  | state 1 | state 2 | state 3
Scenario 1 | $\mu$ | 2.0 | 6.0 | 11.0
| $\sigma^{2}$ | 0.5 | 0.5 | 0.5
Scenario 2 | $\mu$ | 2.0 | 6.0 | 11.0
| $\sigma^{2}$ | 1.0 | 1.0 | 1.0
Scenario 3 | $\mu$ | 2.0 | 6.0 | 11.0
| $\sigma^{2}$ | 0.6 | 1.75 | 2.2
Figure 2: Illustration of the simulated hidden activity states (black line)
and the associated observed activity counts (color-coded dots). Simulated
observations from the low-activity (state 1), moderate-activity (state 2), and
high-activity (state 3) states are presented in blue, pink, and red colors,
respectively.

For model checking, we evaluate the parameter estimation of the emission
distributions (i.e., $\mu_{i}$ and $\sigma^{2}_{i}$), and the time-varying
state probabilities
$\boldsymbol{P(S_{t})}=(P(S_{t}=1),P(S_{t}=2),P(S_{t}=3))$, a three-
dimensional vector of probabilities for a 24-hour period at 5-min epoch (i.e.,
$t=1,2,\dots,288$). To get the posterior inference of $\boldsymbol{P(S_{t})}$,
we first obtain get the time-varying transition probabilities
$\hat{\Gamma}_{t}$ via equation (2). The estimated $\boldsymbol{P(S_{t})}$ can
then be obtained by the product of the estimated initial probabilities
$\boldsymbol{\hat{\delta}}$ and time-varying transition probabilities
$\boldsymbol{\hat{\Gamma}_{t}}$ from

$\boldsymbol{\hat{P}(S_{t})}=\boldsymbol{\hat{\delta}}\hat{\Gamma}_{1}...\hat{\Gamma}_{t}.$
(5)

To evaluate and compare model performance, we measure the following metrics:
mean absolute bias (MAB), mean of mean squared error (MMSE), mean of posterior
standard deviation (MSD), and mean coverage rate (MCR). Here, $\theta$ denotes
the parameter of interest, $\hat{\theta}$ the estimates either from BCHMM or
CHMM, and $\theta_{True}$ the true value:

$\begin{split}\text{MAB}_{\theta}&=\frac{1}{R}\sum_{r=1}^{R}|\hat{\theta}-\theta_{True}|,\\\
\text{MMSE}_{\theta}&=\frac{1}{R}\sum_{r=1}^{R}(\hat{\theta}-\theta_{True})^{2},\\\
\text{MSD}_{\theta}&=\frac{1}{R}\sum_{r=1}^{R}\Big{(}\frac{1}{N_{iter}}\sqrt{Var_{\theta\sim
p(\theta|\boldsymbol{y})}(\theta)}\Big{)},\\\
\text{MCR}_{\theta}&=\frac{1}{R}\sum_{r=1}^{R}I\\{\hat{\theta}\in
95\%CP\\}.\\\ \end{split}$ (6)

The metrics are calculated across a set of replicates $r$, with $R$ being the
total number of these replicates (i.e., $R=100$). For MSD, $N_{iter}$ is the
number of iterations in the MCMC sampling and $p(\theta|\boldsymbol{y})$ is
the posterior density for $\theta$. For MCR, $I\\{\\}$ is the indicator
function with value 1 when $\hat{\theta}$ is within the $95\%$ coverage
probability ($95\%CP$). For time-varying state probabilities, the mean 24-hour
accumulated absolute bias is further evaluated, defined as,

$\text{MAB}_{P(S_{t})}=\frac{1}{R}\sum_{r=1}^{R}\sum_{t=1}^{T_{24h}}|\boldsymbol{\hat{P}(S_{t})}-\boldsymbol{P_{True}(S_{t})}|$
(7)

where $T_{24h}=288$ stands for a 24h period.

###  4.2 Simulation Results

In all scenarios, BCHMM generally outperforms CHMM in accurately identifying
the underlying hidden states (Figure 3 and Figure 4). Particularly, CHMM tends
to overestimate state means $\mu_{i}$ as mixing the hidden states 1 and 2 and
misclassifying state 2 as state 3, a pattern not seen in BCHMM estimates. This
overestimation becomes more severe as overlap increases in underlying Gaussian
distributions in scenarios 2 and 3, as evidenced by outliers in CHMM estimates
in Figure 3 boxplots. BCHMM also has smaller MAB compared to CHMM, especially
for states 1 and 2 (Table 3). Parameter estimates from BCHMM are also more
reliable and robust, with MABs less than 0.09 and the standard deviations on
the absolute bias below 0.08 across all states and scenarios (Table 3). Higher
values of Kullback-Leibler Divergence (KLD) indicate larger departures from
true values, as seen in CHMM. For example, the KLD for the estimated state 2
from CHMM is 0.76, considerably higher than the 0.251 for BCHMM (pink lines in
the middle panel in Figure 4).

Table 3: Comparison of accuracy on estimated parameters for BCHMM and CHMM from the simulation study. Results presented in the table are the MAB, and standard deviation of MAB in parentheses. | Scenario 1 | Scenario 2 | Scenario 3
---|---|---|---
Parameter |  BCHMM |  CHMM |  BCHMM |  CHMM |  BCHMM |  CHMM
$\mu_{1}$ |  0.033 (0.026) |  0.267 (0.749) |  0.056 (0.045) |  0.534 (0.997) |  0.040 (0.027) |  0.243 (0.687)
$\mu_{2}$ |  0.026 (0.020) |  0.451 (1.36) |  0.038 (0.024) |  0.925 (1.84) |  0.048 (0.038) |  0.392 (1.18)
$\mu_{3}$ |  0.021 (0.016) |  0.033 (0.060) |  0.032 (0.025) |  0.067 (0.103) |  0.044 (0.036) |  0.062 (0.084)
$\sigma^{2}_{1}$ |  0.033 (0.026) |  0.368 (1.06) |  0.075 (0.052) |  0.769 (1.44) |  0.044 (0.040) |  0.398 (1.20)
$\sigma^{2}_{2}$ |  0.028 (0.022) |  0.038 (0.046) |  0.055 (0.042) |  0.102 (0.233) |  0.108 (0.070) |  0.174 (0.389)
$\sigma^{2}_{3}$ |  0.018 (0.013) |  0.026 (0.036) |  0.048 (0.037) |  0.075 (0.086) |  0.098 (0.080) |  0.119 (0.129)
Figure 3: Comparison of estimated state means from BCHMM and CHMM. True values
are indicated in black dashed lines.

Figure 4: Estimated Gaussian emission densities from three hidden activity
states. Grey lines are true densities. Estimated densities are color-coded as
blue for state 1, pink for state 2 and red for state 3, one for each
replicate.

Regarding the state probabilities, BCHMM has a smaller median accumulated bias
(i.e. $\text{MAB}_{P(S_{t})}$) and less extreme bias compared to CHMM (Table 4
and Supplementary Figure S5). The range of $\text{MAB}_{P(S_{t})}$ is also
much narrower in BCHMM than in CHMM. True state 1 probabilities decrease from
midnight to 8 am and increase from 8 pm to midnight, remaining low throughout
the day. Yet, CHMM yields consistently higher estimates for state 1 throughout
the day, likely due to its overestimation of the state 1 mean. Conversely,
BCHMM recovers the true state better than CHMM, with less bias at each time
point across all states and scenarios. The median estimated state
probabilities from BCHMM (depicted by red solid lines) align more closely with
the true values (black solid line), with narrower coverage bands across all
100 replicates (see Supplementary Figures S4 (a), (c), and (e)).

Table 4: Comparison of 24-hour accumulated absolute bias on estimated state probabilities for BCHMM and CHMM. Results are summarized as the median (min, max) of the accumulated absolute bias defined in Equation (7). | Scenario 1 | Scenario 2 | Scenario 3
---|---|---|---
|  BCHMM |  CHMM |  BCHMM |  CHMM |  BCHMM |  CHMM
State 1 |  10.08 |  11.21 |  8.90 |  10.77 |  9.79 |  10.84
|  (1.74, 24.14) |  (2.63, 121.76) |  (1.20, 21.85) |  (1.01, 119.77) |  (2.60, 23.78) |  (3.08, 114.47)
State 2 |  17.36 |  18.69 |  16.55 |  18.18 |  16.87 |  17.80
|  (4.87, 32.57) |  (5.43, 94.06) |  (4.43, 32.39) |  (4.42, 119.63) |  (6.10, 31.38) |  (6.51, 85.17)
State 3 |  16.04 |  18.01 |  16.39 |  18.51 |  14.78 |  16.94
|  (3.92, 38.20) |  (5.04, 94.54) |  (5.42, 36.98) |  (4.60, 119.46) |  (3.87, 37.27) |  (3.61, 79.91)

##  5 Motivating Example Revisited

We now revisit the 2011-2014 NHANES motivating example introduced in Section 2
and apply the proposed BCHMM to the NHANES actigraphy dataset. Similar to the
approach adopted in Huang et al. (2018) and Li et al. (2020), we apply a
square-root transformation to the observed actigraphy data and assume three
hidden states of low-, moderate- and high-activity states. Weakly informative
priors are considered for other parameters, with $\mu_{i}\sim Gamma(1,1)$,
$\sigma_{i}^{2}\sim Inv\chi^{2}(2,0.5)$ and $\beta_{ij}\sim N(0,10)$.

In addition to the model parameters introduced in BCHMM earlier, we also
compare the derived rest-activity rhythm measures proposed by Huang et al.
(2018). We give a brief overview here but encourage interested readers to
refer to the original article. Our primary interest is the Rhythmic Index
(RI), a measure indicating overall rhythmicity on a scale from 0 with lower
values for worsened rhythmicity. RI is computed as,

$RI=\frac{24}{24-a}\Big{(}\frac{1}{a}\int_{t\in
I_{c}}P(S_{t}=1)dt-\frac{a}{24}\Big{)}$ (8)

where $S_{t}=1$ indicates the low-activity state and $I_{c}=[c-a/2,c+a/2]$
suggests the low-activity window under perfect rhythmicity. Here the gravity
center of the low-activity state window is denoted as $c$. The total amount of
rest, denoted as $a$, is estimated by the total length in the low-activity
state during a full day of 24-hour, and calculated as $\int_{t\in
T_{24hr}}P(S_{t}=1)dt$. We also fit the CHMM model to the motivating example
for comparison.

Figure 5 presents the estimated activity state means $\mu$s from the BCHMM and
CHMM. Each point corresponds to an individual participant, with estimates from
BCHMM and CHMM presented by the $X$ and $Y$ axes, respectively. Compared to
BCHMM, CHMM tends to overestimate the mean values of the hidden states, as
evidenced by points concentration on the top left corner above the diagonal
line. The extent to which CHMM overestimates the mean is particularly severe
for the low-activity state, consistent with the findings from the simulation
study that CHMM fails to distinguish the low- and moderate-activity hidden
states and hence overestimates the means. The estimated variance from CHMM is
also substantially larger than that from BCHMM (Supplementary Figure S6).

Figure 6 presents the estimated time-varying state probabilities from BCHMM,
comparing the participants with diabetes and those without. The distribution
of probabilities for the low-activity and high-activity states are compared by
4-hour segments over a 24-hour period. Differences between the two groups can
be clearly discernible in the non-overlapping, color-shaded areas, where blue
and yellow represent the diabetic and normal HbA1c groups, respectively.
Especially evident during the daytime (8 am-12 pm and 12-4pm), individuals
with diabetes (blue) demonstrate a higher likelihood of being in the low-
activity state and a lower likelihood of high-activity state compared to the
normal group (yellow). However, this trend is inverted during the nighttime
hours (0-4 am). In essence, the temporal patterns inferred from the time-
varying state probabilities suggest that individuals with diabetes tend to be
more active during the night and less active during the day compared to their
normal counterparts. On average, diabetic precipitants have a mean activity
count of 3.8 for the high-activity state, equivalent to 72.2 on the original
scale of 5-minute aggregation. This is significantly lower than the 4.05
observed for the normal group (82.0 on the 5-minute aggregation scale),
suggesting that individuals in the diabetic group are typically less active.
Report of additional parameters are summarized in Supplementary Table S3.

Figure 7 presents two examples of rest-activity profiles, which are
essentially three hidden-state probabilities in one 24 hour period from noon
(12 pm) to noon. Subject 1 has relatively higher low-activity state
probablities throughout the day, but lower during the resting period (0-8 am),
observed from the blue shaded area (left panel); while subject 2 has a more
concentrated blue shaded area, indicating uninterrupted resting period.
Moreover, subject 1 has a lower estimated RI of 0.24, i.e., worse overall
rhythmicity, while subject 2 has a higher RI of 0.88, i.e., better overall
rhythmicity. These profiles and derived measures (e.g., RI) are consistent
with directly observing from the raw actigraphy data (Figure 1), but are more
visually intuitive and quantitatively informative.

Figure 5: Comparison of estimated state means from BCHMM and CHMM on NHANES
subjects. BCHMM estimates are on $X$ axis while CHMM estimates on $Y$ axis,
with the solid dot symbols representing diabetics and the plus symbol
representing the normal HbA1c group. Figure 6: BCHMM-estimated state
probabilities by diabetic status over a 24-hour period, segmented into 4-hour
intervals (rows). For each time window, the figure compares the density
distributions in the low-activity state (left panel) and high-activity state
(right panel), color-coded by subjects with diabetes and normal HbA1C.

Figure 7: Example of the 24-hour rest-activity profile derived from BCHMM
estimates for two selected subjects in the 2011-2014 NHANES study. Blue, pink
and red areas represent the low-, moderate-, and high-activity state
probabilities, respectively.

The derived RAR measures also suggest substantial differences between
diabetics and the normal group, where on average, participants with diabetes
have significantly lower RI than the normal group (0.440 vs. 0.514, $p$-value
= 0.003)(Supplementary Table S3 and Figure S7). To further quantify the risk
of diabetes and the weakened RI, we categorize RI at 0.2 intervals and perform
a logistic regression on the diabetic status and RI categories, adjusting for
age, gender, weight status, and rest amount (RA) extracted from BCHMM fitting.
Weight status is defined by body mass index (BMI, $kg/m^{2}$): 18.5 and below
is classified as underweight, 18.5 - 24.9 as healthy weight, 25.0 - 29.9 as
overweight, and 30.0 and above as obese (Centers for Disease Control and
Prevention, 2022). Reference levels are normal HbA1c levels, gender of female,
normal weight status, best overall rhythmicity of RI $>$ 0.6 and a typical
amount of RA between 7 to 9 hours. Figure 8 presents the results from the
logistic regression. The likelihood of having diabetes, compared to normal
HbA1c, progressively increases with weakened rhythmicity of lower RI. The risk
of diabetes is much higher among participants with the lowest RI (0.2 and
lower), with an estimated odds ratio of 5.32 (95% CI, [1.83, 16.17]). This
result is consistent with existing studies that impaired RAR is strongly
associated with diabetic status and impaired glycemic control (Xiao et al.,
2021; Sohail et al., 2015), which applied the cosinor-based models
(Cornelissen, 2014) to evaluate the RAR. The advantage of our proposed model
lies in its capacity to probabilistically quantify the activity profile.
Consequently, it facilitates a more nuanced examination of the differences in
24-hour activity patterns between diabetic and non-diabetic groups.

Figure 8: Association between diabetic status and rest-activity rhythmicity.
Results of odds ratios are presented, estimated from the logistic regression
model, adjusting for age, gender, weight status characterized by BMI.
Increased odds of having diabetes versus normal HbA1c levels is monotonously
associated with lower values of RI, i.e., worse overall rhythmicity.

##  6 Discussion

In this analysis, we introduce a novel Bayesian non-homogeneous Hidden Markov
Model that integrates biological circadian rhythms to reflect the rest-
activity patterns of each individual. The Bayesian approach effectively
resolves the identification or label-switching problem often encountered with
frequency-based methods, thereby enhancing statistical inference, as
demonstrated in our comprehensive simulation study. We apply our model to
24-hour actigraphy data using 2011-2014 NHANES data to investigate the
relationship between rest-activity rhythms and the risk of diabetes. Our
proposed methodology reveals nuanced differences in rest-activity profiles
associated with diabetes risk that are unattainable with conventional analyses
for actigraphy data.

While 24-hour actigraphy data gains considerable popularity in recent years,
most analyses concentrate on movement classification. Few studies leverage
actigraphy data to comprehend rest-activity rhythms, which are central to our
objective. Compared to other methodologies, the Bayesian circadian Hidden
Markov model is more complex and demands specialized software for
implementation. To ease its adoption, we share our code to enable replication
of our analysis. Despite its complexity, the model we propose can better
capture the individual rest-activity profiles that other analytical approaches
can’t, which signifies a significant methodological advantage. Our proposed
BCHMM eases the assumption of a certain waveform of rest-activity patterns
that may not be applicable to any individual. Meanwhile, our approach offers
flexibility to handle missing data and study different rhythmic behaviors.
These derived rest-activity measures assess not only certain aspects of the
rhythms, as existing approaches commonly provide, but overall rhythmicity,
with clinical relevance and epidemiological interpretability. The robustness,
flexibility, and interpretability assure promising potential of our model to
be applied to broader epidemiological and clinical applications.

Our current model is applied to each individual, yielding personalized rest-
activity profiles. This approach is appropriate when sufficient data is
available, as in our motivating NHANES dataset, where each individual has
ample data to model their rest-activity profile. In addition, we choose to
model each person individually due to the inherent heterogeneity of actigraphy
data stemming from individual characteristics, disease status, and lifestyle
behaviors. However, when working with more limited actigraphy data—either in
terms of the number of 24-hour observations or the total number of subjects in
the study—a hierarchical Bayesian Hidden Markov model is more suitable,
allowing for cross-subject borrowing of rest-activity rhythms. This is our
planned research direction moving forward.

## References

  * Ancoli-Israel et al. (2003) Ancoli-Israel, S., Cole, R., Alessi, C., Chambers, M., Moorcroft, W. and Pollak, C. P. (2003) The role of actigraphy in the study of sleep and circadian rhythms.  Sleep: Journal of Sleep and Sleep Disorders Research, 26, 342–392.
  * Bernard et al. (2019) Bernard, J., Du Roy De Chaumaray, M., Marbac, M. and Navarro, F. (2019) Mixture of hidden markov models for pattern-recognition of accelerometer data.  In 51 èmes Journées de Statistique de la SFdS. Nancy, France.
  * Betancourt (2017) Betancourt, M. (2017) Identifying bayesian mixture models.  URL: https://betanalpha.github.io/assets/case_studies/identifying_mixture_models.html#1_mixture_models.
  * Betancourt (2018) — (2018) A conceptual introduction to hamiltonian monte carlo.  URL: https://arxiv.org/abs/1701.02434v2.
  * Blum et al. (2014) Blum, I. D., Zhu, L., Moquin, L., Kokoeva, M. V., Gratton, A., Giros, B. and Storch, K.-F. (2014) A highly tunable dopaminergic oscillator generates ultradian rhythms of behavioral arousal.  eLife, 3, e05105.
  * Bouguila et al. (2022) Bouguila, N., Fan, W. and Amayri, M. (eds.) (2022) Hidden markov models and applications.  Unsupervised and Semi-Supervised Learning. Springer Cham.
  * Celeux et al. (2000) Celeux, G., Hurn, M. and Robert, C. P. (2000) Computational and inferential difficulties with mixture posterior distributions.  Journal of the American Statistical Association, 95, 957–970.
  * Centers for Disease Control and Prevention (2022) Centers for Disease Control and Prevention (2022) All about adult bmi.  URL: https://www.cdc.gov/healthyweight/assessing/bmi/adult_bmi/index.html.
  * Chaumaray et al. (2020) Chaumaray, M. D. R. d., Marbac, M. and Navarro, F. (2020) Mixture of hidden markov models for accelerometer data.  The Annals of Applied Statistics, 14, 1834–1855.
  * Chen et al. (2016) Chen, Y., Shen, K., Shan, S.-O. and Kou, S. C. (2016) Analyzing single-molecule protein transportation experiments via hierarchical hidden markov models.  Journal of the American Statistical Association, 111, 951–966.
  * Cheng et al. (2021) Cheng, P., Walch, O., Huang, Y., Mayer, C., Sagong, C., Cuamatzi Castelan, A., Burgess, H. J., Roth, T., Forger, D. B. and Drake, C. L. (2021) Predicting circadian misalignment with wearable technology: validation of wrist-worn actigraphy and photometry in night shift workers.  Sleep, 44.
  * Cornelissen (2014) Cornelissen, G. (2014) Cosinor-based rhythmometry.  Theoretical Biology & Medical Modelling, 11, 16.
  * Figueiro et al. (2014) Figueiro, M. G., Plitnick, B. and Rea, M. S. (2014) The effects of chronotype, sleep schedule and light/dark pattern exposures on circadian phase.  Sleep Medicine, 15, 1554–1564.
  * Gales and Young (2007) Gales, M. and Young, S. (2007) The application of hidden markov models in speech recognition.  Foundations and Trends in Signal Processing, 1, 195–304.  URL: http://www.nowpublishers.com/article/Details/SIG-004.
  * Gelman et al. (2013) Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A. and Rubin, D. B. (2013) Bayesian data analysis.  Chapman and Hall/CRC, 3 edn.
  * Hadj-Amar et al. (2022) Hadj-Amar, B., Jewson, J. and Fiecas, M. (2022) Bayesian approximations to hidden semi-markov models for telemetric monitoring of physical activity.  URL: http://arxiv.org/abs/2006.09061.
  * Hobson and Pace-Schott (2002) Hobson, J. A. and Pace-Schott, E. F. (2002) The cognitive neuroscience of sleep: neuronal systems, consciousness and learning.  Nature Reviews Neuroscience, 3, 679–693.
  * Holsclaw et al. (2017) Holsclaw, T., Greene, A. M., Robertson, A. W. and Smyth, P. (2017) Bayesian nonhomogeneous markov models via pólya-gamma data augmentation with applications to rainfall modeling.  The Annals of Applied Statistics, 11, 393–426.
  * Huang et al. (2018) Huang, Q., Cohen, D., Komarzynski, S., Li, X.-M., Innominato, P., Lévi, F. and Finkenstädt, B. (2018) Hidden markov models for monitoring circadian rhythmicity in telemetric activity data.  Journal of The Royal Society Interface, 15, 20170885\.
  * John et al. (2019) John, D., Tang, Q., Albinali, F. and Intille, S. (2019) An open-source monitor-independent movement summary for accelerometer data processing.  Journal for the Measurement of Physical Behaviour, 2, 268–281.
  * Lamont and Amir (2010) Lamont, E. W. and Amir, S. (2010) Circadian and ultradian clocks/rhythms.  In Encyclopedia of Behavioral Neuroscience (eds. G. F. Koob, M. L. Moal and R. F. Thompson), 257–261. Oxford: Academic Press.
  * Li et al. (2021) Li, J., Somers, V. K., Lopez-Jimenez, F., Di, J. and Covassin, N. (2021) Demographic characteristics associated with circadian rest-activity rhythm patterns: a cross-sectional study.  The International Journal of Behavioral Nutrition and Physical Activity, 18, 107.
  * Li et al. (2020) Li, X., Zhang, Y., Jiang, F. and Zhao, H. (2020) A novel machine learning unsupervised algorithm for sleep/wake identification using actigraphy.  Chronobiology International, 37, 1002–1015.
  * Luo and Stephens (2021) Luo, Y. and Stephens, D. A. (2021) Bayesian inference for continuous-time hidden markov models with an unknown number of states.  Statistics and Computing, 31, 57.
  * Montaruli et al. (2021) Montaruli, A., Castelli, L., Mulè, A., Scurati, R., Esposito, F., Galasso, L. and Roveda, E. (2021) Biological rhythm and chronotype: new perspectives in health.  Biomolecules, 11, 487.
  * Mor et al. (2021) Mor, B., Garhwal, S. and Kumar, A. (2021) A systematic review of hidden markov models and their applications.  Archives of Computational Methods in Engineering, 28, 1429–1448.
  * Morris et al. (2012) Morris, C. J., Yang, J. N. and Scheer, F. A. J. L. (2012) The impact of the circadian timing system on cardiovascular and metabolic function.  Progress in Brain Research, 199, 337–358.
  * Murphy (2012) Murphy, K. P. (2012) Machine learning: a probabilistic perspective.  Adaptive computation and machine learning series. MIT Press.
  * Neal (2011) Neal, R. M. (2011) MCMC using hamiltonian dynamics.  Chapman and Hall / CRC Press.  URL: http://arxiv.org/abs/1206.1901.
  * Palta et al. (2017) Palta, P., Huang, E. S., Kalyani, R. R., Golden, S. H. and Yeh, H.-C. (2017) Hemoglobin a1c and mortality in older adults with and without diabetes: results from the national health and nutrition examination surveys (1988-2011).  Diabetes Care, 40, 453–460.
  * Pandi-Perumal et al. (2007) Pandi-Perumal, S. R., Smits, M., Spence, W., Srinivasan, V., Cardinali, D. P., Lowe, A. D. and Kayumov, L. (2007) Dim light melatonin onset (DLMO): a tool for the analysis of circadian phase in human sleep and chronobiological disorders.  Progress in Neuro-Psychopharmacology and Biological Psychiatry, 31, 1–11.
  * Pober et al. (2006) Pober, D. M., Staudenmayer, J., Raphael, C. and Freedson, P. S. (2006) Development of novel techniques to classify physical activity mode using accelerometers.  Medicine & Science in Sports & Exercise, 38, 1626–1634.
  * Richardson and Green (1997) Richardson, S. and Green, P. J. (1997) On bayesian analysis of mixtures with an unknown number of components (with discussion).  Journal of the Royal Statistical Society: Series B (Statistical Methodology), 59, 731–792.
  * Sohail et al. (2015) Sohail, S., Yu, L., Bennett, D. A., Buchman, A. S. and Lim, A. S. (2015) Irregular 24-hour activity rhythms and the metabolic syndrome in older adults.  Chronobiology international, 32, 802–813.
  * Stan Development Team (2023) Stan Development Team (2023) RStan: the R interface to Stan.  URL: https://mc-stan.org/.
  * Vehtari et al. (2021) Vehtari, A., Gelman, A., Simpson, D., Carpenter, B. and Bürkner, P.-C. (2021) Rank-Normalization, Folding, and Localization: An Improved Rˆ for Assessing Convergence of MCMC (with Discussion).  Bayesian Analysis, 16, 667–718.  Publisher: International Society for Bayesian Analysis.
  * Visser and Speekenbrink (2010) Visser, I. and Speekenbrink, M. (2010) depmixs4: an R package for hidden markov models.  Journal of Statistical Software, 36.
  * Wang et al. (2023) Wang, E. T., Chiang, S., Haneef, Z., Rao, V. R., Moss, R. and Vannucci, M. (2023) Bayesian non-homogeneous hidden markov model with variable selection for investigating drivers of seizure risk cycling.  The Annals of Applied Statistics, 17, 333–356.
  * Wiggin et al. (2020) Wiggin, T. D., Goodwin, P. R., Donelson, N. C., Liu, C., Trinh, K., Sanyal, S. and Griffith, L. C. (2020) Covert sleep-related biological processes are revealed by probabilistic analysis in drosophila.  Proceedings of the National Academy of Sciences, 117, 10024–10034.
  * Witowski et al. (2014) Witowski, V., Foraita, R., Pitsiladis, Y., Pigeot, I. and Wirsik, N. (2014) Using hidden markov models to improve quantifying physical activity in accelerometer data – a simulation study.  PLOS ONE, 9, e114089.
  * Xiao et al. (2022) Xiao, Q., Lu, J., Zeitzer, J. M., Matthews, C. E., Saint-Maurice, P. F. and Bauer, C. (2022) Rest-activity profiles among u.s. adults in a nationally representative sample: a functional principal component analysis.  The International Journal of Behavioral Nutrition and Physical Activity, 19, 32.
  * Xiao et al. (2021) Xiao, Q., Matthews, C. E., Playdon, M. and Bauer, C. (2021) The association between rest-activity rhythms and glycemic markers: the us national health and nutrition examination survey, 2011–2014.  Sleep, zsab291.
  * Xu et al. (2020) Xu, Z., Laber, E. B. and Staicu, A.-M. (2020) Hierarchical continuous time hidden markov model, with application in zero-inflated accelerometer data.  In Statistical Modeling in Biomedical Research: Contemporary Topics and Voices in the Field (eds. Y. Zhao and D.-G. D. Chen), Emerging Topics in Statistics and Biostatistics, 125–142. Cham: Springer International Publishing.
  * Zucchini et al. (2016) Zucchini, W., MacDonald, I. L. and Langrock, R. (2016) Hidden markov models for time series: an introduction using R.  Chapman and Hall/CRC, 2 edn.

Supplementary Material

##  S1 Approximation to Hidden Markov Models

#### Forward Algorithm

Inference on parameters in HMMs is obtained by maximum likelihood estimation.
With the unobserved hidden states, the marginal likelihood of the observations
is required, which can be written in a recursive form as follows,

$\begin{split}L(\boldsymbol{y}|\Theta)&=P(\boldsymbol{Y}=\boldsymbol{y})\\\
&=\sum_{S_{1},...,S_{T}=1}^{m}P(\boldsymbol{Y}=\boldsymbol{y},\boldsymbol{S}=\boldsymbol{s})\\\
&=\sum_{S_{1},...,S_{T}=1}^{m}\Bigg{\\{}P(S_{1}=s_{1})\prod_{t=2}^{T}{P(S_{t}=s_{t}|S_{t-1}=s_{t-1})}\prod_{t=1}^{T}{P(Y_{t}=y_{t}|S_{t}=s_{t})}\Bigg{\\}}\\\
&={\delta_{s_{1}}f(y_{1}|s_{1})\gamma_{1,s_{1}s_{2}}f(y_{2}|s_{2})\gamma_{2,s_{2}s_{3}}...\gamma_{T-1,s_{T-1}s_{T}}f(y_{T}|s_{T})}\\\
&=\boldsymbol{\delta}\boldsymbol{P}(y_{1})\Gamma_{1}\boldsymbol{P}(y_{2})\Gamma_{2}\boldsymbol{P}(y_{3})...\Gamma_{T-1}\boldsymbol{P}(y_{T})\boldsymbol{1}^{{}^{\prime}}\\\
\end{split}$ (S1)

where $\boldsymbol{y}=(y_{1},y_{2},...,y_{T})$ is the observation sequence,
$\boldsymbol{s}=(s_{1},s_{2},...,s_{T})$ is the state sequence, and
$\boldsymbol{P}(y_{t})=\Big{(}f(y_{t}|S_{t}=j)\Big{)}^{{}^{\prime}}$.

The maximization of marginal likelihood can be realized using the Forward
algorithm. It adopts a so-called predict-update cycle to sequentially
determine hidden states that optimize marginal likelihoods. Denote the
marginal probability at time $t$ as $\boldsymbol{\alpha_{t}}=p(s_{t}|y_{1:t})$
which is a $m\times 1$ vector, where $y_{1:t}$ are observations up to the
current time point $t$. The j-th element of $\boldsymbol{\alpha_{t}}$ can be
calculated as,

$\alpha_{t}(j)\propto
f(y_{t}|S_{t}=j)\boldsymbol{\gamma}_{t-1,.j}^{{}^{\prime}}\boldsymbol{\alpha_{t-1}}\\\
$ (S2)

where $f(y_{t}|S_{t}=j)$ is the emission probability that represents the local
evidence at current time point $t$,
$\boldsymbol{\gamma}_{t-1,.j}^{{}^{\prime}}$ is the transition probabilities
from any state to the $j$-th state, and $\boldsymbol{\alpha_{t-1}}$ is the
forward probabilities at the previous time point that represents belif state
(Murphy, 2012). In depmixS4, the expectation-maximization (EM) algorithm is
employed to estimate the unconstrained models, and direct optimization of a
general Newton-Raphson optimizer is used to for models with general linear or
non-linear constraints (Visser and Speekenbrink, 2010; Zucchini et al., 2016).
In Stan, the forward probabilities are handled in logarithms as

$\begin{split}\text{log}\big{\\{}\alpha_{t}(j)\big{\\}}&=\text{log}\Big{\\{}\sum_{i=1}^{m}p(y_{t}|s_{t}=j)\gamma_{ij}\alpha_{t-1}(i)\Big{\\}}\\\
&=\text{log}\Big{\\{}\sum_{i=1}^{m}exp\big{[}log(p(y_{t}|s_{t}=j))+\text{log}(\gamma_{ij})+\text{log}(\alpha_{t-1}(i))\big{]}\Big{\\}}\\\
\end{split}$ (S3)

##  S2 Additional Results from the Simulation Study

###  S2.1 Circadian Coefficients

In the simulation, we assume three hidden states (i.e., $m=3$) which give a
$3\times 3$ transition probabilities at each time point $t$ as

$\Gamma_{t}=\left(\begin{array}[]{ccc}\gamma_{t,11}&\gamma_{t,12}&\gamma_{t,13}\\\
\gamma_{t,21}&\gamma_{t,22}&\gamma_{t,23}\\\
\gamma_{t,31}&\gamma_{t,32}&\gamma_{t,33}\\\ \end{array}\right)\\\
=\left(\begin{array}[]{ccc}\frac{\text{exp}(\eta_{t,11})}{\sum_{s=1}^{m}\text{exp}(\eta_{t,1s})}&\frac{\text{exp}(\eta_{t,12})}{\sum_{s=1}^{m}\text{exp}(\eta_{t,1s})}&\frac{\text{exp}(\eta_{t,13})}{\sum_{s=1}^{m}\text{exp}(\eta_{t,1s})}\\\
\frac{\text{exp}(\eta_{t,21})}{\sum_{s=1}^{m}\text{exp}(\eta_{t,2s})}&\frac{\text{exp}(\eta_{t,22})}{\sum_{s=1}^{m}\text{exp}(\eta_{t,2s})}&\frac{\text{exp}(\eta_{t,23})}{\sum_{s=1}^{m}\text{exp}(\eta_{t,2s})}\\\
\frac{\text{exp}(\eta_{t,31})}{\sum_{s=1}^{m}\text{exp}(\eta_{t,3s})}&\frac{\text{exp}(\eta_{t,32})}{\sum_{s=1}^{m}\text{exp}(\eta_{t,3s})}&\frac{\text{exp}(\eta_{t,33})}{\sum_{s=1}^{m}\text{exp}(\eta_{t,3s})}\\\
\end{array}\right)$

We assume one pair of circadian oscillators of $\cos(\frac{2\pi t}{24})$ and
$\sin(\frac{2\pi t}{24})$, denoted as $\cos_{t}$ and $\sin_{t}$ to ease the
notation. Hence, $\eta_{t,ij},i\neq j$ is a linear combination of circadian
oscillators at time $t$, and circadian coefficients of $\beta_{ij}$ that
explicitly associate with the transition from state $i$ to state $j$, which
can be expressed as

$\left(\begin{array}[]{ccc}\eta_{t,i1}&\eta_{t,i2}&\eta_{t,i3}\\\
\end{array}\right)=\left(\begin{array}[]{ccc}1&\cos_{t}&\sin_{t}\\\
\end{array}\right)\left(\begin{array}[]{ccc}\beta_{0,i1}&\beta_{0,i2}&\beta_{0,i3}\\\
\beta_{1,i1}&\beta_{1,i2}&\beta_{1,i3}\\\
\beta_{2,i1}&\beta_{2,i2}&\beta_{2,i3}\\\ \end{array}\right)$

We impose $\boldsymbol{\beta_{ii}}=\boldsymbol{0}$ to ensure parameter
identifiability of $\eta_{t,ij}$ as stated in the main text Section 3. This
leads to assigning values to a set of eighteen coefficients (3 transit-out
states $\times$ 2 independent transit-in states $\times$ 3 coefficients for
each pair of transitions) for all $\boldsymbol{\beta_{ij}},i\neq j$. The true
values of the circadian coefficients used in the simulation study are listed
in Table S1. These values are informed by the 2011-2014 NHANES actigraphy data
that served as our motivating example. The resulting time-varying state
probabilities conform to the patterns observed in the real data. Specifically,
the probabilities in low-activity (state 1) should be higher during the
nighttime and lower during the daytime, and the probabilities in the high-
activity (state 3) should be higher during the daytime and lower during the
nighttime. These state probabilities are illustrated in Figure S4 (a), (c) and
(e) as the black dashed lines.

Table S1: True values used for the circadian coefficients in the simulation study. Hidden State $j$ | low-activity | moderate-activity | high-activity
---|---|---|---
|  $j$=1 |  $j$=2 |  $j$=3
$\beta_{0,1j}$ | 0 | -1.89 | -7.27
$\beta_{1,1j}$ | 0 | 0.04 | -0.08
$\beta_{2,1j}$ | 0 | 0.17 | 3.40
$\beta_{0,2j}$ | -4.13 | 0 | -2.78
$\beta_{1,2j}$ | 0.11 | 0 | 0.25
$\beta_{2,2j}$ | -2.96 | 0 | 0.85
$\beta_{0,3j}$ | -8.42 | -2.86 | 0
$\beta_{1,3j}$ | -1.07 | 0.04 | 0
$\beta_{2,3j}$ | -2.59 | -0.94 | 0

###  S2.2 Additional Results from the Proposed BCHMM in the Simulation Study

We use the posterior median for all parameters from BCHMM and model
performance evaluation metrics described in main text Equation (6) and (7).
The results, presented in Table S2, show that BCHMM has desirable performance
in correctly estimating the distributional parameters and most circadian
coefficients. This is evidenced by the smaller values of MAB, MMSE, and MSD.
Furthermore, the MCRs for the mean and variance parameters are predominantly
above 95% across all simulation scenarios.

Table S2: Evaluation of the parameter estimation from BCHMM. | Scenario 1 | Scenario 2 | Scenario 3
---|---|---|---
Parameter |  MAB† |  MMSE‡ |  MSD§ |  MCR§§ |  MAB |  MMSE |  MSD |  MCR |  MAB |  MMSE |  MSD |  MCR
$\mu_{1}$ |  0.033 |  0.002 |  0.042 |  95% |  0.056 |  0.005 |  0.062 |  91% |  0.040 |  0.002 |  0.048 |  98%
$\mu_{2}$ |  0.026 |  0.001 |  0.032 |  93% |  0.038 |  0.002 |  0.047 |  97% |  0.048 |  0.004 |  0.063 |  96%
$\mu_{3}$ |  0.021 |  0.001 |  0.028 |  95% |  0.032 |  0.002 |  0.039 |  96% |  0.044 |  0.003 |  0.059 |  95%
$\sigma^{2}_{1}$ |  0.033 |  0.002 |  0.044 |  93% |  0.075 |  0.008 |  0.092 |  97% |  0.044 |  0.003 |  0.055 |  95%
$\sigma^{2}_{2}$ |  0.027 |  0.001 |  0.033 |  92% |  0.055 |  0.005 |  0.069 |  95% |  0.106 |  0.016 |  0.125 |  96%
$\sigma^{2}_{3}$ |  0.018 |  0.000 |  0.028 |  99% |  0.048 |  0.004 |  0.056 |  92% |  0.098 |  0.016 |  0.128 |  94%
$\beta_{0,12}$ |  0.479 |  0.449 |  0.632 |  97% |  0.482 |  0.447 |  0.632 |  94% |  0.505 |  0.414 |  0.676 |  94%
$\beta_{1,12}$ |  0.301 |  0.135 |  0.360 |  95% |  0.289 |  0.153 |  0.374 |  94% |  0.324 |  0.195 |  0.387 |  92%
$\beta_{2,12}$ |  0.606 |  0.690 |  0.761 |  97% |  0.601 |  0.691 |  0.762 |  93% |  0.601 |  0.579 |  0.808 |  97%
$\beta_{0,13}$ |  5.217 |  31.088 |  5.723 |  98% |  5.425 |  33.331 |  5.666 |  100% |  4.842 |  27.126 |  5.711 |  100%
$\beta_{1,13}$ |  1.117 |  2.101 |  5.912 |  100% |  0.936 |  1.272 |  5.901 |  100% |  1.251 |  2.682 |  5.862 |  100%
$\beta_{2,13}$ |  1.597 |  4.024 |  7.337 |  100% |  1.361 |  4.297 |  7.299 |  99% |  1.877 |  5.682 |  7.425 |  100%
$\beta_{0,21}$ |  0.479 |  0.365 |  0.554 |  95% |  0.489 |  0.419 |  0.582 |  92% |  0.441 |  0.348 |  0.601 |  95%
$\beta_{1,21}$ |  0.295 |  0.133 |  0.335 |  94% |  0.291 |  0.132 |  0.349 |  89% |  0.261 |  0.111 |  0.354 |  96%
$\beta_{2,21}$ |  0.568 |  0.523 |  0.678 |  95% |  0.585 |  0.572 |  0.715 |  94% |  0.524 |  0.488 |  0.732 |  95%
$\beta_{0,23}$ |  0.173 |  0.053 |  0.224 |  94% |  0.191 |  0.068 |  0.225 |  91% |  0.176 |  0.052 |  0.229 |  96%
$\beta_{1,23}$ |  0.214 |  0.078 |  0.275 |  93% |  0.241 |  0.087 |  0.278 |  92% |  0.248 |  0.094 |  0.284 |  93%
$\beta_{2,23}$ |  0.323 |  0.187 |  0.353 |  92% |  0.291 |  0.122 |  0.351 |  94% |  0.246 |  0.101 |  0.356 |  98%
$\beta_{0,31}$ |  6.514 |  48.237 |  4.888 |  82% |  6.875 |  51.165 |  5.063 |  91% |  6.507 |  46.993 |  5.009 |  91%
$\beta_{1,31}$ |  1.158 |  3.087 |  5.254 |  97% |  0.982 |  2.133 |  5.486 |  100% |  1.204 |  3.083 |  5.446 |  100%
$\beta_{2,31}$ |  1.801 |  3.948 |  5.477 |  100% |  1.727 |  3.934 |  5.757 |  99% |  1.712 |  4.056 |  5.593 |  99%
$\beta_{0,32}$ |  0.204 |  0.061 |  0.236 |  97% |  0.204 |  0.067 |  0.236 |  91% |  0.187 |  0.061 |  0.242 |  91%
$\beta_{1,32}$ |  0.220 |  0.077 |  0.296 |  94% |  0.248 |  0.098 |  0.296 |  93% |  0.254 |  0.115 |  0.305 |  91%
$\beta_{2,32}$ |  0.265 |  0.112 |  0.344 |  94% |  0.285 |  0.125 |  0.348 |  96% |  0.250 |  0.108 |  0.348 |  95%
Definition of the following evaluation metrics can be found in Equation 6.
†Mean absolute bias.
‡Mean of mean squared error.
§Mean of posterior standard deviation.
§§Mean of coverage rate.

###  S2.3 Examples of MCMC Diagnostic Plots

Figures S1 and S2 present the trace plots of one replicate under simulation
scenario 3. The results indicate that two MCMC chains mixed well.

Figure S1: Example trace plots for means and variances from one replicate
under simulation scenario 3. Figure S2: Example trace plots for circadian
coefficients from one replicate under simulation scenario 3.

###  S2.4 Comparison between BCHMM and CHMM on the Emission Distributions

In the main text, we present the estimated means of the hidden states from
both BCHMM and CHMM. We provide additional results comparing BCHMM and CHMM in
the simulation study. Figure S3 shows the bias of the estimated state
variances (i.e., $\sigma^{2}_{i})$ from these two approaches across the 100
replicates in the simulation study. BCHMM has noticeably more precise
estimates than CHMM. The exceptionally high estimated variances from CHMM are
likely due to its inability to distinguish low and moderate activity states
and over-estimation of the mean value in the low activity state (state 1).

Figure S3: Comparison of estimated state variances from BCHMM and CHMM. True
values are indicated in black dashed lines.

###  S2.5 Comparison between BCHMM and CHMM on the Time-varying State
Probabilities

Figure S4 presents the estimated time-varying state probabilities for a 24-h
period, compared to the true values (black dashed lines). As shown in Figures
S4 (a, c, e), BCHMM remains high accuracy and precision in recovering the true
values, with median estimates (red solid lines) closely following the true
values (black dashed lines) and narrower 95% coverage band (red shaded area).
On the other hand, CHMM substantially overestimates the state means,
particularly for state 1, as seen from a wider 95% coverage band above true
values (Figures S4 (a, c, e)) and the bias from estimates to true state
probabilities significantly above zero (Figures S4 (b, d, f)). We also
evaluate accumulated absolute bias for state probabilities presented in Figure
S5. CHMM, in comparison to BCHMM, tends to demonstrate a higher average
accumulated absolute bias and more extreme values.

(a) Scenario 1, Estimated state probabilities

(b) Scenario 1, Bias on estimates versus true

(c) Scenario 2, Estimated state probabilities

(d) Scenario 2, Bias on estimates versus true

(e) Scenario 3, Estimated state probabilities

(f) Scenario 3, Bias on estimates versus true

Figure S4: Estimated time-varying state probabilities $\hat{P}(S_{t})$
(Equation (5)) and bias (calculated as the estimated value minus true, i.e.,
$\hat{P}(S_{t})-P_{True}(S_{t})$) from the simulation study. Figures on the
left two columns present true state probabilities (black dashed line), median
estimates (red solid line) and 95% coverage band (lower 2.5% and upper 97.5%
estimates) across 100 replicates. Figures on the right two columns present
median bias (red solid line) and 95% coverage band across 100 replicates.
BCHMM generates less biased estimates (more aligned red solid line and black
dashed line on the left panels) and more precise estimates with narrower 95%
coverage. Figure S5: 24-hour accumulated absolute bias.

##  S3 Additional Results Comparing BCHMM and CHMM on the NHANES Data

We apply both BCHMM and CHMM to the analytical samples derived from 2011-2014
NHANES actigraphy dataset, and compare the estimates from both methods. In the
main text, we discuss that CHMM tends to overestimate state means,
particularly for the low-activity state (i.e., state 1). This overestimation
leads to higher variance estimation of the low-activity state in CHMM compared
to BCHMM, as seen in the leftmost panel in Figure S6. Comparison of model
parameters and rest-activity rhythm measures (Huang et al., 2018) by the
normal and diabetic groups, are presented in Table S3 and Figure S7. Both
models show that compared to the normal HbA1C group, the diabetic group
exhibits significantly lower mean values in the high-activity states (i.e.,
$\mu_{3}$) and rhythm indices (RIs), indicating that individuals with diabetes
are not only less active but also exhibit worse rest-activity rhythms.
However, CHMM also identifies a significant difference in moderate-activity
means between the two groups, which is not found in BCHMM. We also perform the
logistic regression model on the diabetic status and rest-activity rhythm
measures as discussed in the main text Section 5 with CHMM estimates. While
the overall conclusion that worsened overall rhythmicity, indicated by lower
RI values, is associated with a higher likelihood of diabetes risk remains
similar, the correlation is less pronounced by the CHMM. The odds ratios of
diabetes risk associated with weakened RI are 1.46, 2.49, 5.32 with BCHMM,
versus 1.85, 3.36, and 3.86 with CHMM. In conclusion, BCHMM offers more
precise estimates, potentially highlighting and clarifying the associations
between rest-activity rhythm measures and relevant health outcomes more
effectively.

Figure S6: Comparison of estimated state variances from BCHMM and CHMM on NHANES participants. BCHMM estimates are on $X$ axis while CHMM estimates on $Y$ axis. The solid dots represent participants with diabetes while plus symbol represents the group with normal HbA1c. Figure S7: Comparison of estimated rhythmic index from BCHMM and CHMM on NHANES participants. BCHMM estimates are on $X$ axis while CHMM estimates on $Y$ axis. The solid dots represent participants with diabetes while plus symbol represents the group with normal HbA1c. Table S3: Comparison of estimated parameters from BCHMM and CHMM on NHANES sample. | BCHMM | CHMM
---|---|---
| Diabetics | Normal |  $P$-value† | Diabetics | Normal |  $P$-value†
State Mean, Mean (SD) |  |  |
Low-activity | 0.270 (0.215) | 0.294 (0.225) | 0.387 | 0.369 (0.202) | 0.372 (0.210) | 0.906
Moderate-activity | 1.73 (0.860) | 1.90 (0.832) | 0.104 | 1.97 (0.729) | 2.16 (0.707) | 0.0301
High-activity | 3.80 (0.701) | 4.05 (0.658) | 0.004 | 3.93 (0.662) | 4.19 (0.627) | 0.001
RI, Mean (SD) | 0.440 (0.209) | 0.514 (0.190) | 0.003 | 0.496 (0.204) | 0.575 (0.185) | 0.001
RI Category, N(%) |  |  |
$<$ 0.2 | 13 (13.0%) | 11 (5.5%) | 0.006 | 8 (8.0%) | 8 (4.0%) | 0.004
0.2 - 0.4 | 32 (32.0%) | 42 (21.0%) |  | 25 (25.0%) | 26 (13.0%) |
0.4 - 0.6 | 33 (33.0%) | 76 (38.0%) |  | 34 (34.0%) | 62 (31.0%) |
$>$ 0.6 | 22 (22.0%) | 71 (35.5%) |  | 33 (33.0%) | 104 (52.0%) |
RA, Mean (SD) | 6.10 (2.21) | 6.28 (2.04) | 0.482 | 6.89 (1.94) | 6.98 (1.84) | 0.703
RA Category, N(%) |  |  |
$<$ 5 hr | 38 (38.0%) | 62 (31.0%) | 0.609 | 22 (22.0%) | 29 (14.5%) | 0.373
5 - 7 hr | 31 (31.0%) | 73 (36.5%) |  | 27 (27.0%) | 67 (33.5%) |
7 - 9 hr | 22 (22.0%) | 43 (21.5%) |  | 38 (38.0%) | 78 (39.0%) |
$>$ 9 hr | 9 (9.0%) | 22 (11.0%) |  | 13 (13.0%) | 26 (13.0%) |
†Two sample $t$-tests or $\chi^{2}$ tests are used to test the difference on
estimated values of parameters between diabetes and normal HbA1c groups.
Figure S8: Association between diabetic status and rest-activity rhythmicity
using CHMM estimates. Results of odds ratios are presented, estimated from the
logistic regression model, adjusting for age, gender, weight status
characterized by BMI. Increased odds of having diabetes versus normal HbA1c
levels is monotonously associated with lower values of RI, i.e., worse overall
rhythmicity.