cat_lmm_initialization {catalytic}R Documentation

Initialization for Catalytic Linear Mixed Model (LMM)

Description

This function prepares and initializes a catalytic linear mixed model by processing input data, extracting necessary variables, generating synthetic datasets, and fitting a model. (Only consider one random effect variance)

Usage

cat_lmm_initialization(
  formula,
  data,
  x_cols,
  y_col,
  z_cols,
  group_col = NULL,
  syn_size = NULL,
  resample_by_group = FALSE,
  resample_only = FALSE,
  na_replace = mean
)

Arguments

formula

A formula specifying the model. Should include response and predictor variables.

data

A data frame containing the data for modeling.

x_cols

A character vector of column names for fixed effects (predictors).

y_col

A character string for the name of the response variable.

z_cols

A character vector of column names for random effects.

group_col

A character string for the grouping variable (optional). If not given (NULL), it is extracted from the formula.

syn_size

An integer specifying the size of the synthetic dataset to be generated, default is length(x_cols) * 4.

resample_by_group

A logical indicating whether to resample by group, default is FALSE.

resample_only

A logical indicating whether to perform resampling only, default is FALSE.

na_replace

A function to replace NA values in the data, default is mean.

Value

A list containing the values of all the input arguments and the following components:

Examples

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_init

[Package catalytic version 0.1.0 Index]