Introduction
Chronic pain is defined as a pain that carries on for longer than several months (3 to 6) even with medication or treatment (Institute of Medicine (US) Committee on Advancing Pain Research, Care, and Education 2011). Chronic pain is known to be a debilitating public health issue that affects over 100 million individuals in the United States. Individuals who experience chronic pain often have to miss work, costing up to 12.7 billion dollars a year and the total cost is estimated to be around $600 billion dollars a year (Institute of Medicine (US) Committee on Advancing Pain Research, Care, and Education 2011; Smith & Hillner 2019). With approximately 25 million American adults suffering from chronic pain on a daily basis, pain has emerged as one of the most common reasons for seeking medical attention (Nahin 2015). Chronic pain is often a sensory experience with feelings of unpleasant emotion. Often, the experience is characterized as aversive and displays a range of behavior changes in response: facial changes, gait, and postural adjustments (Morley 2008). These changes can be extended to other physical and psychological issues such as sleep disturbances, anxiety, and depression and reduced physical activity (Vlaeyen, Crombez, & Liesbet 2007). Although the reduction in physical activity is common for those with chronic pain, it leads to even greater disability from immobility and muscular atrophy (Parker et al., 2017). Despite its prevalence, chronic pain is not always accurately reported. The current method of diagnosing pain with self-reports has proven insufficient, especially in patients who may be unable to self report due to cognitive, developmental, or physiological issues (i.e., Parkinson’s Disease with both speech and tremor impairment) (Herr et al. 2011).
There is established theoretical and empirical evidence to suggest that chronic pain affects physical movement. Several studies have observed reduced physical activity in patients with chronic pain (Spenkelink et al. 2002; van den Berg-Emons et al. 2007). Often, continued physical activity is important to increasing quality of life and limit the progression of certain conditions, such as depression (Grunberg et al. 2022). Hence, the reduction in physical activity due to chronic pain can interfere with movement through a variety of factors including: pain-related fear, motor adaptation to pain, and sensory dysfunction (difficulty with processing sense information in the brain), and others (Crombez et al. 1999; Hodges et al 2013; Moseley, Gallagher, & Gallace 2012; Vlaeyen et al. 1995). However, these symptoms are usually only monitored through subjective patient self-reports. Previous research has aimed to address this gap by using actigraphy data to derive biomarkers of pain severity and chronicity in individuals with HIV (Jacobson & O’Cleirigh 2021). Additionally, actigraphy data has been used to compare physical activity levels in adolescents with and without chronic pain (Long, Palermo, & Manees 2007). The sample size in both of these previous studies was around 50, which limits the generalizability of these findings. Additionally, there is a lack of research centering around the potential for predicting chronic pain based on changes and differences in physical activity, independent of other comorbidities or age categories. The current method of subjective pain assessment requires extensive time and cost from both patients and care providers (Insel 2017). Thus, developing objective biomarkers of chronic pain would prove valuable in both offsetting the burden of self-report assessment, as well as potentially enhancing pain management by avoiding limitations of self-reports.
In this study, we proposed a pain-specific approach, where we examined movement with passive actigraphy data to assist in chronic pain prediction. The established literature suggests that objective biomarkers related to activity can be monitored through wearable sensors, and that digital biomarkers can be used to predict symptoms of pain severity and chronicity (Jacobson & O’Cleirigh 2021; Long, Palermo, & Manees 2007). Extending on the previous literature, we used actigraphy to relate activity to chronic pain in participants. Movement data collected using actigraphy has been used in multiple studies examining chronic pain through passive data, especially using sleep patterns, with limited research focused on movement intensity as a pain predictor (Chung & Tso 2010; Fisher et al. 2018; Jacobson & O’Cleirigh 2021; Lunde et al. 2010). Additionally, machine learning (ML) methods can be applied to actigraphy data along with established chronic pain self-reports, contributing to predictive models for chronic pain outcomes. Such models have previously been used to examine pain-related symptoms through actigraphy (Jacobson & O’Cleirigh 2021). However, our approach aimed to make use of detective models to describe the relationship between physical activity and chronic pain specifically, directly detecting chronic pain rather than pain symptoms. Furthermore, the longitudinal data collected by wearable devices would allow for nuanced pain detection and monitoring, which has the potential to extend to clinical interventions.
Through analyzing the longitudinal accelerometer data and pain questionnaire responses in the existing NHANES dataset, our study aimed to map the relationship between movement and pain through digital wearable data captured in daily life, by using both deep learning models and traditional statistical methods. We hypothesized that individuals with chronic pain would exhibit lower physical activity intensity. Physical activity is generally reduced in chronic pain patients, indicating activity intensity as a potential behavior which pain prediction can be studied by ML.
Methods
An NHANES data sample, which collected data on both actigraphy and chronic pain was used to examine the association between passively collected data and pain measurements. The data was then preprocessed and cleaned, where eventually a long short term memory model was applied to the data and chronic pain was predicted from actigraphy data.
Study Design
The 2003–2004 sample is the only NHANES sample to include both actigraphy data and a pain questionnaire. Therefore, we selected the NHANES 2003–2004 data sample for analysis with a cross-sectional study design. Prior to the NHANES data collection, participants gave written informed consent and followed Strengthening the Reporting of Observational Studies in Epidemiology (STROBE) guidelines.
Participants
A NHANES nationally representative sample from 2003–2004 of 4,240 participants was utilized, where we excluded those who did not have complete hip accelerometer data and did not have a complete pain questionnaire. The average age was 49.57 years (20.08–84.92 years) and the subset contained 2,194 females (51.75%) and 2,046 males (48.25%). The data was collected through the NHANES program, where participants were randomly sampled and recruited throughout the United States.
Measures
Actigraph
The movement intensity data was collected each minute over 7 days with a hip mounted ActiGraph AM-7164 piezoelectric accelerometer. The ActiGraph AM-7164 is a uniaxial accelerometer that measures acceleration vertically in count units (Kozey et al. 2010).
NHANES dataset
To investigate diversely sampled longitudinal data, we utilized a sample from the National Health and Nutrition Examination (NHANES) survey, which is known to combine interviews and physical examinations of adults and children throughout the United States each year. Many data measures are collected via mobile centers including dietary and physical information, in addition to other measures collected such as wrist or hip worn accelerometers worn over the course of a week (Centers for Disease Control and Prevention. NHANES – National Health and Nutrition Examination Survey Homepage 2023).
Chronic Pain
The miscellaneous pain questionnaire was completed during participant home interviews, where a researcher inquired about the frequency and intensity of participants’ pain. In Heinz, Price, & Ruan (2022), the status of participant medication was coded as binary, building off this premise we used the definition of chronic pain to code the pain status as binary for each participant. Chronic pain was defined and then coded as binary as participants who experienced pain for longer than three months (1) or less than three months (0). The outcome variable was the chronic pain (binary outcome of less than or greater than 3 months) and the exposure variable was the actigraphy movement intensity data.
Data Preprocessing
An artifact correction algorithm was applied to the data, where abnormally high intensity count values of greater than 10,000 were replaced with an average of neighboring count values. This artifact correction algorithm was derived from the accelerometry artifact package, which is based on the National Cancer Institute’s SAS programs for processing NHANES data (Domelen 2018). As done previously in Rahman and Adjeroh 2019, we filtered the data and then reshaped it, where each participants’ data was turned into a one dimensional array of 10,080 minutes (1 minute epochs over 7 days) to a three dimensional array for each of the seven days (7 days by 60 minutes by 24 hours). Next, as Heinz, Price, & Ruan (2022), a Savitzky-Golay filter, a polynomial smoothing filter, was applied to reduce noise (Figure 1). Finally, the data was standardized using a min-max scalar.

