-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.Rmd
98 lines (67 loc) · 5.07 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
output: github_document
always_allow_html: yes
bibliography: [vignettes/manual/ref.bib]
biblio-style: apalike
link-citations: yes
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# brokenstick
<!-- badges: start -->
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/brokenstick)](https://cran.r-project.org/package=brokenstick)
[![](https://img.shields.io/badge/github%20version-2.5.0-orange.svg)](https://growthcharts.org/brokenstick/)
<!-- badges: end -->
The broken stick model describes a set of individual curves by a linear mixed model using second-order linear B-splines. The main use of the model is to align irregularly observed data to a user-specified grid of break ages.
All fitting can done in the Z-score scale, so nonlinearities and irregular data can be treated as separate problems. This package contains functions for fitting a broken stick model to data, for exporting the parameters of the model for independent use outside this package, and for predicting broken stick curves for new data.
## Installation
Install the `brokenstick` package from CRAN as follows:
```{r eval = FALSE}
install.packages("brokenstick")
```
The latest version (revision branch) can be installed from GitHub as follows:
```{r eval = FALSE}
install.packages("remotes")
remotes::install_github("growthcharts/brokenstick")
```
## Overview
The *broken stick model* describes a set of individual curves by a linear mixed model using linear B-splines. The model can be used
- to smooth growth curves by a series of connected straight lines;
- to align irregularly observed curves to a common age grid;
- to create synthetic curves at a user-specified set of break ages;
- to estimate the time-to-time correlation matrix;
- to predict future observations.
The user specifies a set of break ages at which the straight lines connect. Each individual obtains an estimate at each break age, so the set of estimates of the individual form a smoothed version of the observed trajectory.
The main assumptions of the broken stick model are:
- The trajectory between the break ages follows a straight line, and is generally not of particular interest;
- Broken stick estimates follow a common multivariate normal distribution;
- Missing data are missing at random (MAR);
- Individuals are exchangeable and uncorrelated.
In order to conform to the assumption of multivariate normality, the user may fit the broken stick model on suitably transformed data that yield the standard normal ($Z$) scale. Unique feature of the broken stick model are:
- *Modular*: Issues related to non-linearity of the growth curves in the observed scale can be treated separately, i.e., outside the broken stick model;
- *Local*: A given data point will contribute only to the estimates corresponding to the closest break ages;
- *Exportable*: The broken stick model can be exported and reused for prediction for new data in alternative computing environments.
The `brokenstick` package contains functions for
- Fitting the broken stick model to data,
- Plotting individual trajectories,
- Predicting broken stick estimates for new data.
## Resources
### Background
1. I took the name *broken stick* from @ruppert2003, page 59-61, but it is actually much older.
2. As far as I know, @dekroon2010 is the first publication that uses the broken stick model without the intercept in a mixed modelling context. See [The Terneuzen birth cohort: BMI changes between 2 and 6 years correlate strongest with adult overweight](https://stefvanbuuren.name/publications/2010%20TBC%20Overweight%20-%20PLoS%20ONE.pdf).
3. The model was formally defined and extended in [Flexible Imputation of Missing Data (second edition)](https://stefvanbuuren.name/fimd/sec-rastering.html#sec:brokenstick). See @vanbuuren2018.
4. The evaluation by @anderson2019 concluded:
>> We recommend the use of the brokenstick model with standardised Z‐score data. Aside from the accuracy of the fit, another key advantage of the brokenstick model is that it is easier to fit and provides easily interpretable estimates of child growth trajectories.
### Instructive materials
- Publication: S. van Buuren (2023), Broken Stick Model for Irregular Longitudinal Data. *Journal of Statistical Software*, 106(7), 1--51. [doi:10.18637/jss.v106.i07](https://doi.org/10.18637/jss.v106.i07), [html version](https://growthcharts.org/brokenstick/articles/manual/manual.html);
- [Companion site](https://growthcharts.org/brokenstick/) contains vignettes and articles that explain the model and the use of the software.
### Acknowledgment
This work was supported by the Bill & Melinda Gates Foundation. The contents are the sole responsibility of the authors and may not necessarily represent the official views of the Bill & Melinda Gates Foundation or other agencies that may have supported the primary data studies used in the present study.
### References