# Influence of Posture and Sleep Duration on Heart Rate Variability in Older Subjects
## 2 Materials and Methods
### Data Collection  
Continuous 24 h ECG and three-axis accelerometer data were collected using a Holter ECG recorder (pico 303, Suzuken Co., Ltd., Nagoya, Japan). The sampling frequency for ECG-derived RR intervals (RRIs) was set at 125 Hz, while the sampling frequency for accelerometer data was 31.25 Hz.  
The device has a built-in non-volatile memory that does not require a backup battery, and it records 24 h ECG signals as well as 3D acceleration information. A button battery (CR2032) is already attached to the back of the device, and attaching the back cover puts the device in recording standby mode, so it is easy to attach. It records 3 channels (CH) with 3 electrodes. With the standard electrode placement, where they are attached to the upper right chest, left subclavian, and left lower rib, there are the following functions:  
CH1: CM5 induction = V5 equivalent;CH2: NASA induction = V1 induction, which makes it easy to see the P wave;  
CH3: Auxiliary induction = used when the pico main unit's fixed electrode is missing (difference potential between CH1 and CH2).  
With a three-axis accelerometer, physical activity levels and sleep patterns were assessed using accelerometer data recorded simultaneously with ECG data. The sleep duration was estimated based on the periods of minimal physical activity, as determined by validated accelerometer thresholds. The three-axis accelerometer within the device allowed for posture estimation by calculating the roll, pitch, and yaw angles. This was achieved by leveraging the property that, under static conditions, the accelerometer primarily detects gravitational acceleration. The sensor outputs a vector aligned with the reaction force direction, enabling estimation of the body's orientation relative to gravity. The fundamental principle behind accelerometer-based posture detection is that, irrespective of the object's orientation, the gravitational direction serves as a constant reference point. Using this reference, the current posture can be deduced. This method enabled the accurate analysis of body position and movement states during data collection. All devices were calibrated prior to use to ensure the reliability of the collected data, which served as the foundation for analyzing the relationship between heart rate variability and sleep duration among older adults.  
If we define the vector of the sensor coordinate system output by the acceleration sensor as (\(a_{x},a_{y},a_{z}\)), and the rotation angles of roll, pitch and yaw that rotate this into the global coordinate system as (\(r,p,y\)), the result of the rotation is always facing the sky in the global coordinate system, so we can express it as (0, 0, \(g\)) when we take the acceleration of gravity. If we consider each of these vectors as a matrix, we can express them using the following formula, together with the rotation matrix:  
\[Rz(y)Ry(p)Rx(r)\begin{bmatrix}a_{x}\\ a_{y}\\ a_{z}\end{bmatrix}=\begin{bmatrix}0\\ 0\\ g\end{bmatrix} \tag{1}\]  
In order to obtain the rotation matrix (Equation (2)), which is a composite of the three rotations, the final rotation can be obtained by multiplying the rotation matrix in order (Equations (3)-(5)). Each rotation matrix indicates the rotation about the rotation axis.  
\[R=Rz(y)\cdot Ry(p)\cdot Rx(r) \tag{2}\]  
Roll (\(r\)): Rotation around the X-axis (front-back axis)  
\[Rx(r)=\begin{pmatrix}1&0&0\\ 0&\cos(r)&-\sin(r)\\ 0&\sin(r)&\cos(r)\end{pmatrix} \tag{3}\]  
Pitch (\(p\)): Rotation around the Y-axis (left-right axis)  
\[Ry(p)=\begin{pmatrix}\cos(p)&0&\sin(p)\\ 0&1&0\\ -\sin(p)&0&\cos(p)\end{pmatrix} \tag{4}\]  
Yaw (\(y\)): Rotation around the Z-axis (up-and-down axis)  
\[Rz(y)=\begin{pmatrix}\cos(y)&-\sin(y)&0\\ \sin(y)&\cos(y)&0\\ 0&0&1\end{pmatrix} \tag{5}\]