Figure 1
Data Processing with Artifact Correction Algorithm and Savgol Filter.
A schematic of the activity over a week for a participant is shown, where each participant was selected as a chronic pain participant (n = 688) or non-chronic pain participant (n = 3552). The data was then processed using an artifact correction algorithm, smoothed using a Savgal-Golay filter and standardized with a min-max scalar, which resulted in an overall reduction in noise.
Data Splitting
We approached data splitting with a cross validation approach to ensure valid model prediction and reduce overfitting. The cross validation shuffles and splits the dataset into ten groups, runs both validation and test sets, and averages model performance. We then used this ten-fold cross validation approach to model the pain and actigraphy data. The binary outcome of chronic pain (i.e., presence or absence of chronic pain) included unbalanced classes, where the class of 688 with chronic pain was less than the class of 3552 without chronic pain. In order to balance the differences between the two classes, we applied stratified kFold in the sklearn Python package. The stratified kFold helped to minimize the possibility of learning bias and enforced more of a penalty for poor chronic pain predictions (Heinz, Price, & Ruan 2022; Wegier & Ksieniewicz 2020).
Model Processing Pipeline
To optimize both analysis of longitudinal data, as done in LSTM learning, and pattern recognition, as done in CNN models, we selected the combination of the two models: a convolutional long short term memory model. A convolutional long short term memory model allows for processing and predictions given sequential data. We selected this model to encode the time series actigraphy data and chronic pain outcomes because it is able to extract information spatially and temporally optimally compared to other ANN models (Rahman & Adjeroh 2019; Lee & Kim 2022).
Our data was reshaped as shown by Rahman and Adjeroh (2019), where each participant’s data was reshaped from a one-dimensional array of 10,080 minutes to an array for each of the seven days. The convolutional long short term memory model included two convolutional long short term two- dimensional layers. In each layer, we tuned a number of different kernel sizes (first layer size = five, second layer size = two) and activation functions (both layers = relu) and chose the ones that maximized sensitivity and specificity. Both layers had the same makeup of a dropout rate of 0.4 and size of 100. The dropout rate and layer size was chosen based on running the convolutional LSTM model and finding the optimal inputs that maximized predictability of chronic pain. We began the process of convolutional LSTM dropout tuning with 0.7 and reduced it by 0.1 each tune session, the value of 0.4 minimized overfitting and maximized predictability (Figure 2).

