AssignOutcomeSurv: Assign survival time outcome

Description Usage Arguments Value Author(s)

View source: R/01.GenerateData.R

Description

A time to event outcome is assigned as an Exponential(lambda_i) random variable where lambda_i is an individual-specific time-constant hazard of an event calculated from covariate and treatment values and coefficients. Censoring times are generated from an Exponential(lambda_c_i) distribution where lambda_c_i is an individual-specific time-constant hazard of censoring, depending on the covariates only. The censoring time distribution does not depend on the treatment to avoid collider stratification bias. An additional administrative censoring time is defined by Tmax, which marks the end of the follow up for those who have follow up times longer than Tmax. The latent true event time and censoring time variables are coded in years. The final observed time variable is coded in days (ceiling is applied to avoid fractional numbers) to emulate the granularity of typical claims data.

Usage

1
AssignOutcomeSurv(dfXA, betaX, betaA, betaXA, lambda, lambda_c, Tmax)

Arguments

dfXA

data frame including covariates and treatment assingment A

betaX

vector specifying true coefficients for covariates

betaA

scalar value for treatment effect

betaXA

vector specifying true coefficients for covariates-treatment interaction. The vector must be the same length as betaX.

lambda

scalar value defining the constant baseline hazard for the event outcome. The corresponding time scale is in years.

lambda_c

scalar value defining the constant baseline hazard for censoring. The corresponding time scale is in years.

Tmax

scalar value defining the end of follow up. Use to introduce a constant value administrative censoring time. The corresponding time scale is in years. To avoid administrative censoring, set this to a very high value.

Value

data frame with added individual-specific rate (rate), counterfactual rates (rate0 and rate1), event time (T; years), censoring time (C; years), observed time (time; integer days), and event indicator (event).

Author(s)

Kazuki Yoshida


kaz-yos/distributed documentation built on May 27, 2019, 4:50 a.m.