coxphw-package {coxphw}R Documentation

Weighted Estimation in Cox Regression


This package implements weighted estimation in Cox regression as proposed by Schemper, Wakounig and Heinze (Statistics in Medicine, 2009, doi: 10.1002/sim.3623). Weighted Cox regression provides unbiased average hazard ratio estimates also in case of non-proportional hazards. The package provides options to estimate time-dependent effects conveniently by including interactions of covariates with arbitrary functions of time, with or without making use of the weighting option. For more details we refer to Dunkler, Ploner, Schemper and Heinze (Journal of Statistical Software, 2018, doi: 10.18637/jss.v084.i02).


Package: coxphw
Type: Package
Version: 4.0.2
Date: 2020-06-16
License: GPL-2

Main functions included in the coxphw package are

coxphw weigthed estimation of Cox regression: either (recommended) estimation of
average hazard ratios (Schemper et al., 2009), estimation of average regression
effects (Xu and O'Quigley, 2000), or proportional hazards regression.
plot plots the weights used in a weighted Cox regression analysis against time.
concord obtains generalized concordance probabilities with confidence intervalls.
predict obtains the effect estimates (of e.g. a nonlinear or a time-dependent effect)
at specified values of a continuous covariable. With plot.coxphw.predict
these relative or log relative hazard versus values of the continuous covariable
can be plotted.
wald obtain Wald chi-squared test statistics and p-values for one or more regression
coefficients given their variance-covariance matrix.

Data sets included in the coxphw package are

biofeedback biofeedback treatment data
gastric gastric cancer data


The SAS macro WCM with similar functionality can be obtained at

Important version changes:
Up to Version 2.13 coxphw used a slightly different syntax (arguments: AHR, AHR.norobust, ARE, PH, normalize, censcorr, prentice, breslow, taroneware). From Version 3.0.0 on the old syntax is disabled. From Version 4.0.0 fractional polynomials are disabled and plotshape is replaced with predict and plot.coxphw.predict.


Georg Heinze, Meinhard Ploner, Daniela Dunkler


Dunkler D, Ploner M, Schemper M, Heinze G. (2018) Weighted Cox Regression Using the R Package coxphw. JSS 84, 1–26, doi: 10.18637/jss.v084.i02.

Dunkler D, Schemper M, Heinze G. (2010) Gene Selection in Microarray Survival Studies Under Possibly Non-Proportional Hazards. Bioinformatics 26:784-90.

Lin D and Wei L (1989). The Robust Inference for the Cox Proportional Hazards Model. J AM STAT ASSOC 84, 1074-1078.

Lin D (1991). Goodness-of-Fit Analysis for the Cox Regression Model Based on a Class of Parameter Estimators. J AM STAT ASSOC 86, 725-728.

Royston P and Altman D (1994). Regression Using Fractional Polynomials of Continuous Covariates: Parsimonious Parametric Modelling. J R STAT SOC C-APPL 43, 429-467.

Royston P and Sauerbrei W (2008). Multivariable Model-Building. A Pragmatic Approach to Regression Analysis Based on Fractional Polynomials for Modelling Continuous Variables. Wiley, Chichester, UK.

Sasieni P (1993). Maximum Weighted Partial Likelihood Estimators for the Cox Model. J AM STAT ASSOC 88, 144-152.

Schemper M (1992). Cox Analysis of Survival Data with Non-Proportional Hazard Functions. J R STAT SOC D 41, 455-465.

Schemper M, Wakounig S and Heinze G (2009). The Estimation of Average Hazard Ratios by Weighted Cox Regression. Stat Med 28, 2473-2489, doi: 10.1002/sim.3623.

Xu R and O'Quigley J (2000). Estimating Average Regression Effect Under Non-Proportional Hazards. Biostatistics 1, 423-439.

See Also

coxphw, concord, plot.coxphw, predict.coxphw, plot.coxphw.predict, wald


## for examples see coxphw

[Package coxphw version 4.0.2 Index]