Figure 2
Convolutional Long Short-Term Memory (LSTM) Model Diagram.
A diagram of the data processing for the convolutional LSTM model is provided in Figure 2. The data (model input in figure) was shaped into a 7 day by 24 hour (y-axis) by 60 minute (x-axis) for each participant. These seven daily activity logs were then fed into the Conv LSTM layers and into dense layers to make a final model prediction.
Results
Baseline Information
In our NHANES 2003–2004 sample, there were a total of 4,240 participants included in analysis with 688 who had chronic pain and 3,552 who did not have chronic pain. Further information about the demographics of the participants in the NHANES 2003–2004 sample who had valid data for the pain questionnaire and actigraphy data is further described in Table 1. The sample included an average age of 49.57 years and standard deviation of 18.37 years. Of the participants selected that had chronic pain, there were 278 male (40.4%) and 410 (59.6%) females. In those that did not have chronic pain, there were 1768 (49.77%) males and 1784 (50.23%) females. The chronic pain and no chronic pain samples had no statistically significant difference under t-test demographic results.
Table 1
Sociodemographic information from the NHANES 2003–2004 cohort with Physical Activity and Chronic Pain data.
| NO CHRONIC PAIN | CHRONIC PAIN | |
|---|---|---|
| Race and Ethnicity | ||
| Mexican American | 776 | 97 |
| Other Hispanic | 114 | 9 |
| Non-Hispanic White | 1817 | 436 |
| Non-Hispanic Black | 697 | 116 |
| Other Race-Including Multi-Racial | 148 | 30 |
| Gender | ||
| Male | 1768 | 278 |
| Female | 1784 | 410 |
| Age | ||
| <20 | 0 | 0 |
| 20–30 | 701 | 63 |
| 30–40 | 577 | 113 |
| 40–50 | 573 | 126 |
| 50–60 | 411 | 124 |
| 60–70 | 534 | 135 |
| 70–84 | 591 | 101 |
| >85 | 0 | 0 |
Model Performance Metrics
The Conv-LSTM model fit to physical activity and chronic pain data showed moderate performance. The receiver operating characteristic curve (AUC) plots the false positive rate vs the true positive rate over a number of different classification thresholds (Figure 3).The AUC output was calculated for both the validation and test sets of the Conv-LSTM model. The validation set had a mean AUC of 0.60 (95% CI: 0.59–0.61), while the test set had a mean AUC of 0.57 (95% CI: 0.56–0.57) (Table 2). The model performance when comparing the validation and test sets showed similar outcomes, where the sets had high negative predictive values and low positive predictive values. The validation and test set outcomes suggest modest predictive performance that was significantly better than chance.

