UK Biobank Analysis Code
R Analysis Code
LPA and MVPA analysis
Code for all analysis in the article examining the associations of LPA and MVPA with mortality (Luo, Clare et al 2025).
| Description | R Code |
|---|---|
| 1 - Data extraction and cleaning. | Data cleaning |
| 2 - Finalise data in preparation for imputation. | Finalise data |
| 3 - Multiple imputation - impute intermittent missing data | Imputation |
| 4 - Final data creation - finalise imputed data and structure for analysis | Finalise data |
| 5 - Evaluate number of degrees of freedom for splines. | Model fit |
| 6 - Fit best performing model based on model fit tests. | Final models |
| 7 - Create primary analysis plots using ggplot2. | Primary figures |
| 8 - Create sensitivity analysis plots using ggplot2. | Sensitivity figures |
| 9 - Estimate relative effects (RRs and RDs) from primary analysis. | Relative results |
| 10 - Create relative effect plots. | Relative results figures |
| 11 - Stratified analysis by sex and age group. | Age and sex |
| 12 - Relative effects for specific counterfactual scenarios. | Scenarios |