Computes predicted survival probabilities or hazards and optionally confidence limits (for survival only) for parametric survival models fitted with psm. If getting predictions for more than one observation, times must be specified. For a model without predictors, no input data are specified.

# S3 method for class 'psm'
survest(fit, newdata, linear.predictors, x, times, fun,
        loglog=FALSE, conf.int=0.95,
        what=c("survival","hazard","parallel"), ...)

# S3 method for class 'survest.psm'
print(x, ...)

Arguments

fit

fit from psm

newdata, linear.predictors, x, times, conf.int

see survest.cph. One of newdata, linear.predictors, x must be given. linear.predictors includes the intercept. If times is omitted, predictions are made at 200 equally spaced points between 0 and the maximum failure/censoring time used to fit the model.

x can also be a result from survest.psm.

what

The default is to compute survival probabilities. Set what="hazard" or some abbreviation of "hazard" to compute hazard rates. what="parallel" assumes that the length of times is the number of subjects (or one), and causes survest to estimate the \(i^{th}\) subject's survival probability at the \(i^{th}\) value of times (or at the scalar value of times). what="parallel" is used by val.surv for example.

loglog

set to TRUE to transform survival estimates and confidence limits using log-log

fun

a function to transform estimates and optional confidence intervals

...

unused

Value

see survest.cph. If the model has no predictors, predictions are made with respect to varying time only, and the returned object is of class "npsurv" so the survival curve can be plotted with survplot.npsurv. If times is omitted, the entire survival curve or hazard from t=0,...,fit$maxtime is estimated, with increments computed to yield 200 points where fit$maxtime is the maximum survival time in the data used in model fitting. Otherwise, the times vector controls the time points used.

Details

Confidence intervals are based on asymptotic normality of the linear predictors. The intervals account for the fact that a scale parameter may have been estimated jointly with beta.

Author

Frank Harrell
Department of Biostatistics
Vanderbilt University
fh@fharrell.com

Examples

# Simulate data from a proportional hazards population model
require(survival)
n <- 1000
set.seed(731)
age <- 50 + 12*rnorm(n)
label(age) <- "Age"
cens <- 15*runif(n)
h <- .02*exp(.04*(age-50))
dt <- -log(runif(n))/h
label(dt) <- 'Follow-up Time'
e <- ifelse(dt <= cens,1,0)
dt <- pmin(dt, cens)
units(dt) <- "Year"
S <- Surv(dt,e)

f <- psm(S ~ lsp(age,c(40,70)))
survest(f, data.frame(age=seq(20,80,by=5)), times=2)
#> 
#> N: 1000 	Events: 139	Time:2 Years
#> 
#>    LinearPredictor survival   Lower   Upper      SE
#> 1           6.2065  0.99663 0.97663 0.99952 0.99277
#> 2           5.6785  0.99419 0.97554 0.99863 0.73817
#> 3           5.1506  0.99000 0.97406 0.99617 0.49051
#> 4           4.6226  0.98282 0.97103 0.98984 0.26965
#> 5           4.0947  0.97056 0.95649 0.98013 0.20306
#> 6           3.9544  0.96606 0.95288 0.97559 0.17083
#> 7           3.8141  0.96087 0.94798 0.97062 0.14875
#> 8           3.6739  0.95492 0.94093 0.96566 0.14164
#> 9           3.5336  0.94808 0.93075 0.96117 0.15163
#> 10          3.3934  0.94024 0.91670 0.95728 0.17583
#> 11          3.2531  0.93126 0.89821 0.95385 0.20936
#> 12          2.9313  0.90550 0.86250 0.93555 0.20351
#> 13          2.6095  0.87078 0.78557 0.92373 0.28383

