predict_bmi | R Documentation |
Predict BMI values a cubic splines mixed model regression
with three splines parametrisation as random effect.
This function also works for any model obtained using time_model()
.
predict_bmi(fit, start = 0.25, end = 10, step = 0.01, filter = NULL)
fit |
A model object from a statistical model
such as from a call |
start |
The start of the time window to compute AP and AR. |
end |
The end of the time window to compute AP and AR. |
step |
The step to increment the sequence. |
filter |
A string following |
A data.table
object.
data("bmigrowth")
res <- egg_model(
formula = log(bmi) ~ age,
data = bmigrowth[bmigrowth[["sex"]] == 0, ],
id_var = "ID",
random_complexity = 1
)
predict_bmi(res)[]
## For multiple sources of measures or multiple measures at one age
set.seed(1234)
dta <- bmigrowth[bmigrowth[["sex"]] == 0, ]
dta[["source"]] <- c("A", "B")[rbinom(n = nrow(dta), size = 1, prob = 0.65) + 1]
res <- egg_model(
formula = log(bmi) ~ age + source,
data = dta,
id_var = "ID",
random_complexity = 1
)
predict_bmi(res)[order(egg_id, egg_ageyears)]
predict_bmi(res, filter = "source == 'A'")[order(egg_id, egg_ageyears)]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.