Figure 3
AUC Curve of False Positive vs False Negative Rate. AUC, Area Under the Curve.
The AUC curve represents the interaction between sensitivity and 1-specificity to show the overall predictability of the model (AUC val = 0.60, AUC test = 0.57).
Physical Activity Intensity and Chronic Pain
After the physical activity intensity was analyzed for the week in which participants wore the accelerometer, the chronic pain average physical activity intensity at 124.09 (95% CI: 112.58–135.59) counts per minute was lower than those who did not have chronic pain at 152.29 (95% CI: 147.87–156.72) counts per minute.
Discussion
Our study was focused around using physical activity levels captured with actigraphy to detect chronic pain using deep learning models (LSTM). The results indicated associations between the presence of chronic pain and physical activity intensity. There was overall lower activity intensity across seven days in individuals with chronic pain, which further supports a movement phenotype marking chronic pain. These results extend the ability to change the current state of chronic pain assessment, which currently depends almost entirely on self-reports. Self-reports often face issues of accuracy and accessibility (Herr et al. 2011). There is a need for a more objective and accessible measure of pain, therefore we used passive accelerometer data and traditional self-reported chronic pain data from the NHANES study to assess chronic pain in natural settings. The moderately predictability of chronic pain from actigraph data (AUC Validation = 0.60, AUC test = 0.57) gives hope for working toward more approachable and unbiased measurements of pain.
We observed lower activity intensity across seven days in individuals with chronic pain. This is in line with the kinesiophobia theory of pain-related movement, which suggests that fear of pain and re-injury may be more disabling than pain itself (Crombez et al. 1999; Kori 1990). Additionally, physiological changes such as sleep problems, circadian rhythms, and physical activity levels are often observed in individuals with chronic pain (Abeler et al. 2021; Atkinson et al. 1988; Hodges et al. 2013). Harnessing these trends, our assessment of objective actigraphy data found marked differences in individuals with and without chronic pain. Previous literature has also assessed the association of chronic pain and physical activity levels in adolescents and knee osteoarthritis patients, and found a similar relationship between chronic pain and physical activity levels (Long, Palermo, & Manees 2007; Rahman & Adjeroh 2019). Our study had a much larger sample size, as well as more diversity in age and comorbidities, yet still found a similar association between chronic pain and physical activity intensity.
Our study suggested that physical activity intensity is moderately predictive of chronic pain, which extends on previous studies predicting pain from actigraph data (AUC Validation = 0.60, AUC test = 0.57). The model only performed moderately well, likely due to the data collection protocol. The given dataset only had one questionnaire that assessed the intensity of the chronic pain. In the future, if the dataset had taken regular measurements of the pain intensity levels each day or each hour, we could have a better understanding of the relationship between chronic pain and physical activity. Additionally, it was unclear how participants’ baseline activity levels changed due to chronic pain. In future studies, adjusting for frequent pain intensity measures and baseline physical activity levels would likely increase model performance. Other studies have been able to identify chronic pain with higher AUC tests and validation. In Sarwar et al. (2022) which included a sample size of fifty two subjects, chronic pain was predicted with sleep, rest activity rhythm, and physical activity (AUC-ROC = .97). Our study found a moderately predictive pain level through only utilizing physical activity data in a larger, more diverse sample. In the future, it would be interesting to combine our methods which included a diverse population and physical activity data with the sleep and rest activity data utilized in the Sarwar et al. paper to find an optimal algorithm.
Previous research efforts have relied on both self-reported and actigraphy data, while we relied solely on actigraphy data (Abeler et al. 2021; Lunde et al. 2010). Circadian rhythms have also been linked to chronic pain using actigraphy; one machine learning study found evidence that rest-activity rhythms could predict chronic pain (Sarwar et al. 2022). However, there is a notable lack of literature that uses physical activity levels to predict pain. Most physical activity studies with actigraphy tend to assess or measure physical activity levels, supporting the effect that chronic pain has on physical activity but failing to address its predictive potential (Kichline et al. 2019; Long, Palermo, & Manees 2007; Wilson & Palermo 2012). Thus, our findings demonstrate the value of passively collected data for the investigation and characterization of chronic pain and its impact on physical activity. Our results point to the importance of future research efforts centered around understanding the relationship between chronic pain and movement. These research efforts could utilize wearable devices for finding pain symptom triggers and even inform the development of wearable devices for chronic pain detection and management.
This study has several important limitations to keep in mind. First, pain was assessed in the NHANES through personal interviews. The 2003–2004 NHANES collected pain data through the Miscellaneous Pain Questionnaire; as such, the results may not reflect current measures of pain and do not capture factors of pain severity or intensity. Additionally, the questionnaire asked for pain measurements for up to three months back. There is potential for recall bias in participants, as they may not remember the exact onset date of their pain symptoms. The NHANES featured a cross-sectional design itself, with no real-time measurements for chronic pain. As the only pain data collected were the measurements taken at the beginning of the study, its design complicates the link between the longitudinal actigraphy data we analyzed. However, it is unlikely that there were major changes in pain rates since data collection. Finally, our results demonstrate detection, not causation—our study design and the Conv-LSTM model cannot be used to establish a causal relationship between physical activity and chronic pain. Future work should focus on conducting studies that monitor both pain and physical activity longitudinally, with updated measures of chronic pain.
Conclusion
Our study found that physical activity intensity can serve as a biomarker of chronic pain. Through utilizing naturalistic passive sensing data to examine this relationship, our results demonstrated lower physical activity intensity among those who experienced chronic pain compared with those who did not. Additionally, we found that participants’ chronic pain could be predicted with daily actigraphy movement intensity (AUC validation = .60, AUC test = 0.57). These findings support the utility of passive data collection for the objective assessment of chronic pain, providing grounds for the future development of monitoring chronic pain with physical activity. To increase model effectiveness, future studies could include more frequent pain intensity measurements and monitor participants over an extended length of time.
Funding Information
This work was partially funded by the National Institute of Mental Health (NIMH) and the National Institute Of General Medical Sciences (NIGMS) under 1 R01 MH123482-01, as well as the National Institute on Drug Abuse under P30 DA029926.
Competing Interests
The authors have no competing interests to declare.
