Learn R Programming

⚠️There's a newer version (2.6.0) of this package.Take me there.

brokenstick

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

The brokenstick package can be installed from GitHub as follows:

install.packages("remotes")
remotes::install_github("growthcharts/brokenstick")

There is currently no CRAN version.

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 Ruppert, Wand, and Carroll (2003), page 59-61, but it is actually much older.
  2. As far as I know, de Kroon et al. (2010) 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.
  3. The model was formally defined and extended in Flexible Imputation of Missing Data (second edition). See van Buuren (2018).
  4. The evaluation by Anderson et al. (2019) 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

  • Companion site contains vignettes and articles that explain the model and the use of the software;
  • Paper in preparation: Broken Stick Model for Irregular Longitudinal Data: pdf, html.

References

Anderson, C., R. Hafen, O. Sofrygin, L. Ryan, and HBGDki Community. 2019. “Comparing Predictive Abilities of Longitudinal Child Growth Models.” Statistics in Medicine 38 (19): 3555–70.

de Kroon, M. L. A., C. M. Renders, J. P. van Wouwe, S. van Buuren, and R. A. Hirasing. 2010. “The Terneuzen Birth Cohort: BMI Changes Between 2 and 6 Years Correlate Strongest with Adult Overweight.” PloS ONE 5 (2): e9155.

Ruppert, D., M. P. Wand, and R. J. Carroll. 2003. Semiparametric Regression. Cambridge: Cambridge University Press.

van Buuren, S. 2018. Flexible Imputation of Missing Data. Second Edition. Boca Raton, FL.: CRC Press.

Copy Link

Version

Install

install.packages('brokenstick')

Monthly Downloads

372

Version

1.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Stef van Buuren

Last Published

November 2nd, 2020

Functions in brokenstick (1.1.0)

EB

Empirical Bayes predictor for random effects
fitted.brokenstick

Calculate fitted values
get_r2

Obtain proportion of explained variance from a broken stick model
brokenstick

Fit a brokenstick model to irregular data
get_knots

Obtain the knots from a broken stick model
control_brokenstick

Set controls to steer calculations
brokenstick-pkg

brokenstick: A package for irregular longitudinal data.
fit_200

Broken stick model with nine lines for 200 children
brokenstick-class

Class brokenstick
control_kr

Set controls for Kasim-Raudenbush sampler
weightloss

Weight loss self-measurement data
kr

Kasim-Raudenbush sampler for two-level normal model
plot.brokenstick

Plot observed and fitted trajectories by group
parse_formula

Parse formula for brokenstick model
residuals.brokenstick

Extract residuals from brokenstick model
make_basis

Create linear splines basis
smocc_200

Infant growth of 0-2 years, SMOCC data extract
plot_trajectory

Plot observed and fitted trajectories from fitted brokenstick model
predict.brokenstick

Predict from a brokenstick model