Skip to contents

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.


The brokenstick package contains functions for fitting a broken stick model to data, for predicting broken stick curves for new data, and for plotting the results.


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.

brokenstick functions

The main functions are:

brokenstick()Fit a broken stick model to irregular data
plot()Plot observed and fitted trajectories by group
predict()Obtain predictions on new data
summary()Extract object summaries

The following functions are user-oriented helpers:

coef()Extract estimated parameters
fitted()Calculate fitted values
get_knots()Obtain the knots from a broken stick model
get_omega()Extract variance-covariance of random effects
get_r2()Obtain proportion of explained variance
model.frame()Extract model frame
model.matrix()Extract design matrix
residuals()Extract residuals from broken stick model

The following functions perform calculations:

set_control()Set controls to steer calculations
control_kr()Set controls for the kr method


van Buuren, S. (2023). Broken Stick Model for Irregular Longitudinal Data. Journal of Statistical Software, 106(7), 1--51. doi:10.18637/jss.v106.i07

van Buuren, S. (2018). Flexible Imputation of Missing Data. Second Edition. Chapman & Hall/CRC. Chapter 11.