Description Usage Arguments Value Author(s) References Examples
Provides flexible hazard ratio curves allowing non-linear relationships between continuous predictors and survival. To better understand the effects that each continuous covariate has on the outcome, results are expressed in terms of hazard ratio curves, taking a specific covariate value as reference. Confidence bands for these curves are also derived.
1 2 |
data |
A data.frame in which to interpret the variables named in the formula or in the arguments |
time |
For right censored data, this is the follow up time. For interval data, the first argument is the starting time for the interval. |
time2 |
Ending time of the interval for interval censored or counting process data only. Intervals are assumed to be open on the left and closed on the right, (start, end]. For counting process data, event indicates whether an event occurred at the end of the interval. |
status |
The status indicator, normally 0=alive, 1=dead. Other choices are TRUE/FALSE (TRUE = death) or 1/2 (2=death). For interval censored data, the status indicator is 0=right censored, 1=event at time, 2=left censored, 3=interval censored. Although unusual, the event indicator can be omitted, in which case all subjects are assumed to have an event. |
formula |
A formula object, with the terms on the right after the ~ operator. |
coxfit |
An object of class coxph. This argument is optional, being an alternative to the arguments |
status.event |
The status indicator is a qualitative variable where usually the highest value is left for the event of interest (usually 0=alive, 1=dead).
If that is not the case the |
An object of class HR
. There are methods for print
, predict
and plot
.
HR
objects are implemented as a list with elements:
dataset |
Dataset used. |
coxfit |
The object of class 'coxph' used. |
phtest |
Result from testing the proportional hazards assumption. |
Artur Araújo and Luís Meira-Machado
Carmen Cadarso-Suarez, Luís Meira-Machado, Thomas Kneib and Francisco Gude. Flexible hazard ratio curves for continuous predictors in multi-state models: a P-spline approach. Statistical Modelling, 2010, 10:291-314.
1 2 3 4 5 6 7 8 9 10 11 12 | # Example 1
library(survival)
data(whas500)
fit <- coxph(Surv(lenfol, fstat)~age+hr+gender+diasbp+pspline(bmi)+pspline(los), data=whas500,
x=TRUE)
hr1 <- smoothHR(data=whas500, coxfit=fit)
print(hr1)
# Example 2
hr2 <- smoothHR( data=whas500, time="lenfol", status="fstat", formula=~age+hr+gender+diasbp+
pspline(bmi)+pspline(los) )
print(hr2)
|
Loading required package: survival
Loading required package: splines
Cox Proportional Hazards Model
Call:
coxph(formula = Surv(lenfol, fstat) ~ age + hr + gender + diasbp +
pspline(bmi) + pspline(los), data = whas500, x = TRUE)
coef se(coef) se2 Chisq DF p
age 0.05682 0.00668 0.00667 72.37950 1.00 < 2e-16
hr 0.01391 0.00284 0.00283 23.94579 1.00 9.9e-07
gender -0.25071 0.14393 0.14362 3.03404 1.00 0.08154
diasbp -0.01188 0.00359 0.00357 10.96060 1.00 0.00093
pspline(bmi), linear -0.03725 0.01438 0.01435 6.70986 1.00 0.00959
pspline(bmi), nonlin 10.48506 3.08 0.01598
pspline(los), linear 0.01310 0.01479 0.01465 0.78371 1.00 0.37601
pspline(los), nonlin 10.70873 2.95 0.01280
Iterations: 4 outer, 15 Newton-Raphson
Theta= 0.799
Theta= 0.366
Degrees of freedom for terms= 1.0 1.0 1.0 1.0 4.1 3.9
Likelihood ratio test=202 on 12 df, p=0 n= 500
Proportional Hazards Assumption
rho chisq p
age 0.0757 1.308 0.2528
hr 0.0570 0.693 0.4053
gender 0.0251 0.139 0.7091
diasbp 0.0788 1.547 0.2135
ps(bmi)3 0.1672 1.569 0.2103
ps(bmi)4 0.1695 2.502 0.1137
ps(bmi)5 0.1697 3.367 0.0665
ps(bmi)6 0.1626 3.252 0.0714
ps(bmi)7 0.1616 3.076 0.0795
ps(bmi)8 0.1825 3.866 0.0493
ps(bmi)9 0.1838 3.948 0.0469
ps(bmi)10 0.1664 3.279 0.0702
ps(bmi)11 0.1663 3.339 0.0677
ps(bmi)12 0.1581 3.499 0.0614
ps(bmi)13 0.1341 3.103 0.0782
ps(bmi)14 0.1116 2.164 0.1413
ps(los)3 0.2792 2.268 0.1320
ps(los)4 0.2541 5.105 0.0239
ps(los)5 0.2438 4.192 0.0406
ps(los)6 0.2577 4.186 0.0408
ps(los)7 0.2357 4.027 0.0448
ps(los)8 0.2496 4.721 0.0298
ps(los)9 0.2450 5.095 0.0240
ps(los)10 0.2060 2.845 0.0916
ps(los)11 0.1763 1.399 0.2369
ps(los)12 0.1558 0.767 0.3810
ps(los)13 0.1410 0.469 0.4936
ps(los)14 0.1300 0.311 0.5771
GLOBAL NA 18.616 0.9096
Cox Proportional Hazards Model
Call:
coxph(formula = covar2, data = data, x = TRUE)
coef se(coef) se2 Chisq DF p
age 0.05682 0.00668 0.00667 72.37950 1.00 < 2e-16
hr 0.01391 0.00284 0.00283 23.94579 1.00 9.9e-07
gender -0.25071 0.14393 0.14362 3.03404 1.00 0.08154
diasbp -0.01188 0.00359 0.00357 10.96060 1.00 0.00093
pspline(bmi), linear -0.03725 0.01438 0.01435 6.70986 1.00 0.00959
pspline(bmi), nonlin 10.48506 3.08 0.01598
pspline(los), linear 0.01310 0.01479 0.01465 0.78371 1.00 0.37601
pspline(los), nonlin 10.70873 2.95 0.01280
Iterations: 4 outer, 15 Newton-Raphson
Theta= 0.799
Theta= 0.366
Degrees of freedom for terms= 1.0 1.0 1.0 1.0 4.1 3.9
Likelihood ratio test=202 on 12 df, p=0 n= 500
Proportional Hazards Assumption
rho chisq p
age 0.0757 1.308 0.2528
hr 0.0570 0.693 0.4053
gender 0.0251 0.139 0.7091
diasbp 0.0788 1.547 0.2135
ps(bmi)3 0.1672 1.569 0.2103
ps(bmi)4 0.1695 2.502 0.1137
ps(bmi)5 0.1697 3.367 0.0665
ps(bmi)6 0.1626 3.252 0.0714
ps(bmi)7 0.1616 3.076 0.0795
ps(bmi)8 0.1825 3.866 0.0493
ps(bmi)9 0.1838 3.948 0.0469
ps(bmi)10 0.1664 3.279 0.0702
ps(bmi)11 0.1663 3.339 0.0677
ps(bmi)12 0.1581 3.499 0.0614
ps(bmi)13 0.1341 3.103 0.0782
ps(bmi)14 0.1116 2.164 0.1413
ps(los)3 0.2792 2.268 0.1320
ps(los)4 0.2541 5.105 0.0239
ps(los)5 0.2438 4.192 0.0406
ps(los)6 0.2577 4.186 0.0408
ps(los)7 0.2357 4.027 0.0448
ps(los)8 0.2496 4.721 0.0298
ps(los)9 0.2450 5.095 0.0240
ps(los)10 0.2060 2.845 0.0916
ps(los)11 0.1763 1.399 0.2369
ps(los)12 0.1558 0.767 0.3810
ps(los)13 0.1410 0.469 0.4936
ps(los)14 0.1300 0.311 0.5771
GLOBAL NA 18.616 0.9096
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.