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 main functions are:
brokenstick() |
Fit a broken stick model to irregular data |
predict() |
Obtain predictions on new data |
plot() |
Plot observed and fitted trajectories by group |
The following functions are user-oriented helpers:
fitted() |
Calculate fitted values |
get_knots() |
Obtain the knots from a broken stick model |
get_r2() |
Obtain proportion of explained variance |
residuals() |
Extract residuals from broken stick model |
The following functions perform the calculations:
control_brokenstick() |
Set controls to steer calculations |
EB() |
Empirical Bayes predictor for random effects |
kr() |
Kasim-Raudenbush sampler for two-level normal model |
make_basis() |
Create linear splines basis |
The package follows the tidymodels
conventions
https://tidymodels.github.io/model-implementation-principles/.
For example, training data are not stored in the modelling object and
calculated variables are named after the convention. The
package architecture borrows important ideas from the hardhat
package.(Vaughan, 2020)
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.
van Buuren, S. (2018). Flexible Imputation of Missing Data. Second Edition. Chapman & Hall/CRC. Chapter 11. https://stefvanbuuren.name/fimd/sec-rastering.html#sec:brokenstick
Vaughan, D. and Kuhn, M. (2020). hardhat: Construct Modeling Packages. R package version 0.1.4. https://CRAN.R-project.org/package=hardhat