get_plot_info: Get Plotting Information

View source: R/comparisons.R

get_plot_infoR Documentation

Get Plotting Information

Description

This internal function obtains the data tables necessary for plotting. For continuous and binary covariates, the mean observed and simulated values are obtained for each time point. For categorical covariates, the observed and simulated means of the levels of the factors are obtained for each time point. When the outcome is of type "survival", the observed and simulated risk and survival are obtained for each time point.

Usage

get_plot_info(
  outcome_name,
  compevent_name,
  compevent2_name,
  censor_name,
  time_name,
  id,
  time_points,
  covnames,
  covtypes,
  nat_pool,
  nat_result,
  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.

time_points

Number of time points to simulate.

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".

nat_pool

Pooled-over-time data table containing simulated data under the natural course.

nat_result

Vector containing the mean outcome over all subjects at each time for natural course.

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 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.

Value

A list with the following components:

obs_results

A list of the mean observed values at each time point for covariates and - if the outcome is of type "survival" - the risk and survival.

dt_cov_plot

A list of data tables The data tables contain the observed and simulated mean values of the covariates under each time point.

dt_obs_plot

For outcomes of type "survival", a list of data tables. The data tables contain the observed and simulated risks and survival under each time point. For other outcomes, a value of NA is given.


CausalInference/gfoRmula documentation built on Oct. 1, 2024, 8:36 p.m.