Learn R Programming

MPLikelihoodWB (version 1.1)

data.weibull: Random data set generating function.

Description

Generate random data set of weibull distributed failure time, covariates and corresponding censoring status with a given shape and a set of regression parameters. Correlated covariates can also be drawn with a given number of correlated covariates.

Usage

data.weibull(n, shape = 2, regco = c(1, 3), rcen = 0.25, ncorvar = 3, 
correlated = FALSE)

Arguments

n

sample size

shape

value of shape parameter

regco

vector of regression parameters that corresponds to covariates, for correlated = FALSE

rcen

censoring rate

ncorvar

no of correlated covariates, for correlated = TRUE. See details below.

correlated

logical; if true correlated covariates will be generated with a given no of correlated covariates

Value

Data frame with columns:

ftime

lifetime data from weibull distribution

x

covariates

delta

censoring status, 0 or 1. A value 0 indicates corresponding observation is censored

Details

ncorvar is non required if correlated = FALSE and regco is not required if correlated = TRUE.

Examples

Run this code
# NOT RUN {
data.weibull(n = 20)
data.weibull(n = 20, shape=1.7, regco=c(2,1,3,4))
data.weibull(n = 20, shape=1.5, ncorvar=4, correlated=TRUE)
# }

Run the code above in your browser using DataLab