  Sleep behaviour and in-bed movements contain rich information on the
neurophysiological health of people, and have a direct link to the general
well-being and quality of life. Standard clinical practices rely on
polysomnography for sleep assessment; however, it is intrusive, performed in
unfamiliar environments and requires trained personnel. Progress has been made
on less invasive sensor technologies, such as actigraphy, but clinical
validation raises concerns over their reliability and precision. Additionally,
the field lacks a widely acceptable algorithm, with proposed approaches ranging
from raw signal or feature thresholding to data-hungry classification models,
many of which are unfamiliar to medical staff. This paper proposes an online
Bayesian probabilistic framework for objective (in)activity detection and
segmentation based on clinically meaningful joint kinematics, measured by a
custom-made wearable sensor. Intuitive three-dimensional visualisations of
kinematic timeseries were accomplished through dimension reduction based
preprocessing, offering out-of-the-box framework explainability potentially
useful for clinical monitoring and diagnosis. The proposed framework attained
up to 99.2\% $F_1$-score and 0.96 Pearson's correlation coefficient in,
respectively, the posture change detection and inactivity segmentation tasks.
The work paves the way for a reliable home-based analysis of movements during
sleep which would serve patient-centred longitudinal care plans.
