Plot derived slopes from a model fitted by egg_model()
.
Source: R/plot_egg_slopes.R
plot_egg_slopes.Rd
Plot derived slopes from a model fitted by egg_model()
.
Arguments
- fit
A model object from a statistical model such as from a call to
egg_model()
.- period
The intervals knots on which slopes are to be computed.
- knots
The knots as defined
fit
and according tomethod
.
Examples
library(ggplot2)
library(eggla)
data("bmigrowth")
res <- egg_model(
formula = log(bmi) ~ age,
data = bmigrowth[bmigrowth[["sex"]] == 0, ],
id_var = "ID",
random_complexity = 1
)
#> Fitting model:
#> nlme::lme(
#> fixed = log(bmi) ~ gsp(age, knots = c(1, 8, 12), degree = rep(3, 4), smooth = rep(2, 3)),
#> data = data,
#> random = ~ gsp(age, knots = c(1, 8, 12), degree = rep(1, 4), smooth = rep(2, 3)) | ID,
#> na.action = stats::na.omit,
#> method = "ML",
#> control = nlme::lmeControl(opt = "optim", niterEM = 25, maxIter = 500, msMaxIter = 500)
#> )
plot_egg_slopes(
fit = res,
period = c(0, 0.5, 1.5, 3.5, 6.5, 10, 12, 17)
)
#> Warning: log-10 transformation introduced infinite values.