data(mtcars)
cat_init <- cat_lmm_initialization(
formula = mpg ~ wt + (1 | cyl), # formula for simple model
data = mtcars,
x_cols = c("wt"), # Fixed effects
y_col = "mpg", # Response variable
z_cols = c("disp", "hp", "drat", "qsec", "vs", "am", "gear", "carb"), # Random effects
group_col = "cyl", # Grouping column
syn_size = 100, # Synthetic data size
resample_by_group = FALSE, # Resampling option
resample_only = FALSE, # Resampling method
na_replace = mean # NA replacement method
)
cat_model <- cat_lmm_tune(
cat_init = cat_init, # Only accept object generated from cat_lmm_initialization
tau_seq = c(1, 2), # Vector of weights for synthetic data
cross_validation_fold_num = 3 # number of folds for cross-validation
)
cat_model
Run the code above in your browser using DataLab