censor.x: Generate right-censoring to be dependent on the data

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/censor.x.R

Description

This function is called by sim.survdata and is not intended to be used by itself.

Usage

1
censor.x(x, censor = 0.1)

Arguments

x

A matrix or data frame containing covariates

censor

The proportion of observations to designate as being right-censored

Details

The purpose of this function is to efficiently generate indicators for whether or not an observation in simulated duration data is right-censored. In this case, whether or not an observation is right-censored depends on the covariates in the data.

This function randomly draws new coefficients, one for every column of x, from the normal distribution with mean 0 and standard deviation of 0.1. It uses these new coefficients to build a linear predictor, to which is added a disturbance term which is also drawn from N(0,.1). A fixed proportion, given by censor, of the observations with the highest values of this linear predictor are set to be TRUE and the others are set to FALSE.

Value

A vector of logical values

Author(s)

Jonathan Kropko <jkropko@virginia.edu> and Jeffrey J. Harden <jharden2@nd.edu>

See Also

sim.survdata

Examples

1
2
Xdata <- matrix(rnorm(300), 100, 3)
censor.x(Xdata, .1)

coxed documentation built on Aug. 2, 2020, 9:07 a.m.