# paf: Calculate attributable fraction function for censored... In paf: Attributable Fraction Function for Censored Survival Data

## Description

Fit a Cox model and calculate the unadjusted/adjusted attributable fraction function of a set of covariates based on the Cox model using the method proposed by Chen, Lin and Zeng (2010).

## Usage

 `1` ```paf(formula, data, cov) ```

## Arguments

 `formula` a formula object for the Cox model considered , which has the same format as that in the `coxph` function of the `survival` package. `data` a data.frame in which to interpret the variables named in the `formula`. `cov` the set of covariates whose attributable fraction function is of interest.

## Details

This function calculates the unadjusted/adjusted attributable fraction function for the set of covariates specified in `cov` which must also be included as covariates of the Cox model. The function calculates the unadjusted attributable fraction function if the Cox model does not include other covariates; otherwise the function calculates the adjusted attributable fraction function adjusting for other covariates in the Cox model.

## Value

 `time` unique uncensored event times at which the attributable fraction function jumps. `est` the estimates of unadjusted/adjusted attributable fractions at unique uncensored event times. `se` the standard errors of the estimated attributable fractions. `low` the lower confidence limits of the atrtributable fractions. `upp` the upper confidence limits of the atrtributable fractions. `fit.cox` coxph object from the fitted Cox model.

## Note

The Breslow method is used to handle ties. The function will do missing-data filter automatically.

Li Chen

## References

Chen L, Lin DY, Zeng D. (2010). Attributable fraction functions for censored event times. Biometrika 97, 713-726.

`plot.paf`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```# simulated data set from a Cox model n = 1000 x1 = as.numeric(runif(n)>0.5) x2 = x1 + rnorm(n) t = exp(-x1 - 0.5 * x2) * rexp(n, rate = 0.1) c = runif(n, 0, 3.4) y = pmin(t, c) delta = as.numeric(t<=c) test = data.frame(time=y, status=delta, x1=x1, x2=x2) # calculate the atrributable fraction function of x1 adjusting for x2 result=paf(Surv(time, status) ~ x1 + x2, data=test, cov=c('x1')) result\$fit.cox cbind(result\$time, result\$est, result\$se, result\$low, result\$upp)[1:10, ] # Calculate the unadjusted attributable fraciton function of x1 result=paf(Surv(time, status) ~ x1, data=test, cov=c('x1')) ```

### Example output

```Loading required package: survival
Call:
coxph(formula = formula, data = data, method = "breslow")

coef exp(coef) se(coef)    z      p
x1 1.0025    2.7251   0.1348 7.44  1e-13
x2 0.5293    1.6978   0.0596 8.89 <2e-16

Likelihood ratio test=204  on 2 df, p=0
n= 1000, number of events= 308
[,1]      [,2]       [,3]      [,4]      [,5]
[1,] 0.001101419 0.5135640 0.05308121 0.3975614 0.6072298
[2,] 0.004318428 0.5132873 0.05307189 0.3973146 0.6069438
[3,] 0.004602318 0.5130105 0.05306524 0.3970612 0.6066619
[4,] 0.004939957 0.5127333 0.05305563 0.3968146 0.6063750
[5,] 0.010080089 0.5124560 0.05304624 0.3965674 0.6060883
[6,] 0.014137511 0.5121783 0.05303695 0.3963195 0.6058014
[7,] 0.021008912 0.5118988 0.05303170 0.3960601 0.6055191
[8,] 0.021367456 0.5116186 0.05306043 0.3957176 0.6052900
[9,] 0.021669139 0.5113385 0.05309077 0.3953712 0.6050634
[10,] 0.025361345 0.5110581 0.05307931 0.3951258 0.6047703
```

paf documentation built on May 2, 2019, 8:29 a.m.