validate_lmm_input {catalytic} | R Documentation |
Validate Inputs for Catalytic Linear Mixed Model (LMM)
Description
This function validates the parameters needed for fitting a catalytic Linear Mixed Model (LMM) or Generalized Linear Model (GLM),
specifically for the use with the categorical initialization from cat_lmm_initialization
.
Usage
validate_lmm_input(
cat_init,
tau = NULL,
residual_variance_0 = NULL,
random_effect_variance_0 = NULL,
coefs_0 = NULL,
optimize_domain = NULL,
max_iter = NULL,
tol = NULL,
tau_seq = NULL,
cross_validation_fold_num = NULL
)
Arguments
cat_init |
An object of class |
tau |
A positive numeric value specifying the penalty parameter for the model. |
residual_variance_0 |
A positive numeric value for the initial residual variance estimate. |
random_effect_variance_0 |
A positive numeric value for the initial random effect variance estimate. |
coefs_0 |
A numeric vector of length equal to the number of columns in the observation matrix. This represents the initial values for the model coefficients. |
optimize_domain |
A numeric vector of length 2 specifying the domain for the optimization procedure. |
max_iter |
A positive integer specifying the maximum number of iterations for the optimization. |
tol |
A positive numeric value indicating the tolerance level for convergence. |
tau_seq |
A numeric vector representing a sequence of values for the penalty parameter. |
cross_validation_fold_num |
A positive integer specifying the number of folds for cross-validation. |
Details
This function performs the following checks:
Ensures that
tau
,tau_seq
,residual_variance_0
,random_effect_variance_0
,optimize_domain
,max_iter
, andtol
are positive values.Verifies that
cat_init
is an object generated bycat_lmm_initialization
.Checks if
coefs_0
has the same length as the number of columns in the observation matrix ofcat_init
.Ensures
optimize_domain
is a numeric vector of length 2.Confirms that
cross_validation_fold_num
is greater than 1 and less than the number of observations incat_init
. If any of these conditions are not met, the function raises an error to guide the user.
Value
Returns nothing if all checks pass; otherwise, raises an error.