gen_data {coxrobust} | R Documentation |
Generates data set from the proportional hazards regression model without or with contamination.
gen_data(n, beta, cont = 0, p.censor = 0)
n |
number of observations. |
beta |
vector of regression coefficients. |
cont |
fraction of contaminated observations. |
p.censor |
probability of censoring. |
Covariates are generated independently, each from the standard normal
distribution. Baseline hazard is equal to 1. After generation of survival
times, covariates are replaced by independent 2N(0,1)+1 variables
in fraction cont
of observations.
Data frame containing the following variables:
time |
vector of survival times. |
status |
vector of censoring status. |
X1, X2, ... |
explanatory variables (their number is determined by the dimension of vector of regression coefficients). |
gen_data(50, c(2,-2), cont = 0.05)