genSurvData: Generate a survival dataset from the log-logistic accelerated...

View source: R/genSurvData.R

genSurvDataR Documentation

Generate a survival dataset from the log-logistic accelerated failure time model.

Description

This is a function for generating synthetic datasets from the log-logistic accelerated failure time model. The purpose of this function is to provide structured data for the examples of the other functions' usage.

Usage

genSurvData(n, p, s, mag, cens.quant = 0.6)

Arguments

n

The numer of subjects to be included in the dataset.

p

Dimension of the predictor. Note that the function computes the square-root of a p \times p covariance matrix, so setting p large may be time-consuming.

s

The number of nonzero regression coefficients in \beta.

mag

The magnitude of the s nonzero regression coefficients. Signs of coefficients are assigned at random.

cens.quant

The quantile of true survival times used to set the mean of the exponential distribution from which censoring times are drawn. Default is 0.6.

Details

This function generates predictors to follow a p-dimensional multivariate normal distribution whose covariance has an AR(1) structure with lag 0.7. Then, log survival times are generated as

\log(T) = X \beta + \epsilon

where \epsilon has independent components drawn from a logistic distribution with location parmeter zero and scale parameter two. Then censoring times are drawn from an exponential distribution with mean equal to the quantile cens.quant of T.

Value

beta

The true data generating regression coefficient vector.

logY

The observed failure times or censoring times on the log scale.

status

Indicator of censoring; a value of 1 indicates the corresponding component of logY is an observed log failure time and a value of 0 indicates a log censoring time.

Xn

The n \times p matrix of predictors.

Examples

# --------------------------------------
# Generate data  
# --------------------------------------
set.seed(1)
genData <- penAFT::genSurvData(n = 50, p = 100, s = 10, mag = 1, cens.quant = 0.6)
X <- genData$X
logY <- genData$logY
delta <- genData$status
str(X)
head(logY)
head(delta)

penAFT documentation built on April 18, 2023, 9:10 a.m.