obs_calculate function

Calculate Observed Covariate Means and Risk

Calculate Observed Covariate Means and Risk

This internal function calculates the mean observed values of covariates at each time point, as well as mean observed risk.

obs_calculate( outcome_name, compevent_name, compevent2_name, censor_name, time_name, id, covnames, covtypes, comprisk, comprisk2, censor, fitD2, fitC, outcome_type, obs_data, ipw_cutoff_quantile, ipw_cutoff_value )

Arguments

  • 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.
  • compevent2_name: Character string specifying the name of the competing event variable in obs_data if competing events are treated as censoring events.
  • censor_name: Character string specifying the name of the censoring variable in obs_data.
  • time_name: Character string specifying the name of the time variable in obs_data.
  • id: Character string specifying the name of the ID variable in obs_data.
  • 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".
  • comprisk: Logical scalar indicating the presence of a competing event.
  • comprisk2: Logical scalar indicating whether competing events are treated as censoring events.
  • censor: Logical scalar indicating the presence of a censoring variable in obs_data.
  • fitD2: Model fit for the competing event variable if competing events are treated as censoring events.
  • fitC: Model fit for the censoring variable.
  • outcome_type: Character string specifying the "type" of the outcome. The possible "types" are: "survival", "continuous_eof", and "binary_eof".
  • obs_data: Data table containing the observed data.
  • ipw_cutoff_quantile: Percentile by which to truncate inverse probability weights.
  • ipw_cutoff_value: Cutoff value by which to truncate inverse probability weights.

Returns

A list. Its first entry is a list of mean covariate values at each time point; its second entry is a vector of the mean observed risk (for "survival"

outcome types) or the mean observed outcome (for "continuous_eof" and "binary_eof" outcome types); for "survival" outcome types, its third entry is a vector of mean observed survival.