prep_data_cv {hbamr} | R Documentation |
Prepare data for a K-fold cross-validation of an HBAM model
Description
This function turns data prepared for hbam()
into a list of K versions, where each version includes a different vector identifying holdout-data.
Usage
prep_data_cv(data, K = 10, seed = 1)
Arguments
data |
A list of data produced by |
K |
An integer above 2, specifying the number of folds to use in the analysis. Defaults to 10. |
seed |
An integer passed on to |
Value
A list of K data objects where each version includes a different vector identifying holdout-data.
Examples
# Loading and re-coding ANES 1980 data:
data(LC1980)
LC1980[LC1980 == 0 | LC1980 == 8 | LC1980 == 9] <- NA
self <- LC1980[, 1]
stimuli <- LC1980[, -1]
dat <- prep_data(self, stimuli)
# Prepare data for cross-validation:
dat_cv <- prep_data_cv(dat, K = 10)
[Package hbamr version 2.3.1 Index]