growthcharts / brokenstick Goto Github PK
View Code? Open in Web Editor NEWBroken Stick Model for Irregular Longitudinal Data
Home Page: https://growthcharts.org/brokenstick
License: Other
Broken Stick Model for Irregular Longitudinal Data
Home Page: https://growthcharts.org/brokenstick
License: Other
When not specified, the default left boundary knot is calculated as the minimum age in the data. The left boundary knot may then become lower than knots[1]
. Consequences are:
lmer()
may remove x1
from the analysis with fit warnings: fixed-effect model matrix is rank deficient so dropping 1 column
plot(fit, ...)
may fail with Error in X %*% beta : non-conformable arguments
The problem can be circumvented by manually specifying the boundary
argument so that knots[1] == boundary[1]
, but in general this is unwanted behaviour.
Actions to take:
brokenstick()
should be programmed in a way to ensure that knots[1] == boundary[1]
, so that fit warning does not occur.plot(fit, ...)
should test for knots[1] == boundary[1]
, and exit gracefully.How do I add more than two predictors : 1) Age 2) BMI in the brokenstick model and how do I ensure that the knots function is only for Age variable and not BMI ? Thanks.
There are some intricate undeclared dependencies I need to sort out. I uninstalled tibble, lazyeval, brokenstick, rbokeh and wash, and could then successfully run
install.packages("devtools")
library("devtools")
Sys.setenv(GITHUB_PAT = "your-key-here")
install.packages("tibble")
devtools::install_github("stefvanbuuren/brokenstick")
The default setting in for the Boundary.knots
argument of brokenstick()
(2.5.0) ignores the data in the last, rightmost observation in a specific situation.
The default Boundary.knots
are set as follows (from the JSS paper):
These conditions require that
Boundary.knots
span at least the range of the data. This requirement is easy to achieve by settingBoundary.knots = range(data$age)
, which is done by default. Also, we need to ensure that the range of knots is not outsideBoundary.knots
. We may achieve that by settingBoundary.knots
to include at leastrange(knots)
.
Somewhat unexpectedly, the current version ignores the data from the last knot if these show no age variation (i.e. if all observations are made at the same time). This may occur when the data have been pre-arranged or rounded into waves.
A quick solution is to manually set the right boundary
knot slightly higher than the last knot value. For example, if the knots = c(0, ..., 10)
then set boundary = c(0, 11)
.
Ideally, the procedure should test for this case, and adapt the default.
Dear Stef,
I have an issue with trying to plot multiply imputed trajectories based on the brokenstick model. I get the following error message
Error in FUN(X[[i]], ...) : object 'hgt_z' not found
which I think is related to this code chunk from plot_trajectory()
where you refer to "hgt_z" which is named differently in my analysis.
k <- data$.source == "imputed" if (any(k)) { g <- g + ggplot2::geom_line(ggplot2::aes_string(group = ".imp"), data = data[k, ], color = color_imp[2L]) + ggplot2::geom_point(ggplot2::aes_string(y = "**hgt_z**"), data = data[k, ], color = color_imp[1L], size = size_imp) }
If I rename my outcome variable to hgt_z
everything works fine.
Kind regards
Ben
Stef,
I am looking for some additional child height and weight data for other countries that I could use in an introductory data science class. Do you happen to have any leads to additional public data?
Here is the one you describe in the package.
Longitudinal height and weight measurements during ages 0-2 years for a representative sample of 1933 Dutch children born in 1988-1989. The dataset smocc_hgtwgt is a subset of the full data covering the first 206 children.
Thanks,
J.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.