This function performs k-fold cross-validation for model selection in the context of Generalized Estimating Equations (GEE). It is designed to evaluate the performance of different models specified by a range of lambda values, choosing the one that minimizes the cross-validation criterion.
CVfit(
  formula,
  id,
  data,
  family,
  scale.fix,
  scale.value,
  fold,
  pindex,
  eps,
  maxiter,
  tol,
  lambda.vec = exp(seq(log(10), log(0.1), length.out = 30)),
  corstr = "independence",
  ncore = 1
)An object of class "CVfit", which is a list containing:
foldThe number of folds used in the cross-validation.
lam.vectThe vector of lambda values tested.
cv.vectThe cross-validation error for each lambda.
lam.optThe lambda value that resulted in the minimum cross-validation error.
cv.minThe minimum cross-validation error.
callThe matched call.
an object of class "formula" (or one that can be coerced to that class):
a symbolic description of the model to be fitted.
a vector which identifies the cluster/group for each observation.
an optional data frame containing the variables in the model.
a description of the error distribution and link function to be used in the model.
logical; if TRUE, the scale parameter is fixed to scale.value.
the value of the scale parameter when scale.fix is TRUE.
the number of folds to be used in the cross-validation.
an optional numeric vector specifying a parameter index.
the threshold for convergence criteria.
the maximum number of iterations for the convergence of the algorithm.
the tolerance level for the convergence of the algorithm.
a vector of lambda values for which the cross-validation error will be calculated.
the correlation structure used.
if greater than 1, the function will use parallel computation.
Note that this is a re-implemented version with parallel computing.