Implements forward covariate selection for nlme-based non-linear mixed effect models

frwd_selection(base, cv, dat, cutoff = 0.05)

Arguments

base

base model

cv

a list of candidate covariate to model parameters

dat

model data

cutoff

significance level

Value

an nlme object of the final model

Examples

# \donttest{
dat <- theo_md
dat$LOGWT <- log(dat$WT)
dat$TG <- (dat$ID < 6) + 0 # dummy covariate

specs <- list(
  fixed = list(lKA = lKA ~ 1, lCL = lCL ~ 1, lV = lV ~ 1),
  random = pdDiag(lKA + lCL ~ 1),
  start = c(0.5, -3.2, -1)
)
fit0 <- nlme_lin_cmpt(dat, par_model = specs, ncmt = 1)
cv <- list(lCL = c("WT", "TG"), lV = c("WT"))
fit <- frwd_selection(fit0, cv, dat)
#> covariate selection process:
#> 
#> adding WT to lCL : p-val = 0.2094955
#> adding TG to lCL : p-val = 0.3052647
#> adding WT to lV : p-val = 0.01717674
#>  WT added to lV 
#> 
#> adding WT to lCL : p-val = 0.3170215
#> adding TG to lCL : p-val = 0.3082204
#> 
#> covariate selection finished.
#> 
#> 
print(summary(fit))
#> Nonlinear mixed-effects model fit by maximum likelihood
#>   Model: DV ~ (nlmixr::nlmeModList("user_fn"))(lCL, lV, lKA, TIME, ID) 
#>        AIC      BIC    logLik
#>   853.6537 878.6853 -419.8268
#> 
#> Random effects:
#>  Formula: list(lKA ~ 1, lCL ~ 1)
#>  Level: ID
#>  Structure: Diagonal
#>               lKA       lCL Residual
#> StdDev: 0.4269525 0.2488361 1.053212
#> 
#> Fixed effects: list(lKA = lKA ~ 1, lCL = lCL ~ 1, lV = lV ~ 1 + WT) 
#>                    Value  Std.Error  DF   t-value p-value
#> lKA            0.2474566 0.13415447 249  1.844565  0.0663
#> lCL            1.0538593 0.07540032 249 13.976856  0.0000
#> lV.(Intercept) 2.9654832 0.18025208 249 16.451867  0.0000
#> lV.WT          0.0062403 0.00259205 249  2.407470  0.0168
#>  Correlation: 
#>                lKA    lCL    lV.(I)
#> lCL            -0.012              
#> lV.(Intercept)  0.008  0.000       
#> lV.WT           0.027 -0.015 -0.990
#> 
#> Standardized Within-Group Residuals:
#>         Min          Q1         Med          Q3         Max 
#> -5.01682624 -0.38310128  0.04266483  0.45315200  3.15871329 
#> 
#> Number of Observations: 264
#> Number of Groups: 12 
# }