dxPlot(x, ...)
## S3 method for class 'coxph':
dxPlot(x, ..., ties = "breslow",
defCont = 2, noQuantiles = 5, noPerPage = 2,
height = NULL, width = NULL)
coxph
breslow
or efron
NULL
for default plot sizeNULL
for default plot sizecoxph
model. The Cox model assumes that the
hazard function satisfies: $$\lambda_{i}(t) =
\lambda_0(t) \exp(X_i\beta)$$ That is, for a continuous variable, an unit
increase in the variable produces the same change in risk
across the value of the variable. (E.g. an increase of
age of 5 years leads to the same change in hazard no
matter what the increase is from or to).
To
verify this is the case, a null model is fitted (i.e no
coefficients, similar to intercept-only model in linear
regression). Martingale residuals are calcuated for this.
Plots of these residuals against the values of each of
the predictors in the model are shown.
If the
correct model for covariate $j$ is based on a smooth
function $f()$, i.e. $\exp(f(X_j)\beta_j)$ then the
following should hold: $$E(M_i|X_{ij}=x_j) \approx
cf(x_j)$$ Where
$M$ is the martingale residual and $c$ depends on
the amount of censoring and is roughly independent of
$x_j$.
A lowess
smoothed line is
added to the plot. This should be approximately linear if
the assumption of proportional hazards is met. If the
plot shows a threshold, a discretised version of the
covariate may be preferable.
The assumption of
proportional hazards can be checked in a number of
ways. These methods work by stratifying a covariate
$G$ into $k$ disjoint strata. A stratified
coxph
model is fitted to these strata and one is
selected as a reference.
The cumulative hazard
$\hat{H}_g(t)$ is plotted for each stratum
$g$. These should be a constant multiple of the
reference stratum $\hat{H}_1(t)$ over time.
Another way to compare these is to plot the
differences in log cumulative hazard, that is:
$$\log \hat{H}_g(t) - \log \hat{H}_1(t), \quad g = 2
, ..., k$$
Each curve should be horizontal and constant over time.
Curves above zero indicate increased hazard in the
stratum $g$ vs the reference at that time.
Finally Andersen plots show $$\log
\hat{H}_1(t) vs \log \hat{H}_g(t), \quad g = 2,...,k$$ If
proportional hazards are present, these should be
straight lines through the origin. If the curve is convex
this shows that $\hat{H}_g(t) \div \hat{H}_1(t)$ is an increasing function of
$t$. Thus if convex, the hazard rate in $g$
is increasing vs the reference.data(bmt, package="KMsurv")
bmt <- within(bmt, {
z1 <- z1 -28
z2 <- z2- 28
z3 <- z1*z2
z4 <- as.double( group== 2 )
z5 <- as.double( group== 3 )
z6 <- z8
z7 <- (z7 / 30) - 9
z8 <- z10
})
c1 <- coxph(Surv(t2,d3) ~ z1+z2+z3+z4+z5+z6+z7+z8,
method="breslow",
data=bmt)
dxPlot(c1)
data(alloauto, package="KMsurv")
c1 <- coxph(Surv(time,delta) ~ factor(type),
method='breslow',
data=alloauto)
dxPlot(c1)
c1 <- coxph(formula = Surv(time, status == 2) ~ age + log(bili), data=pbc)
dxPlot(c1)
Run the code above in your browser using DataLab