Compute the derived parameters correlations from a cubic splines mixed-effects model by time_model()
.
Source: R/compute_correlations.R
compute_correlations.Rd
Based on computed area under the curves (i.e., compute_aucs()
)
and slopes (i.e., compute_slopes()
) for several intervals using
a model fitted by time_model()
, compute the correlations between
each intervals derived parameters.
Arguments
- fit
A model object from a statistical model such as from a call to
time_model()
.- method
The type of model provided in
fit
, i.e., one of"cubic_slope"
,"linear_splines"
or"cubic_splines"
.- period
The intervals knots on which AUCs are to be computed.
- knots
The knots as defined
fit
and according tomethod
.
Examples
data("bmigrowth")
ls_mod <- time_model(
x = "age",
y = "log(bmi)",
cov = NULL,
data = bmigrowth[bmigrowth[["sex"]] == 0, ],
method = "linear_splines"
)
#> nlme::lme(
#> fixed = log(bmi) ~ gsp(age, knots = c(0.75, 5.5, 11), degree = rep(1, 4), smooth = rep(0, 3)),
#> data = data,
#> random = ~ gsp(age, knots = c(0.75, 5.5, 11), degree = rep(1, 4), smooth = rep(0, 3)) | ID,
#> na.action = stats::na.omit,
#> method = "ML",
#> control = nlme::lmeControl(opt = "optim", maxIter = 500, msMaxIter = 500)
#> )
compute_correlations(
fit = ls_mod,
method = "linear_splines",
period = c(0, 0.5, 1.5, 3.5, 6.5, 10, 12, 17)#,
# knots = list(
# "cubic_slope" = NULL,
# "linear_splines" = c(0.75, 5.5, 11),
# "cubic_splines" = c(1, 8, 12)
# )[[method]]
)
#> $AUC
#> term auc_0--0.5 auc_1.5--3.5 auc_6.5--10 auc_12--17
#> <char> <num> <num> <num> <num>
#> 1: auc_0--0.5 1.00000000 0.5282555 0.1096091 0.03004233
#> 2: auc_1.5--3.5 0.52825550 1.0000000 0.7244223 0.51476239
#> 3: auc_6.5--10 0.10960912 0.7244223 1.0000000 0.95171508
#> 4: auc_12--17 0.03004233 0.5147624 0.9517151 1.00000000
#>
#> $SLOPE
#> term slope_0--0.5 slope_1.5--3.5 slope_6.5--10 slope_12--17
#> <char> <num> <num> <num> <num>
#> 1: slope_0--0.5 1.0000000 0.2967416 -0.8479564 0.2391561
#> 2: slope_1.5--3.5 0.2967416 1.0000000 -0.3552805 0.8843912
#> 3: slope_6.5--10 -0.8479564 -0.3552805 1.0000000 -0.5354321
#> 4: slope_12--17 0.2391561 0.8843912 -0.5354321 1.0000000
#>