# dataCox: Cox Proportional Hazards Model Data Generation From Weibull... In coxphSGD: Stochastic Gradient Descent log-Likelihood Estimation in Cox Proportional Hazards Model

## Description

Function `dataCox` generaters random survivaldata from Weibull distribution (with parameters `lambda` and `rho` for given input `x` data, model coefficients `beta` and censoring rate for censoring that comes from exponential distribution with parameter `cens.rate`.

## Usage

 `1` ```dataCox(n, lambda, rho, x, beta, cens.rate) ```

## Arguments

 `n` Number of observations to generate. `lambda` lambda parameter for Weibull distribution. `rho` rho parameter for Weibull distribution. `x` A data.frame with an input data to generate the survival times for. `beta` True model coefficients. `cens.rate` Parameter for exponential distribution, which is responsible for censoring.

## Details

For each observation true survival time is generated and a censroing time. If censoring time is less then survival time, then the survival time is returned and a status of observations is set to `0` which means the observation had censored time. If the survival time is less than censoring time, then for this observation the true survival time is returned and the status of this observation is set to `1` which means that the event has been noticed.

## Value

A `data.frame` containing columns:

• `id` an integer.

• `time` survival times.

• `status` observation status (event occured (1) or not (0)).

• `x` a `data.frame` with an input data to generate the survival times for.

## References

`Generating survival times to simulate Cox proportional hazards models`, 2005 by Ralf Bender, Thomas Augustin, Maria Blettner.

## Examples

 ```1 2 3 4 5 6``` ```## Not run: x <- matrix(sample(0:1, size = 20000, replace = TRUE), ncol = 2) dataCox(10^4, lambda = 3, rho = 2, x, beta = c(1,3), cens.rate = 5) -> dCox ## End(Not run) ```

### Example output

```Loading required package: survival
```

coxphSGD documentation built on May 1, 2019, 6:32 p.m.