error_catch function

General Error Catching

General Error Catching

This internal function catches various potential errors in the user input in gformula_survival, gformula_continuous_eof, and gformula_binary_eof.

error_catch( id, nsimul, intvars, interventions, int_times, int_descript, covnames, covtypes, basecovs, histvars, histories, compevent_model, hazardratio, intcomp, time_points, outcome_type, time_name, obs_data, parallel, ncores, nsamples, sim_data_b, outcome_name, compevent_name, comprisk, censor, censor_name, covmodels, histvals, ipw_cutoff_quantile, ipw_cutoff_value, old_convention )

Arguments

  • id: Character string specifying the name of the ID variable in obs_data.
  • nsimul: Number of subjects for whom to simulate data.
  • intvars: List, whose elements are vectors of character strings. The kth vector in intvars specifies the name(s) of the variable(s) to be intervened on in each round of the simulation under the kth intervention in interventions.
  • interventions: List, whose elements are lists of vectors. Each list in interventions specifies a unique intervention on the relevant variable(s) in intvars. Each vector contains a function implementing a particular intervention on a single variable, optionally followed by one or more "intervention values" (i.e., integers used to specify the treatment regime).
  • int_times: List, whose elements are lists of vectors. The kth list in int_times corresponds to the kth intervention in interventions. Each vector specifies the time points in which the relevant intervention is applied on the corresponding variable in intvars. When an intervention is not applied, the simulated natural course value is used. By default, this argument is set so that all interventions are applied in all time points.
  • int_descript: Vector of character strings, each describing an intervention.
  • covnames: Vector of character strings specifying the names of the time-varying covariates in obs_data.
  • covtypes: Vector of character strings specifying the "type" of each time-varying covariate included in covnames. The possible "types" are: "binary", "normal", "categorical", "bounded normal", "zero-inflated normal", "truncated normal", "absorbing", "categorical time", and "custom".
  • basecovs: Vector of character strings specifying the names of baseline covariates in obs_data.
  • histvars: List of vectors. The kth vector specifies the names of the variables for which the kth history function in histories is to be applied.
  • histories: Vector of history functions to apply to the variables specified in histvars.
  • compevent_model: Model statement for the competing event variable.
  • hazardratio: Logical scalar indicating whether the hazard ratio should be calculated between two interventions.
  • intcomp: List of two numbers indicating a pair of interventions to be compared by a hazard ratio. The default is NA, resulting in no hazard ratio calculation.
  • time_points: Number of time points to simulate.
  • outcome_type: Character string specifying the "type" of the outcome. The possible "types" are: "survival", "continuous_eof", and "binary_eof".
  • time_name: Character string specifying the name of the time variable in obs_data.
  • obs_data: Data table containing the observed data.
  • parallel: Logical scalar indicating whether to parallelize simulations of different interventions to multiple cores.
  • ncores: Integer specifying the number of cores to use in parallel simulation.
  • nsamples: Integer specifying the number of bootstrap samples to generate.
  • sim_data_b: Logical scalar indicating whether to return the simulated data set. If bootstrap samples are used (i.e., nsamples is set to a value greater than 0), this argument must be set to FALSE.
  • outcome_name: Character string specifying the name of the outcome variable in obs_data.
  • compevent_name: Character string specifying the name of the competing event variable in obs_data.
  • comprisk: Logical scalar indicating the presence of a competing event.
  • censor: Logical scalar indicating the presence of a censoring variable in obs_data.
  • censor_name: Character string specifying the name of the censoring variable in obs_data.
  • covmodels: Vector of model statements for the time-varying covariates.
  • histvals: List of length 3. First element contains a vector of integers specifying the number of lags back for the lagged function. Second element contains a vector of integers indicating the number of lags back for the lagavg function. The last element is an indicator whether a cumavg term appears in any of the model statements.
  • ipw_cutoff_quantile: Percentile by which to truncate inverse probability weights.
  • ipw_cutoff_value: Cutoff value by which to truncate inverse probability weights.
  • old_convention: Logical scalar indicating whether the "old" intervention convention was used (i.e., by specifying interventions, intvars, and int_times).

Returns

No value is returned.