knitr::opts_chunk$set(echo = TRUE)
library(asaur)
head(gastricXelox,10)
## timeWeeks delta
## 1 4 1
## 2 8 1
## 3 8 1
## 4 8 1
## 5 9 1
## 6 11 1
## 7 12 1
## 8 13 1
## 9 16 1
## 10 16 1
table(gastricXelox$delta)#censoring data 1death of Progression 0 censored info xis
##
## 0 1
## 16 32
range(gastricXelox$timeWeeks)#length of followup time rounded nearset week
## [1] 4 253
plot(gastricXelox,pch=20)#a lot of deaths occurs soon in the followup cohort
abline(v=max(gastricXelox$timeWeeks[gastricXelox$delta==1]))
#note that censoring clusterr occurs before that timeframe...!!!Suspect Usually expect uniformly distributed censoring if not informative one!
##Kaplan Meier estimator
library(survival)
xeloxframe=Surv(gastricXelox$timeWeeks,gastricXelox$delta)
survfit(Surv(gastricXelox$timeWeeks,gastricXelox$delta)~1)#an surv object KM summary
## Call: survfit(formula = Surv(gastricXelox$timeWeeks, gastricXelox$delta) ~
## 1)
##
## n events median 0.95LCL 0.95UCL
## [1,] 48 32 44.5 28 76
plot(survfit(Surv(gastricXelox$timeWeeks,gastricXelox$delta)~1),xlab="weeks",ylab="prob Survival",main="Xelox Phase II Cohort- Kaplan Meier estim.",sub="conftype=plain",conf.type="plain" )
abline(v=44.5,lty=2,col=2)
plot(survfit(Surv(gastricXelox$timeWeeks,gastricXelox$delta)~1),xlab="weeks",ylab="prob Survival",main="Xelox Phase II Cohort- Kaplan Meier estim.",mark.time = TRUE,conf.type = "log-log",sub="conftype=log-log")
abline(v=44.5,lty=2,col=2)
###HAZARD RATE
library(muhaz)
## Warning: le package 'muhaz' a été compilé avec la version R 4.5.1
muhaz(gastricXelox$timeWeeks,gastricXelox$delta,bw.grid=5,b.cor="none")
## $pin
## $pin$times
## [1] 4 8 8 8 9 11 12 13 16 16 17 17 19 21 24 24 25 28 28
## [20] 30 37 37 42 43 43 46 48 50 51 53 54 57 59 59 60 64 66 76
## [39] 78 91 119 120 139 176 187 203 217 253
##
## $pin$delta
## [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 0 1 0 0 0 1 1 1 1 1
## [39] 1 0 0 0 0 0 0 0 0 0
##
## $pin$nobs
## [1] 48
##
## $pin$min.time
## [1] 0
##
## $pin$max.time
## [1] 78
##
## $pin$n.min.grid
## [1] 51
##
## $pin$min.grid
## [1] 0.00 1.56 3.12 4.68 6.24 7.80 9.36 10.92 12.48 14.04 15.60 17.16
## [13] 18.72 20.28 21.84 23.40 24.96 26.52 28.08 29.64 31.20 32.76 34.32 35.88
## [25] 37.44 39.00 40.56 42.12 43.68 45.24 46.80 48.36 49.92 51.48 53.04 54.60
## [37] 56.16 57.72 59.28 60.84 62.40 63.96 65.52 67.08 68.64 70.20 71.76 73.32
## [49] 74.88 76.44 78.00
##
## $pin$n.est.grid
## [1] 101
##
## $pin$bw.pilot
## [1] 4.875
##
## $pin$bw.smooth
## [1] 24.375
##
## $pin$method
## [1] 2
##
## $pin$b.cor
## [1] 0
##
## $pin$kernel.type
## [1] 1
##
##
## $est.grid
## [1] 0.00 0.78 1.56 2.34 3.12 3.90 4.68 5.46 6.24 7.02 7.80 8.58
## [13] 9.36 10.14 10.92 11.70 12.48 13.26 14.04 14.82 15.60 16.38 17.16 17.94
## [25] 18.72 19.50 20.28 21.06 21.84 22.62 23.40 24.18 24.96 25.74 26.52 27.30
## [37] 28.08 28.86 29.64 30.42 31.20 31.98 32.76 33.54 34.32 35.10 35.88 36.66
## [49] 37.44 38.22 39.00 39.78 40.56 41.34 42.12 42.90 43.68 44.46 45.24 46.02
## [61] 46.80 47.58 48.36 49.14 49.92 50.70 51.48 52.26 53.04 53.82 54.60 55.38
## [73] 56.16 56.94 57.72 58.50 59.28 60.06 60.84 61.62 62.40 63.18 63.96 64.74
## [85] 65.52 66.30 67.08 67.86 68.64 69.42 70.20 70.98 71.76 72.54 73.32 74.10
## [97] 74.88 75.66 76.44 77.22 78.00
##
## $haz.est
## [1] 0.001125000 0.001828950 0.002380800 0.002780550 0.003492277 0.006329543
## [7] 0.009402638 0.011819144 0.013768180 0.015575804 0.017413726 0.018913268
## [13] 0.019861547 0.020148877 0.019272307 0.019209877 0.019321380 0.019542967
## [19] 0.020368525 0.021969452 0.022086732 0.021897419 0.021666834 0.020918422
## [25] 0.019950905 0.019601977 0.019188122 0.018107369 0.017591839 0.017718736
## [31] 0.018785247 0.020155090 0.021113353 0.022137775 0.022579737 0.022061088
## [37] 0.020147702 0.016839579 0.014576522 0.012669850 0.010683257 0.007966042
## [43] 0.007583540 0.008266669 0.009088751 0.009336905 0.010365143 0.010862238
## [49] 0.011798898 0.013251292 0.015018974 0.015682682 0.015242415 0.014554973
## [55] 0.014174556 0.015594690 0.016124566 0.015764185 0.014513545 0.012372646
## [61] 0.009341490 0.006836168 0.006164716 0.007139270 0.007412145 0.006983341
## [67] 0.007165137 0.007721811 0.007894232 0.007682400 0.009342316 0.012430905
## [73] 0.015909892 0.017996422 0.018690493 0.019650000 0.021716877 0.024637026
## [79] 0.025987369 0.028675706 0.029998637 0.029143363 0.026109883 0.024077237
## [85] 0.022856923 0.021551923 0.019076923 0.015431923 0.010616923 0.006651800
## [91] 0.003680000 0.000099800 0.003830400 0.007106400 0.011577251 0.017541273
## [97] 0.022111505 0.025287949 0.027070604 0.027459469 0.026454545
##
## $bw.loc
## [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [39] 0 0 0 0 0 0 0 0 0 0 0 0 0
##
## $bw.loc.sm
## [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [75] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
##
## $msemin
## [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [39] 0 0 0 0 0 0 0 0 0 0 0 0 0
##
## $bias.min
## [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [39] 0 0 0 0 0 0 0 0 0 0 0 0 0
##
## $var.min
## [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [39] 0 0 0 0 0 0 0 0 0 0 0 0 0
##
## $imse.opt
## [1] 0
##
## attr(,"class")
## [1] "muhaz"
253/78#kernel range
## [1] 3.24359
plot(muhaz(gastricXelox$timeWeeks,gastricXelox$delta,bw.grid=4,b.cor="none"))
4*78
## [1] 312
It is not clear how the bin grid timeframe is construct What is 78 is weeks or 78 time the bin grid ? TBC soon