#Get predicted survival curve for 40 year old
survest(f, data.frame(age=40))
#> 
#> N: 1000 	Events: 139
#> 
#>          Time survival   Lower   Upper      SE
#> 1    0.000000  1.00000 1.00000 1.00000     Inf
#> 2    0.075369  0.99899 0.99778 0.99954 0.40040
#> 3    0.150739  0.99793 0.99587 0.99896 0.35318
#> 4    0.226108  0.99685 0.99405 0.99834 0.32635
#> 5    0.301477  0.99577 0.99228 0.99768 0.30778
#> 6    0.376847  0.99468 0.99055 0.99700 0.29370
#> 7    0.452216  0.99358 0.98886 0.99630 0.28243
#> 8    0.527585  0.99248 0.98718 0.99559 0.27309
#> 9    0.602955  0.99137 0.98553 0.99486 0.26515
#> 10   0.678324  0.99026 0.98389 0.99412 0.25828
#> 11   0.753693  0.98915 0.98227 0.99337 0.25225
#> 12   0.829063  0.98803 0.98065 0.99261 0.24689
#> 13   0.904432  0.98691 0.97905 0.99184 0.24209
#> 14   0.979802  0.98579 0.97746 0.99106 0.23774
#> 15   1.055171  0.98467 0.97587 0.99028 0.23379
#> 16   1.130540  0.98355 0.97430 0.98949 0.23018
#> 17   1.205910  0.98243 0.97273 0.98870 0.22686
#> 18   1.281279  0.98131 0.97116 0.98790 0.22379
#> 19   1.356648  0.98018 0.96961 0.98710 0.22094
#> 20   1.432018  0.97906 0.96805 0.98630 0.21830
#> 21   1.507387  0.97793 0.96650 0.98549 0.21584
#> 22   1.582756  0.97680 0.96496 0.98467 0.21353
#> 23   1.658126  0.97568 0.96342 0.98386 0.21137
#> 24   1.733495  0.97455 0.96189 0.98304 0.20934
#> 25   1.808864  0.97342 0.96036 0.98222 0.20743
#> 26   1.884234  0.97229 0.95883 0.98140 0.20563
#> 27   1.959603  0.97117 0.95730 0.98057 0.20393
#> 28   2.034972  0.97004 0.95578 0.97975 0.20233
#> 29   2.110342  0.96891 0.95426 0.97892 0.20081
#> 30   2.185711  0.96778 0.95275 0.97809 0.19936
#> 31   2.261080  0.96665 0.95124 0.97726 0.19799
#> 32   2.336450  0.96553 0.94973 0.97642 0.19669
#> 33   2.411819  0.96440 0.94822 0.97559 0.19546
#> 34   2.487189  0.96327 0.94671 0.97475 0.19428
#> 35   2.562558  0.96214 0.94521 0.97392 0.19315
#> 36   2.637927  0.96102 0.94371 0.97308 0.19208
#> 37   2.713297  0.95989 0.94221 0.97224 0.19106
#> 38   2.788666  0.95877 0.94071 0.97140 0.19008
#> 39   2.864035  0.95764 0.93922 0.97057 0.18915
#> 40   2.939405  0.95651 0.93772 0.96973 0.18826
#> 41   3.014774  0.95539 0.93623 0.96889 0.18741
#> 42   3.090143  0.95426 0.93474 0.96805 0.18659
#> 43   3.165513  0.95314 0.93325 0.96720 0.18581
#> 44   3.240882  0.95202 0.93177 0.96636 0.18506
#> 45   3.316251  0.95089 0.93028 0.96552 0.18434
#> 46   3.391621  0.94977 0.92880 0.96468 0.18365
#> 47   3.466990  0.94865 0.92731 0.96384 0.18299
#> 48   3.542359  0.94753 0.92583 0.96300 0.18236
#> 49   3.617729  0.94640 0.92436 0.96216 0.18175
#> 50   3.693098  0.94528 0.92288 0.96132 0.18117
#> 51   3.768467  0.94416 0.92140 0.96047 0.18061
#> 52   3.843837  0.94304 0.91993 0.95963 0.18007
#> 53   3.919206  0.94192 0.91845 0.95879 0.17955
#> 54   3.994576  0.94081 0.91698 0.95795 0.17905
#> 55   4.069945  0.93969 0.91551 0.95711 0.17858
#> 56   4.145314  0.93857 0.91404 0.95627 0.17812
#> 57   4.220684  0.93746 0.91257 0.95543 0.17768
#> 58   4.296053  0.93634 0.91110 0.95459 0.17725
#> 59   4.371422  0.93523 0.90964 0.95375 0.17685
#> 60   4.446792  0.93411 0.90817 0.95291 0.17645
#> 61   4.522161  0.93300 0.90671 0.95208 0.17608
#> 62   4.597530  0.93189 0.90525 0.95124 0.17571
#> 63   4.672900  0.93077 0.90378 0.95040 0.17537
#> 64   4.748269  0.92966 0.90232 0.94956 0.17503
#> 65   4.823638  0.92855 0.90087 0.94873 0.17471
#> 66   4.899008  0.92744 0.89941 0.94789 0.17440
#> 67   4.974377  0.92633 0.89795 0.94706 0.17410
#> 68   5.049746  0.92523 0.89649 0.94622 0.17382
#> 69   5.125116  0.92412 0.89504 0.94539 0.17354
#> 70   5.200485  0.92301 0.89359 0.94455 0.17328
#> 71   5.275854  0.92191 0.89213 0.94372 0.17303
#> 72   5.351224  0.92080 0.89068 0.94289 0.17278
#> 73   5.426593  0.91970 0.88923 0.94206 0.17255
#> 74   5.501963  0.91859 0.88778 0.94123 0.17233
#> 75   5.577332  0.91749 0.88634 0.94040 0.17211
#> 76   5.652701  0.91639 0.88489 0.93957 0.17191
#> 77   5.728071  0.91529 0.88344 0.93874 0.17171
#> 78   5.803440  0.91419 0.88200 0.93791 0.17152
#> 79   5.878809  0.91309 0.88056 0.93708 0.17134
#> 80   5.954179  0.91199 0.87911 0.93625 0.17116
#> 81   6.029548  0.91090 0.87767 0.93543 0.17100
#> 82   6.104917  0.90980 0.87623 0.93460 0.17084
#> 83   6.180287  0.90870 0.87479 0.93378 0.17068
#> 84   6.255656  0.90761 0.87335 0.93296 0.17054
#> 85   6.331025  0.90652 0.87192 0.93213 0.17040
#> 86   6.406395  0.90542 0.87048 0.93131 0.17027
#> 87   6.481764  0.90433 0.86905 0.93049 0.17014
#> 88   6.557133  0.90324 0.86761 0.92967 0.17002
#> 89   6.632503  0.90215 0.86618 0.92885 0.16990
#> 90   6.707872  0.90106 0.86475 0.92803 0.16979
#> 91   6.783241  0.89997 0.86332 0.92721 0.16969
#> 92   6.858611  0.89889 0.86189 0.92640 0.16959
#> 93   6.933980  0.89780 0.86046 0.92558 0.16950
#> 94   7.009350  0.89672 0.85903 0.92477 0.16941
#> 95   7.084719  0.89563 0.85761 0.92395 0.16933
#> 96   7.160088  0.89455 0.85618 0.92314 0.16925
#> 97   7.235458  0.89347 0.85476 0.92232 0.16917
#> 98   7.310827  0.89238 0.85334 0.92151 0.16910
#> 99   7.386196  0.89130 0.85191 0.92070 0.16904
#> 100  7.461566  0.89022 0.85049 0.91989 0.16898
#> 101  7.536935  0.88914 0.84908 0.91908 0.16892
#> 102  7.612304  0.88807 0.84766 0.91827 0.16886
#> 103  7.687674  0.88699 0.84624 0.91747 0.16882
#> 104  7.763043  0.88591 0.84482 0.91666 0.16877
#> 105  7.838412  0.88484 0.84341 0.91585 0.16873
#> 106  7.913782  0.88377 0.84200 0.91505 0.16869
#> 107  7.989151  0.88269 0.84058 0.91425 0.16865
#> 108  8.064520  0.88162 0.83917 0.91344 0.16862
#> 109  8.139890  0.88055 0.83776 0.91264 0.16859
#> 110  8.215259  0.87948 0.83635 0.91184 0.16857
#> 111  8.290628  0.87841 0.83495 0.91104 0.16855
#> 112  8.365998  0.87734 0.83354 0.91024 0.16853
#> 113  8.441367  0.87628 0.83213 0.90944 0.16851
#> 114  8.516737  0.87521 0.83073 0.90864 0.16850
#> 115  8.592106  0.87415 0.82933 0.90785 0.16849
#> 116  8.667475  0.87308 0.82793 0.90705 0.16848
#> 117  8.742845  0.87202 0.82653 0.90626 0.16848
#> 118  8.818214  0.87096 0.82513 0.90546 0.16847
#> 119  8.893583  0.86990 0.82373 0.90467 0.16847
#> 120  8.968953  0.86884 0.82233 0.90388 0.16848
#> 121  9.044322  0.86778 0.82094 0.90309 0.16848
#> 122  9.119691  0.86672 0.81954 0.90230 0.16849
#> 123  9.195061  0.86566 0.81815 0.90151 0.16850
#> 124  9.270430  0.86461 0.81676 0.90072 0.16851
#> 125  9.345799  0.86355 0.81536 0.89993 0.16852
#> 126  9.421169  0.86250 0.81398 0.89915 0.16854
#> 127  9.496538  0.86144 0.81259 0.89836 0.16856
#> 128  9.571907  0.86039 0.81120 0.89758 0.16858
#> 129  9.647277  0.85934 0.80981 0.89679 0.16860
#> 130  9.722646  0.85829 0.80843 0.89601 0.16863
#> 131  9.798015  0.85724 0.80705 0.89523 0.16865
#> 132  9.873385  0.85620 0.80566 0.89445 0.16868
#> 133  9.948754  0.85515 0.80428 0.89367 0.16871
#> 134 10.024124  0.85410 0.80290 0.89289 0.16874
#> 135 10.099493  0.85306 0.80153 0.89211 0.16877
#> 136 10.174862  0.85201 0.80015 0.89133 0.16881
#> 137 10.250232  0.85097 0.79877 0.89056 0.16884
#> 138 10.325601  0.84993 0.79740 0.88978 0.16888
#> 139 10.400970  0.84889 0.79603 0.88901 0.16892
#> 140 10.476340  0.84785 0.79465 0.88823 0.16896
#> 141 10.551709  0.84681 0.79328 0.88746 0.16900
#> 142 10.627078  0.84577 0.79191 0.88669 0.16905
#> 143 10.702448  0.84474 0.79055 0.88592 0.16909
#> 144 10.777817  0.84370 0.78918 0.88515 0.16914
#> 145 10.853186  0.84267 0.78782 0.88438 0.16919
#> 146 10.928556  0.84163 0.78645 0.88361 0.16924
#> 147 11.003925  0.84060 0.78509 0.88284 0.16929
#> 148 11.079294  0.83957 0.78373 0.88208 0.16934
#> 149 11.154664  0.83854 0.78237 0.88131 0.16939
#> 150 11.230033  0.83751 0.78101 0.88055 0.16945
#> 151 11.305402  0.83648 0.77965 0.87978 0.16950
#> 152 11.380772  0.83546 0.77830 0.87902 0.16956
#> 153 11.456141  0.83443 0.77694 0.87826 0.16962
#> 154 11.531511  0.83341 0.77559 0.87750 0.16968
#> 155 11.606880  0.83238 0.77424 0.87674 0.16973
#> 156 11.682249  0.83136 0.77289 0.87598 0.16980
#> 157 11.757619  0.83034 0.77154 0.87522 0.16986
#> 158 11.832988  0.82932 0.77019 0.87447 0.16992
#> 159 11.908357  0.82830 0.76884 0.87371 0.16998
#> 160 11.983727  0.82728 0.76750 0.87295 0.17005
#> 161 12.059096  0.82626 0.76616 0.87220 0.17011
#> 162 12.134465  0.82524 0.76481 0.87145 0.17018
#> 163 12.209835  0.82423 0.76347 0.87069 0.17025
#> 164 12.285204  0.82321 0.76213 0.86994 0.17032
#> 165 12.360573  0.82220 0.76080 0.86919 0.17038
#> 166 12.435943  0.82119 0.75946 0.86844 0.17045
#> 167 12.511312  0.82018 0.75812 0.86769 0.17053
#> 168 12.586681  0.81917 0.75679 0.86695 0.17060
#> 169 12.662051  0.81816 0.75546 0.86620 0.17067
#> 170 12.737420  0.81715 0.75413 0.86545 0.17074
#> 171 12.812789  0.81614 0.75280 0.86471 0.17082
#> 172 12.888159  0.81513 0.75147 0.86396 0.17089
#> 173 12.963528  0.81413 0.75014 0.86322 0.17096
#> 174 13.038898  0.81313 0.74882 0.86248 0.17104
#> 175 13.114267  0.81212 0.74749 0.86173 0.17112
#> 176 13.189636  0.81112 0.74617 0.86099 0.17119
#> 177 13.265006  0.81012 0.74485 0.86025 0.17127
#> 178 13.340375  0.80912 0.74353 0.85951 0.17135
#> 179 13.415744  0.80812 0.74221 0.85878 0.17143
#> 180 13.491114  0.80712 0.74090 0.85804 0.17151
#> 181 13.566483  0.80613 0.73958 0.85730 0.17159
#> 182 13.641852  0.80513 0.73827 0.85657 0.17167
#> 183 13.717222  0.80414 0.73696 0.85583 0.17175
#> 184 13.792591  0.80314 0.73565 0.85510 0.17183
#> 185 13.867960  0.80215 0.73434 0.85437 0.17191
#> 186 13.943330  0.80116 0.73303 0.85363 0.17200
#> 187 14.018699  0.80017 0.73172 0.85290 0.17208
#> 188 14.094068  0.79918 0.73042 0.85217 0.17216
#> 189 14.169438  0.79819 0.72911 0.85144 0.17225
#> 190 14.244807  0.79720 0.72781 0.85071 0.17233
#> 191 14.320176  0.79622 0.72651 0.84999 0.17242
#> 192 14.395546  0.79523 0.72521 0.84926 0.17250
#> 193 14.470915  0.79425 0.72392 0.84853 0.17259
#> 194 14.546285  0.79327 0.72262 0.84781 0.17267
#> 195 14.621654  0.79228 0.72132 0.84708 0.17276
#> 196 14.697023  0.79130 0.72003 0.84636 0.17285
#> 197 14.772393  0.79032 0.71874 0.84564 0.17294
#> 198 14.847762  0.78934 0.71745 0.84492 0.17302
#> 199 14.923131  0.78837 0.71616 0.84419 0.17311
#> 200 14.998501  0.78739 0.71487 0.84347 0.17320

