brokenstick 0.62.1 (May 2020) have a substantially changed interface. In particular, later versions (starting with
brokenstick 0.70.0) include the following changes:
brokenstick adopts the
tidymodels philosophy. It is now possible to fit a model using four different interfaces. There is no need anymore the hardcode variable names in the source data.
0.70.0 introduces a new estimation method, the Kasim-Raudenbush sampler. The new method is more flexible and faster than
lme4::lmer() when the number of knots is large.
0.70.0 introduces two simple correlation models that may be used to smooth out the variance-covariance matrix of the random effects.
The definition of the
brokenstick class has changed. Objects of class
brokenstick do no longer store the training data.
brokenstick_export class is retired.
predict() function is fully rewritten as has now a new interface. Since the
brokenstick class does not store the training data anymore, the
predict() function now obtains a
new_data argument. Syntax that worked for
brokenstick package before
0.70.0 does not work anymore and should be updated. The
shape argument replaces the
plot() function is rewritten, and now requires a
We recommend changing your code to reflect the above changes. If needed, the old version
0.62.1 can be installed as
Fit model, old version:
Fit model, version
0.75.0 and higher:
data <- brokenstick::smocc_200 # formula interface fit1 <- brokenstick(hgt.z ~ age | id, data) # XY interface - numeric vector fit2 <- with(data, brokenstick(age, hgt.z, id)) # XY interface - data.frame fit3 <- with(data, brokenstick(data.frame(age), hgt.z, id)) # XY interface - matrix tt <- as.matrix(data[, c(1, 2, 7)]) fit4 <- brokenstick(tt[, "age", drop = FALSE], tt[, "hgt.z", drop = FALSE], tt[, "id", drop = FALSE])
All fitted models are identical.
Predict model, old version:
Predict model, new version:
Plot trajectories, old version
Plot trajectories, new version
Proportion explained variance, old version
brokenstick()for model fitting
predict()for trajectory plotting