Skip to contents

Derived areas under the curve (AUCs) for differentintervals based on a fitted cubic splines mixed-effects model from egg_model(). This function is a specific version of compute_aucs designed to work specifically on egg_model().

Usage

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 data.frame with AUC for each individuals/samples.

Examples

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)
#>   )
head(
  egg_aucs(
    fit = res,
    period = c(0, 0.5, 1.5, 3.5, 6.5, 10, 12, 17),
    knots = c(1, 8, 12)
  )
)
#>      ID auc_0--0.5 auc_1.5--3.5 auc_6.5--10 auc_12--17
#> 001 001   1.449505     5.991573    11.68926   18.61057
#> 004 004   1.368861     5.691437    11.26439   18.15945
#> 005 005   1.376442     5.733387    11.38980   18.41934
#> 006 006   1.326633     5.480013    10.70427   17.06404
#> 007 007   1.389835     5.947658    12.48345   21.09766
#> 009 009   1.374043     5.643367    10.87259   17.12197