Description Usage Arguments Format Value Examples
Function to create folds adequately for longitudinal datasets by forcing every observation with the same id to be in the same fold. Can be used with LEGIT_cv to make sure that the cross-validation folds are appropriate when using longitudinal data.
1 |
cv_iter |
Number of cross-validation iterations (Default = 1). |
cv_folds |
Number of cross-validation folds (Default = 10). |
id |
Factor vector containing the id number of each observation. |
formula |
Optional Model formula. If data and formula are provided, only the non-missing observations will be used when creating the folds (Put "formula" here if you have missing data). |
data |
Optional data.frame used for the formula. If data and formula are provided, only the non-missing observations will be used when creating the folds (Put "data" here if you have missing data). |
data_needed |
Optional data.frame with variables that have to be included (Put "cbind(genes,env)"" or "latent_var" here if you have missing data). |
print |
If FALSE, nothing except warnings will be printed. (Default = TRUE). |
An object of class function
of length 1.
Returns a list of vectors containing the fold number for each observation
1 2 3 4 | train = example_2way(500, 1, seed=777)
# Assuming it's longitudinal with 4 timepoints, even though it's not
id = factor(rep(1:125,each=4))
fit_cv = LEGIT_cv(train$data, train$G, train$E, y ~ G*E, folds=longitudinal_folds(1,10, id))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.