survival: Survival Analysis
- CRAN: http://cran.r-project.org/web/packages/survival/index.html
- GitHub: https://github.com/therneau/survival
> library(survival)
バージョン: 2.41.3
| 関数名 | 概略 | 
|---|---|
| Surv | Create a Survival Object | 
| aareg | Aalen's additive regression model for censored data | 
| aeqSurv | Adjudicate near ties in a Surv object | 
| agreg.fit | Cox model fitting functions | 
| aml | Acute Myelogenous Leukemia survival data | 
| anova.coxph | Analysis of Deviance for a Cox model. | 
| attrassign | Create new-style "assign" attribute | 
| basehaz | Alias for the survfit function | 
| bladder | Bladder Cancer Recurrences | 
| cch | Fits proportional hazards regression model to case-cohort data | 
| cgd | Chronic Granulotomous Disease data | 
| cgd0 | Chronic Granulotomous Disease data | 
| cipoisson | Confidence limits for the Poisson | 
| clogit | Conditional logistic regression | 
| cluster | Identify clusters. | 
| colon | Chemotherapy for Stage B/C colon cancer | 
| cox.zph | Test the Proportional Hazards Assumption of a Cox Regression | 
| coxph | Fit Proportional Hazards Regression Model | 
| coxph.control | Ancillary arguments for controlling coxph fits | 
| coxph.detail | Details of a Cox Model Fit | 
| coxph.object | Proportional Hazards Regression Object | 
| coxph.wtest | Compute a quadratic form | 
| dsurvreg | Distributions available in survreg. | 
| finegray | Create data for a Fine-Gray model | 
| flchain | Assay of serum free light chain for 7874 subjects. | 
| frailty | Random effects terms | 
| genfan | Generator fans | 
| heart | Stanford Heart Transplant data | 
| is.ratetable | Verify that an object is of class ratetable. | 
| kidney | Kidney catheter data | 
| lines.survfit | Add Lines or Points to a Survival Plot | 
| logLik.coxph | logLik method for a Cox model | 
| logan | Data from the 1972-78 GSS data used by Logan | 
| lung | NCCTG Lung Cancer Data | 
| mgus | Monoclonal gammapothy data | 
| mgus2 | Monoclonal gammapothy data | 
| model.frame.coxph | Model.frame method for coxph objects | 
| model.matrix.coxph | Model.matrix method for coxph models | 
| myeloid | Acute myeloid leukemia | 
| neardate | Find the index of the closest value in data set 2, for each entry in data set one. | 
| nwtco | Data from the National Wilm's Tumor Study | 
| ovarian | Ovarian Cancer Survival Data | 
| pbc | Mayo Clinic Primary Biliary Cirrhosis Data | 
| pbcseq | Mayo Clinic Primary Biliary Cirrhosis, sequential data | 
| plot.aareg | Plot an aareg object. | 
| plot.cox.zph | Graphical Test of Proportional Hazards | 
| plot.survfit | Plot method for 'survfit' objects | 
| predict.coxph | Predictions for a Cox model | 
| predict.survreg | Predicted Values for a 'survreg' Object | 
| print.aareg | Print an aareg object | 
| print.summary.coxph | Print method for summary.coxph objects | 
| print.summary.survexp | Print Survexp Summary | 
| print.summary.survfit | Print Survfit Summary | 
| print.survfit | Print a Short Summary of a Survival Curve | 
| pspline | Smoothing splines using a pspline basis | 
| pyears | Person Years | 
| quantile.survfit | Quantiles from a survfit object | 
| ratetable | Ratetable reference in formula | 
| ratetableDate | Convert date objects to ratetable form | 
| rats | Rat treatment data from Mantel et al | 
| rats2 | Rat data from Gail et al. | 
| residuals.coxph | Calculate Residuals for a 'coxph' Fit | 
| residuals.survreg | Compute Residuals for 'survreg' Objects | 
| retinopathy | Diabetic Retinopathy | 
| rhDNase | rhDNASE data set | 
| ridge | Ridge regression | 
| stanford2 | More Stanford Heart Transplant data | 
| statefig | Draw a state space figure. | 
| strata | Identify Stratification Variables | 
| summary.aareg | Summarize an aareg fit | 
| summary.coxph | Summary method for Cox models | 
| summary.pyears | Summary function for pyears objecs | 
| summary.survexp | Summary function for a survexp object | 
| summary.survfit | Summary of a Survival Curve | 
| survConcordance | Compute a concordance measure. | 
| survSplit | Split a survival data set at specified times | 
| survdiff | Test Survival Curve Differences | 
| survexp | Compute Expected Survival | 
| survexp.fit | Compute Expected Survival | 
| survexp.object | Expected Survival Curve Object | 
| survexp.us | Census Data Sets for the Expected Survival and Person Years Functions | 
| survfit | Create survival curves | 
| survfit.coxph | Compute a Survival Curve from a Cox model | 
| survfit.formula | Compute a Survival Curve for Censored Data | 
| survfit.matrix | Create Aalen-Johansen estimates of multi-state survival from a matrix of hazards. | 
| survfit.object | Survival Curve Object | 
| survfitcoxph.fit | A direct interface to the 'computational engine' of survfit.coxph | 
| survobrien | O'Brien's Test for Association of a Single Variable with Survival | 
| survreg | Regression for a Parametric Survival Model | 
| survreg.control | Package options for survreg and coxph | 
| survreg.distributions | Parametric Survival Distributions | 
| survreg.object | Parametric Survival Model Object | 
| survregDtest | Verify a survreg distribution | 
| tcut | Factors for person-year calculations | 
| tmerge | Time based merge for survival data | 
| tobin | Tobin's Tobit data | 
| transplant | Liver transplant waiting list | 
| untangle.specials | Help Process the 'specials' Argument of the 'terms' Function. | 
| uspop2 | Projected US Population | 
| veteran | Veterans' Administration Lung Cancer study | 
Surv
> Surv(heart$start, heart$stop, heart$event)
  [1] (  0.0,  50.0]  (  0.0,   6.0]  (  0.0,   1.0+] (  1.0,  16.0] 
  [5] (  0.0,  36.0+] ( 36.0,  39.0]  (  0.0,  18.0]  (  0.0,   3.0] 
  [9] (  0.0,  51.0+] ( 51.0, 675.0]  (  0.0,  40.0]  (  0.0,  85.0] 
 [13] (  0.0,  12.0+] ( 12.0,  58.0]  (  0.0,  26.0+] ( 26.0, 153.0] 
 [17] (  0.0,   8.0]  (  0.0,  17.0+] ( 17.0,  81.0]  (  0.0,  37.0+]
 [21] ( 37.0,1387.0]  (  0.0,   1.0]  (  0.0,  28.0+] ( 28.0, 308.0] 
 [25] (  0.0,  36.0]  (  0.0,  20.0+] ( 20.0,  43.0]  (  0.0,  37.0] 
 [29] (  0.0,  18.0+] ( 18.0,  28.0]  (  0.0,   8.0+] (  8.0,1032.0] 
 [33] (  0.0,  12.0+] ( 12.0,  51.0]  (  0.0,   3.0+] (  3.0, 733.0] 
 [37] (  0.0,  83.0+] ( 83.0, 219.0]  (  0.0,  25.0+] ( 25.0,1800.0+]
 [41] (  0.0,1401.0+] (  0.0, 263.0]  (  0.0,  71.0+] ( 71.0,  72.0] 
 [45] (  0.0,  35.0]  (  0.0,  16.0+] ( 16.0, 852.0]  (  0.0,  16.0] 
 [49] (  0.0,  17.0+] ( 17.0,  77.0]  (  0.0,  51.0+] ( 51.0,1587.0+]
 [53] (  0.0,  23.0+] ( 23.0,1572.0+] (  0.0,  12.0]  (  0.0,  46.0+]
 [57] ( 46.0, 100.0]  (  0.0,  19.0+] ( 19.0,  66.0]  (  0.0,   4.5+]
 [61] (  4.5,   5.0]  (  0.0,   2.0+] (  2.0,  53.0]  (  0.0,  41.0+]
 [65] ( 41.0,1408.0+] (  0.0,  58.0+] ( 58.0,1322.0+] (  0.0,   3.0] 
 [69] (  0.0,   2.0]  (  0.0,  40.0]  (  0.0,   1.0+] (  1.0,  45.0] 
 [73] (  0.0,   2.0+] (  2.0, 996.0]  (  0.0,  21.0+] ( 21.0,  72.0] 
 [77] (  0.0,   9.0]  (  0.0,  36.0+] ( 36.0,1142.0+] (  0.0,  83.0+]
 [81] ( 83.0, 980.0]  (  0.0,  32.0+] ( 32.0, 285.0]  (  0.0, 102.0] 
 [85] (  0.0,  41.0+] ( 41.0, 188.0]  (  0.0,   3.0]  (  0.0,  10.0+]
 [89] ( 10.0,  61.0]  (  0.0,  67.0+] ( 67.0, 942.0+] (  0.0, 149.0] 
 [93] (  0.0,  21.0+] ( 21.0, 343.0]  (  0.0,  78.0+] ( 78.0, 916.0+]
 [97] (  0.0,   3.0+] (  3.0,  68.0]  (  0.0,   2.0]  (  0.0,  69.0] 