#Get hazard function for 40 year old
survest(f, data.frame(age=40), what="hazard")$surv #still called surv
#> Warning: conf.int ignored for what="hazard"
#>   [1] 0.015080 0.013881 0.014192 0.014378 0.014511 0.014616 0.014701 0.014774
#>   [9] 0.014838 0.014894 0.014944 0.014990 0.015032 0.015070 0.015106 0.015140
#>  [17] 0.015171 0.015200 0.015228 0.015255 0.015280 0.015304 0.015327 0.015349
#>  [25] 0.015369 0.015390 0.015409 0.015428 0.015446 0.015463 0.015480 0.015496
#>  [33] 0.015512 0.015527 0.015542 0.015557 0.015571 0.015584 0.015598 0.015611
#>  [41] 0.015623 0.015636 0.015648 0.015660 0.015671 0.015682 0.015693 0.015704
#>  [49] 0.015715 0.015725 0.015735 0.015745 0.015755 0.015765 0.015774 0.015784
#>  [57] 0.015793 0.015802 0.015810 0.015819 0.015828 0.015836 0.015844 0.015852
#>  [65] 0.015860 0.015868 0.015876 0.015884 0.015891 0.015899 0.015906 0.015913
#>  [73] 0.015920 0.015928 0.015934 0.015941 0.015948 0.015955 0.015961 0.015968
#>  [81] 0.015974 0.015981 0.015987 0.015993 0.015999 0.016005 0.016011 0.016017
#>  [89] 0.016023 0.016029 0.016035 0.016040 0.016046 0.016052 0.016057 0.016063
#>  [97] 0.016068 0.016073 0.016079 0.016084 0.016089 0.016094 0.016099 0.016104
#> [105] 0.016109 0.016114 0.016119 0.016124 0.016129 0.016134 0.016138 0.016143
#> [113] 0.016148 0.016152 0.016157 0.016161 0.016166 0.016170 0.016175 0.016179
#> [121] 0.016183 0.016188 0.016192 0.016196 0.016200 0.016205 0.016209 0.016213
#> [129] 0.016217 0.016221 0.016225 0.016229 0.016233 0.016237 0.016241 0.016245
#> [137] 0.016248 0.016252 0.016256 0.016260 0.016264 0.016267 0.016271 0.016275
#> [145] 0.016278 0.016282 0.016285 0.016289 0.016293 0.016296 0.016300 0.016303
#> [153] 0.016306 0.016310 0.016313 0.016317 0.016320 0.016323 0.016327 0.016330
#> [161] 0.016333 0.016337 0.016340 0.016343 0.016346 0.016349 0.016353 0.016356
#> [169] 0.016359 0.016362 0.016365 0.016368 0.016371 0.016374 0.016377 0.016380
#> [177] 0.016383 0.016386 0.016389 0.016392 0.016395 0.016398 0.016401 0.016404
#> [185] 0.016407 0.016410 0.016412 0.016415 0.016418 0.016421 0.016424 0.016426
#> [193] 0.016429 0.016432 0.016435 0.016437 0.016440 0.016443 0.016445 0.016448