validate_lmm_initialization_input: Validate Inputs for Catalytic Linear Mixed Model (LMM)...

validate_lmm_initialization_inputR Documentation

Validate Inputs for Catalytic Linear Mixed Model (LMM) Initialization

Description

This function validates the parameters needed for initializing a catalytic Linear Mixed Model (LMM) or Generalized Linear Model (GLM) based on the input formula, data, and column specifications.

Usage

validate_lmm_initialization_input(
  formula,
  data,
  x_cols,
  y_col,
  z_cols,
  group_col,
  syn_size
)

Arguments

formula

An object of class formula representing the model formula, typically including fixed and random effects for LMMs or for GLMs.

data

A data.frame containing the data for model fitting. This should include all columns specified in x_cols, y_col, z_cols, and group_col.

x_cols

A character vector of column names to be used as predictor variables in the model.

y_col

A single character string specifying the name of the response variable column.

z_cols

A character vector of column names to be used as additional predictors or grouping factors, depending on the model structure.

group_col

A single character string specifying the name of the grouping variable for random effects.

syn_size

Optional. A positive integer indicating the synthetic data size, typically for use in data augmentation or model diagnostics.

Details

This function performs the following checks:

  • Ensures syn_size is a positive integer.

  • Verifies that formula is not for survival analysis (e.g., does not contain Surv terms).

  • Checks that the formula is not overly complex by confirming it has fewer terms than the total columns in data.

  • Ensures y_col and group_col each contain only one column name.

  • Confirms data is a data.frame.

  • Validates that all specified columns in x_cols, y_col, z_cols, and group_col exist in data without overlap or missing values.

  • Warns if syn_size is set too small relative to the data dimensions, recommending a larger value. If any of these conditions are not met, the function raises an error or warning to guide the user.

Value

Returns nothing if all checks pass; otherwise, raises an error or warning.


catalytic documentation built on April 4, 2025, 5:51 a.m.