Skip to contents

Plot derived area under the curves from a model fitted by egg_model().

Usage

plot_egg_aucs(
  fit,
  period = c(0, 0.5, 1.5, 3.5, 6.5, 10, 12, 17),
  knots = c(1, 8, 12)
)

Arguments

fit

A model object from a statistical model such as from a call to egg_model().

period

The intervals knots on which AUCs are to be computed.

knots

The knots as defined fit and according to method.

Value

A patchwork ggplot2 object.

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_aucs(
  fit = res,
  period = c(0, 0.5, 1.5, 3.5, 6.5, 10, 12, 17)
)