[101] (  0.0,  27.0+] ( 27.0, 842.0+] (  0.0,  33.0+] ( 33.0, 584.0] 
[105] (  0.0,  12.0+] ( 12.0,  78.0]  (  0.0,  32.0]  (  0.0,  57.0+]
[109] ( 57.0, 285.0]  (  0.0,   3.0+] (  3.0,  68.0]  (  0.0,  10.0+]
[113] ( 10.0, 670.0+] (  0.0,   5.0+] (  5.0,  30.0]  (  0.0,  31.0+]
[117] ( 31.0, 620.0+] (  0.0,   4.0+] (  4.0, 596.0+] (  0.0,  27.0+]
[121] ( 27.0,  90.0]  (  0.0,   5.0+] (  5.0,  17.0]  (  0.0,   2.0] 
[125] (  0.0,  46.0+] ( 46.0, 545.0+] (  0.0,  21.0]  (  0.0, 210.0+]
[129] (210.0, 515.0+] (  0.0,  67.0+] ( 67.0,  96.0]  (  0.0,  26.0+]
[133] ( 26.0, 482.0+] (  0.0,   6.0+] (  6.0, 445.0+] (  0.0, 428.0+]
[137] (  0.0,  32.0+] ( 32.0,  80.0]  (  0.0,  37.0+] ( 37.0, 334.0] 
[141] (  0.0,   5.0]  (  0.0,   8.0+] (  8.0, 397.0+] (  0.0,  60.0+]
[145] ( 60.0, 110.0]  (  0.0,  31.0+] ( 31.0, 370.0+] (  0.0, 139.0+]
[149] (139.0, 207.0]  (  0.0, 160.0+] (160.0, 186.0]  (  0.0, 340.0] 
[153] (  0.0, 310.0+] (310.0, 340.0+] (  0.0,  28.0+] ( 28.0, 265.0+]
[157] (  0.0,   4.0+] (  4.0, 165.0]  (  0.0,   2.0+] (  2.0,  16.0] 
[161] (  0.0,  13.0+] ( 13.0, 180.0+] (  0.0,  21.0+] ( 21.0, 131.0+]
[165] (  0.0,  96.0+] ( 96.0, 109.0+] (  0.0,  21.0]  (  0.0,  38.0+]
[169] ( 38.0,  39.0+] (  0.0,  31.0+] (  0.0,  11.0+] (  0.0,   6.0]
heart
> heart %>% head()
  start stop event             age           year surgery transplant id
1     0   50     1 -17.15537303217 0.123203285421       0          0  1
2     0    6     1   3.83572895277 0.254620123203       0          0  2
3     0    1     0   6.29705681040 0.265571526352       0          0  3
4     1   16     1   6.29705681040 0.265571526352       0          1  3
5     0   36     0  -7.73716632444 0.490075290897       0          0  4
6    36   39     1  -7.73716632444 0.490075290897       0          1  4
coxph
Cox比例ハザードモデル
> test1 <- list(time=c(4,3,1,1,2,2,3), 
+               status=c(1,1,1,0,1,1,0), 
+               x=c(0,2,1,1,1,0,0), 
+               sex=c(0,0,0,0,1,1,1)) 
> coxph(Surv(time, status) ~ x + strata(sex), test1)
Call:
coxph(formula = Surv(time, status) ~ x + strata(sex), data = test1)
      coef exp(coef) se(coef)       z       p
x 0.802318  2.230706 0.822377 0.97561 0.32926
Likelihood ratio test=1.09  on 1 df, p=0.2971171
n= 7, number of events= 5