Time-To-Event Analysis

Log-rank Test

A simplest example

where \(r_i\) is the number of subjects at risk at time \(T_i\), \(r_{ik}\) is the subjects from group \(k\) and \(d_i\) is the number of events at the time, When \(W(T_I) = 1\), it is the log-rank test.

  • The \(Z\)s have a covariance matrix

\[\sigma = \sum_T W(T_I)^2 (\frac{r_{ik}}{r_i})(\delta_{kg} - \frac{r_{ig}}{r_i})(\frac{r_i - d_i}{r_i - 1})d_i\]

  • Mantel-Haenszel Logrank Test Formula of log-rank statistic with two exposure groups \(i = A, B\) \[\chi^2_{MHL} = (\frac{O_A - E_A}{\sqrt{Var}})^2 \approx \chi_1^2\] Variance of hypergeometric distribution, if there are two groups: \[Var = \frac{n_{rowsum1} \cdot n_{rowsum2} \cdot n_{colsum1} \cdot n_{colsum2} }{N^2 \cdot (N - 1)}\]

  • Cox-Mantel Logrank Test for two groups \[\chi^2_{CM} = \frac{(O_A - E_A)^2}{E_A} + \frac{(O_B - E_B)^2}{E_B}\]

Call: survdiff(formula = Surv(time, event) ~ treatment, data = df, rho = 0)

        N Observed Expected (O-E)^2/E (O-E)^2/V

treatment=0 1 1 0.5 0.500 1 treatment=1 1 1 1.5 0.167 1

Chisq= 1 on 1 degrees of freedom, p= 0.3

Call: logrank.test(time = df\(time, event = df\)event, group = df$treatment)

N Observed Expected (O-E)^2/E (O-E)^2/V 1 1 1 0.5 0.5 1 2 1 0 0.5 0.5 1

Chisq= 1 on 1 degrees of freedom, p= 0.3 rho = 0 gamma = 0

Call: survdiff(formula = Surv(time, event) ~ treatment, data = df, rho = 0)

        N Observed Expected (O-E)^2/E (O-E)^2/V

treatment=0 1 1 0.5 0.5 1 treatment=1 1 0 0.5 0.5 1

Chisq= 1 on 1 degrees of freedom, p= 0.3

[1] 0.6826895

Kaplan-Meier

Product-limit estimate of survival function

  • Ref: https://www.math.wustl.edu/~sawyer/handouts/greenwood.pdf
  • Survival function: \[S(t) = Pr(T>t)\]
  • Kaplan-Meier estimator: \[\hat{S}(t) = \prod \limits_{t_i \le t} (1 - \frac{d_i}{n_i})\]
  • Greenwood’s confidence interval: \[\hat{Var}[\hat{S}(t)] = \hat{S}(t)^2 \sum\limits_{t_i \le t} \frac{d_i}{n_i(n_i - d_i)}\]
  • Exponential Greenwood confidence interval (guaranteed to lie in 0-1): \[log(-log\hat{S}(t)) \pm z_{\alpha/2}\sqrt{\hat{V}}\] \[\hat{V} = \frac{1}{(log\hat{S}(t))^2} \sum \limits_{t_i \le t} \frac{d_i}{n_i(n_i - d_i)}\]

Logrank Test

Call: survdiff(formula = Surv(y, failed) ~ fac2, data = dt)

  N Observed Expected (O-E)^2/E (O-E)^2/V

fac2=0 500 388 506 27.5 82.3 fac2=1 500 405 287 48.6 82.3

Chisq= 82.3 on 1 degrees of freedom, p= <2e-16

 test           df       pvalue 

1.055442e+02 1.000000e+00 9.280596e-25

Stratified Log-rank Test

Call: survdiff(formula = Surv(y, failed) ~ fac2 + strata(group), data = dt)

  N Observed Expected (O-E)^2/E (O-E)^2/V

fac2=0 500 388 450 8.67 39.6 fac2=1 500 405 342 11.41 39.6

Chisq= 39.6 on 1 degrees of freedom, p= 3e-10

Call: logrank.test(time = dt\(y, event = dt\)failed, group = dt$group)

N Observed Expected (O-E)^2/E (O-E)^2/V 1 2 1 1.33 0.0833 0.154 2 2 2 1.67 0.0667 0.154 3 2 1 1.33 0.0833 0.154 4 2 2 1.67 0.0667 0.154 5 2 1 1.33 0.0833 0.154 6 2 2 1.67 0.0667 0.154 7 2 1 1.33 0.0833 0.154 8 2 2 1.67 0.0667 0.154 9 2 1 1.33 0.0833 0.154 10 2 2 1.67 0.0667 0.154 11 2 1 1.33 0.0833 0.154 12 2 2 1.67 0.0667 0.154 13 2 1 1.33 0.0833 0.154 14 2 2 1.67 0.0667 0.154 15 2 1 1.33 0.0833 0.154 16 2 2 1.67 0.0667 0.154 17 2 1 1.33 0.0833 0.154 18 2 2 1.67 0.0667 0.154 19 2 1 1.33 0.0833 0.154 20 2 2 1.67 0.0667 0.154 21 2 1 1.33 0.0833 0.154 22 2 2 1.67 0.0667 0.154 23 2 1 1.33 0.0833 0.154 24 2 2 1.67 0.0667 0.154 25 2 1 1.33 0.0833 0.154 26 2 2 1.67 0.0667 0.154 27 2 1 1.33 0.0833 0.154 28 2 2 1.67 0.0667 0.154 29 2 1 1.33 0.0833 0.154 30 2 2 1.67 0.0667 0.154 31 2 1 1.33 0.0833 0.154 32 2 2 1.67 0.0667 0.154 33 2 1 1.33 0.0833 0.154 34 2 2 1.67 0.0667 0.154 35 2 1 1.33 0.0833 0.154 36 2 2 1.67 0.0667 0.154 37 2 1 1.33 0.0833 0.154 38 2 2 1.67 0.0667 0.154 39 2 1 1.33 0.0833 0.154 40 2 2 1.67 0.0667 0.154 41 2 1 1.33 0.0833 0.154 42 2 2 1.67 0.0667 0.154 43 2 1 1.33 0.0833 0.154 44 2 2 1.67 0.0667 0.154 45 2 1 1.33 0.0833 0.154 46 2 2 1.67 0.0667 0.154 47 2 1 1.33 0.0833 0.154 48 2 2 1.67 0.0667 0.154 49 2 1 1.33 0.0833 0.154 50 2 2 1.67 0.0667 0.154 51 2 1 1.33 0.0833 0.154 52 2 2 1.67 0.0667 0.154 53 2 1 1.33 0.0833 0.154 54 2 2 1.67 0.0667 0.154 55 2 1 1.33 0.0833 0.154 56 2 2 1.67 0.0667 0.154 57 2 1 1.33 0.0833 0.154 58 2 2 1.67 0.0667 0.154 59 2 1 1.33 0.0833 0.154 60 2 2 1.67 0.0667 0.154 61 2 1 1.33 0.0833 0.154 62 2 2 1.67 0.0667 0.154 63 2 1 1.33 0.0833 0.154 64 2 2 1.67 0.0667 0.154 65 2 1 1.33 0.0833 0.154 66 2 2 1.67 0.0667 0.154 67 2 1 1.33 0.0833 0.154 68 2 2 1.67 0.0667 0.154 69 2 1 1.33 0.0833 0.154 70 2 2 1.67 0.0667 0.154 71 2 1 1.33 0.0833 0.154 72 2 2 1.67 0.0667 0.154 73 2 1 1.33 0.0833 0.154 74 2 2 1.67 0.0667 0.154 75 2 1 1.33 0.0833 0.154 76 2 2 1.67 0.0667 0.154 77 2 1 1.33 0.0833 0.154 78 2 2 1.67 0.0667 0.154 79 2 1 1.33 0.0833 0.154 80 2 2 1.67 0.0667 0.154 81 2 1 1.33 0.0833 0.154 82 2 2 1.67 0.0667 0.154 83 2 1 1.33 0.0833 0.154 84 2 2 1.67 0.0667 0.154 85 2 1 1.33 0.0833 0.154 86 2 2 1.67 0.0667 0.154 87 2 1 1.33 0.0833 0.154 88 2 2 1.67 0.0667 0.154 89 2 1 1.33 0.0833 0.154 90 2 2 1.67 0.0667 0.154 91 2 1 1.33 0.0833 0.154 92 2 2 1.67 0.0667 0.154 93 2 1 1.33 0.0833 0.154 94 2 2 1.67 0.0667 0.154 95 2 1 1.33 0.0833 0.154 96 2 2 1.67 0.0667 0.154 97 2 1 1.33 0.0833 0.154 98 2 2 1.67 0.0667 0.154 99 2 1 1.33 0.0833 0.154 100 2 2 1.67 0.0667 0.154 101 2 1 1.33 0.0833 0.154 102 2 2 1.67 0.0667 0.154 103 2 1 1.33 0.0833 0.154 104 2 2 1.67 0.0667 0.154 105 2 1 1.33 0.0833 0.154 106 2 2 1.67 0.0667 0.154 107 2 1 1.33 0.0833 0.154 108 2 2 1.67 0.0667 0.154 109 2 1 1.33 0.0833 0.154 110 2 2 1.67 0.0667 0.154 111 2 1 1.33 0.0833 0.154 112 2 2 1.67 0.0667 0.154 113 2 1 1.33 0.0833 0.154 114 2 2 1.67 0.0667 0.154 115 2 1 1.33 0.0833 0.154 116 2 2 1.67 0.0667 0.154 117 2 1 1.33 0.0833 0.154 118 2 2 1.67 0.0667 0.154 119 2 1 1.33 0.0833 0.154 120 2 2 1.67 0.0667 0.154 121 2 1 1.33 0.0833 0.154 122 2 2 1.67 0.0667 0.154 123 2 1 1.33 0.0833 0.154 124 2 2 1.67 0.0667 0.154 125 2 1 1.33 0.0833 0.154 126 2 2 1.67 0.0667 0.154 127 2 1 1.33 0.0833 0.154 128 2 2 1.67 0.0667 0.154 129 2 1 1.33 0.0833 0.154 130 2 2 1.67 0.0667 0.154 131 2 1 1.33 0.0833 0.154 132 2 2 1.67 0.0667 0.154 133 2 1 1.33 0.0833 0.154 134 2 2 1.67 0.0667 0.154 135 2 1 1.33 0.0833 0.154 136 2 2 1.67 0.0667 0.154 137 2 1 1.33 0.0833 0.154 138 2 2 1.67 0.0667 0.154 139 2 1 1.33 0.0833 0.154 140 2 2 1.67 0.0667 0.154 141 2 1 1.33 0.0833 0.154 142 2 2 1.67 0.0667 0.154 143 2 1 1.33 0.0833 0.154 144 2 2 1.67 0.0667 0.154 145 2 1 1.33 0.0833 0.154 146 2 2 1.67 0.0667 0.154 147 2 1 1.33 0.0833 0.154 148 2 2 1.67 0.0667 0.154 149 2 1 1.33 0.0833 0.154 150 2 2 1.67 0.0667 0.154 151 2 1 1.33 0.0833 0.154 152 2 2 1.67 0.0667 0.154 153 2 1 1.33 0.0833 0.154 154 2 2 1.67 0.0667 0.154 155 2 1 1.33 0.0833 0.154 156 2 2 1.67 0.0667 0.154 157 2 1 1.33 0.0833 0.154 158 2 2 1.67 0.0667 0.154 159 2 1 1.33 0.0833 0.154 160 2 2 1.67 0.0667 0.154 161 2 1 1.33 0.0833 0.154 162 2 2 1.67 0.0667 0.154 163 2 1 1.33 0.0833 0.154 164 2 2 1.67 0.0667 0.154 165 2 1 1.33 0.0833 0.154 166 2 2 1.67 0.0667 0.154 167 2 1 1.33 0.0833 0.154 168 2 2 1.67 0.0667 0.154 169 2 1 1.33 0.0833 0.154 170 2 2 1.67 0.0667 0.154 171 2 1 1.33 0.0833 0.154 172 2 2 1.67 0.0667 0.154 173 2 1 1.33 0.0833 0.154 174 2 2 1.67 0.0667 0.154 175 2 1 1.33 0.0833 0.154 176 2 2 1.67 0.0667 0.154 177 2 1 1.33 0.0833 0.154 178 2 2 1.67 0.0667 0.154 179 2 1 1.33 0.0833 0.154 180 2 2 1.67 0.0667 0.154 181 2 1 1.33 0.0833 0.154 182 2 2 1.67 0.0667 0.154 183 2 1 1.33 0.0833 0.154 184 2 2 1.67 0.0667 0.154 185 2 1 1.33 0.0833 0.154 186 2 2 1.67 0.0667 0.154 187 2 1 1.33 0.0833 0.154 188 2 2 1.67 0.0667 0.154 189 2 1 1.33 0.0833 0.154 190 2 2 1.67 0.0667 0.154 191 2 1 1.33 0.0833 0.154 192 2 2 1.67 0.0667 0.154 193 2 1 1.33 0.0833 0.154 194 2 2 1.67 0.0667 0.154 195 2 1 1.33 0.0833 0.154 196 2 2 1.67 0.0667 0.154 197 2 1 1.33 0.0833 0.154 198 2 2 1.67 0.0667 0.154 199 2 1 1.33 0.0833 0.154 200 2 2 1.67 0.0667 0.154 201 2 1 1.33 0.0833 0.154 202 2 2 1.67 0.0667 0.154 203 2 1 1.33 0.0833 0.154 204 2 2 1.67 0.0667 0.154 205 2 1 1.33 0.0833 0.154 206 2 2 1.67 0.0667 0.154 207 2 1 1.33 0.0833 0.154 208 2 2 1.67 0.0667 0.154 209 2 1 1.33 0.0833 0.154 210 2 2 1.67 0.0667 0.154 211 2 1 1.33 0.0833 0.154 212 2 2 1.67 0.0667 0.154 213 2 1 1.33 0.0833 0.154 214 2 2 1.67 0.0667 0.154 215 2 1 1.33 0.0833 0.154 216 2 2 1.67 0.0667 0.154 217 2 1 1.33 0.0833 0.154 218 2 2 1.67 0.0667 0.154 219 2 1 1.33 0.0833 0.154 220 2 2 1.67 0.0667 0.154 221 2 1 1.33 0.0833 0.154 222 2 2 1.67 0.0667 0.154 223 2 1 1.33 0.0833 0.154 224 2 2 1.67 0.0667 0.154 225 2 1 1.33 0.0833 0.154 226 2 2 1.67 0.0667 0.154 227 2 1 1.33 0.0833 0.154 228 2 2 1.67 0.0667 0.154 229 2 1 1.33 0.0833 0.154 230 2 2 1.67 0.0667 0.154 231 2 1 1.33 0.0833 0.154 232 2 2 1.67 0.0667 0.154 233 2 1 1.33 0.0833 0.154 234 2 2 1.67 0.0667 0.154 235 2 1 1.33 0.0833 0.154 236 2 2 1.67 0.0667 0.154 237 2 1 1.33 0.0833 0.154 238 2 2 1.67 0.0667 0.154 239 2 1 1.33 0.0833 0.154 240 2 2 1.67 0.0667 0.154 241 2 1 1.33 0.0833 0.154 242 2 2 1.67 0.0667 0.154 243 2 1 1.33 0.0833 0.154 244 2 2 1.67 0.0667 0.154 245 2 1 1.33 0.0833 0.154 246 2 2 1.67 0.0667 0.154 247 2 1 1.33 0.0833 0.154 248 2 2 1.67 0.0667 0.154 249 2 1 1.33 0.0833 0.154 250 2 2 1.67 0.0667 0.154 251 2 1 1.33 0.0833 0.154 252 2 2 1.67 0.0667 0.154 253 2 1 1.33 0.0833 0.154 254 2 2 1.67 0.0667 0.154 255 2 1 1.33 0.0833 0.154 256 2 2 1.67 0.0667 0.154 257 2 1 1.33 0.0833 0.154 258 2 2 1.67 0.0667 0.154 259 2 1 1.33 0.0833 0.154 260 2 2 1.67 0.0667 0.154 261 2 1 1.33 0.0833 0.154 262 2 2 1.67 0.0667 0.154 263 2 1 1.33 0.0833 0.154 264 2 2 1.67 0.0667 0.154 265 2 1 1.33 0.0833 0.154 266 2 2 1.67 0.0667 0.154 267 2 1 1.33 0.0833 0.154 268 2 2 1.67 0.0667 0.154 269 2 1 1.33 0.0833 0.154 270 2 2 1.67 0.0667 0.154 271 2 1 1.33 0.0833 0.154 272 2 2 1.67 0.0667 0.154 273 2 1 1.33 0.0833 0.154 274 2 2 1.67 0.0667 0.154 275 2 1 1.33 0.0833 0.154 276 2 2 1.67 0.0667 0.154 277 2 1 1.33 0.0833 0.154 278 2 2 1.67 0.0667 0.154 279 2 1 1.33 0.0833 0.154 280 2 2 1.67 0.0667 0.154 281 2 1 1.33 0.0833 0.154 282 2 2 1.67 0.0667 0.154 283 2 1 1.33 0.0833 0.154 284 2 2 1.67 0.0667 0.154 285 2 1 1.33 0.0833 0.154 286 2 2 1.67 0.0667 0.154 287 2 1 1.33 0.0833 0.154 288 2 2 1.67 0.0667 0.154 289 2 1 1.33 0.0833 0.154 290 2 2 1.67 0.0667 0.154 291 2 1 1.33 0.0833 0.154 292 2 2 1.67 0.0667 0.154 293 2 1 1.33 0.0833 0.154 294 2 2 1.67 0.0667 0.154 295 2 1 1.33 0.0833 0.154 296 2 2 1.67 0.0667 0.154 297 2 1 1.33 0.0833 0.154 298 2 2 1.67 0.0667 0.154 299 2 1 1.33 0.0833 0.154 300 2 2 1.67 0.0667 0.154 301 2 1 1.33 0.0833 0.154 302 2 2 1.67 0.0667 0.154 303 2 1 1.33 0.0833 0.154 304 2 2 1.67 0.0667 0.154 305 2 1 1.33 0.0833 0.154 306 2 2 1.67 0.0667 0.154 307 2 1 1.33 0.0833 0.154 308 2 2 1.67 0.0667 0.154 309 2 1 1.33 0.0833 0.154 310 2 2 1.67 0.0667 0.154 311 2 1 1.33 0.0833 0.154 312 2 2 1.67 0.0667 0.154 313 2 1 1.33 0.0833 0.154 314 2 2 1.67 0.0667 0.154 315 2 1 1.33 0.0833 0.154 316 2 2 1.67 0.0667 0.154 317 2 1 1.33 0.0833 0.154 318 2 2 1.67 0.0667 0.154 319 2 1 1.33 0.0833 0.154 320 2 2 1.67 0.0667 0.154 321 2 1 1.33 0.0833 0.154 322 2 2 1.67 0.0667 0.154 323 2 1 1.33 0.0833 0.154 324 2 2 1.67 0.0667 0.154 325 2 1 1.33 0.0833 0.154 326 2 2 1.67 0.0667 0.154 327 2 1 1.33 0.0833 0.154 328 2 2 1.67 0.0667 0.154 329 2 1 1.33 0.0833 0.154 330 2 2 1.67 0.0667 0.154 331 2 1 1.33 0.0833 0.154 332 2 2 1.67 0.0667 0.154 333 2 1 1.33 0.0833 0.154 334 2 2 1.67 0.0667 0.154 335 2 1 1.33 0.0833 0.154 336 2 2 1.67 0.0667 0.154 337 2 1 1.33 0.0833 0.154 338 2 2 1.67 0.0667 0.154 339 2 1 1.33 0.0833 0.154 340 2 2 1.67 0.0667 0.154 341 2 1 1.33 0.0833 0.154 342 2 2 1.67 0.0667 0.154 343 2 1 1.33 0.0833 0.154 344 2 2 1.67 0.0667 0.154 345 2 1 1.33 0.0833 0.154 346 2 2 1.67 0.0667 0.154 347 2 1 1.33 0.0833 0.154 348 2 2 1.67 0.0667 0.154 349 2 1 1.33 0.0833 0.154 350 2 2 1.67 0.0667 0.154 351 2 1 1.33 0.0833 0.154 352 2 2 1.67 0.0667 0.154 353 2 1 1.33 0.0833 0.154 354 2 2 1.67 0.0667 0.154 355 2 1 1.33 0.0833 0.154 356 2 2 1.67 0.0667 0.154 357 2 1 1.33 0.0833 0.154 358 2 2 1.67 0.0667 0.154 359 2 1 1.33 0.0833 0.154 360 2 2 1.67 0.0667 0.154 361 2 1 1.33 0.0833 0.154 362 2 2 1.67 0.0667 0.154 363 2 1 1.33 0.0833 0.154 364 2 2 1.67 0.0667 0.154 365 2 1 1.33 0.0833 0.154 366 2 2 1.67 0.0667 0.154 367 2 1 1.33 0.0833 0.154 368 2 2 1.67 0.0667 0.154 369 2 1 1.33 0.0833 0.154 370 2 2 1.67 0.0667 0.154 371 2 1 1.33 0.0833 0.154 372 2 2 1.67 0.0667 0.154 373 2 1 1.33 0.0833 0.154 374 2 2 1.67 0.0667 0.154 375 2 1 1.33 0.0833 0.154 376 2 2 1.67 0.0667 0.154 377 2 1 1.33 0.0833 0.154 378 2 2 1.67 0.0667 0.154 379 2 1 1.33 0.0833 0.154 380 2 2 1.67 0.0667 0.154 381 2 1 1.33 0.0833 0.154 382 2 2 1.67 0.0667 0.154 383 2 1 1.33 0.0833 0.154 384 2 2 1.67 0.0667 0.154 385 2 1 1.33 0.0833 0.154 386 2 2 1.67 0.0667 0.154 387 2 1 1.33 0.0833 0.154 388 2 2 1.67 0.0667 0.154 389 2 1 1.33 0.0833 0.154 390 2 2 1.67 0.0667 0.154 391 2 1 1.33 0.0833 0.154 392 2 2 1.67 0.0667 0.154 393 2 1 1.33 0.0833 0.154 394 2 2 1.67 0.0667 0.154 395 2 1 1.33 0.0833 0.154 396 2 2 1.67 0.0667 0.154 397 2 1 1.33 0.0833 0.154 398 2 2 1.67 0.0667 0.154 399 2 1 1.33 0.0833 0.154 400 2 2 1.67 0.0667 0.154 401 2 1 1.33 0.0833 0.154 402 2 2 1.67 0.0667 0.154 403 2 1 1.33 0.0833 0.154 404 2 2 1.67 0.0667 0.154 405 2 1 1.33 0.0833 0.154 406 2 2 1.67 0.0667 0.154 407 2 1 1.33 0.0833 0.154 408 2 2 1.67 0.0667 0.154 409 2 1 1.33 0.0833 0.154 410 2 2 1.67 0.0667 0.154 411 2 1 1.33 0.0833 0.154 412 2 2 1.67 0.0667 0.154 413 2 1 1.33 0.0833 0.154 414 2 2 1.67 0.0667 0.154 415 2 1 1.33 0.0833 0.154 416 2 2 1.67 0.0667 0.154 417 2 1 1.33 0.0833 0.154 418 2 2 1.67 0.0667 0.154 419 2 1 1.33 0.0833 0.154 420 2 2 1.67 0.0667 0.154 421 2 1 1.33 0.0833 0.154 422 2 2 1.67 0.0667 0.154 423 2 1 1.33 0.0833 0.154 424 2 2 1.67 0.0667 0.154 425 2 1 1.33 0.0833 0.154 426 2 2 1.67 0.0667 0.154 427 2 1 1.33 0.0833 0.154 428 2 2 1.67 0.0667 0.154 429 2 1 1.33 0.0833 0.154 430 2 2 1.67 0.0667 0.154 431 2 1 1.33 0.0833 0.154 432 2 2 1.67 0.0667 0.154 433 2 1 1.33 0.0833 0.154 434 2 2 1.67 0.0667 0.154 435 2 1 1.33 0.0833 0.154 436 2 2 1.67 0.0667 0.154 437 2 1 1.33 0.0833 0.154 438 2 2 1.67 0.0667 0.154 439 2 1 1.33 0.0833 0.154 440 2 2 1.67 0.0667 0.154 441 2 1 1.33 0.0833 0.154 442 2 2 1.67 0.0667 0.154 443 2 1 1.33 0.0833 0.154 444 2 2 1.67 0.0667 0.154 445 2 1 1.33 0.0833 0.154 446 2 2 1.67 0.0667 0.154 447 2 1 1.33 0.0833 0.154 448 2 2 1.67 0.0667 0.154 449 2 1 1.33 0.0833 0.154 450 2 2 1.67 0.0667 0.154 451 2 1 1.33 0.0833 0.154 452 2 2 1.67 0.0667 0.154 453 2 1 1.33 0.0833 0.154 454 2 2 1.67 0.0667 0.154 455 2 1 1.33 0.0833 0.154 456 2 2 1.67 0.0667 0.154 457 2 1 1.33 0.0833 0.154 458 2 2 1.67 0.0667 0.154 459 2 1 1.33 0.0833 0.154 460 2 2 1.67 0.0667 0.154 461 2 1 1.33 0.0833 0.154 462 2 2 1.67 0.0667 0.154 463 2 1 1.33 0.0833 0.154 464 2 2 1.67 0.0667 0.154 465 2 1 1.33 0.0833 0.154 466 2 2 1.67 0.0667 0.154 467 2 1 1.33 0.0833 0.154 468 2 2 1.67 0.0667 0.154 469 2 1 1.33 0.0833 0.154 470 2 2 1.67 0.0667 0.154 471 2 1 1.33 0.0833 0.154 472 2 2 1.67 0.0667 0.154 473 2 1 1.33 0.0833 0.154 474 2 2 1.67 0.0667 0.154 475 2 1 1.33 0.0833 0.154 476 2 2 1.67 0.0667 0.154 477 2 1 1.33 0.0833 0.154 478 2 2 1.67 0.0667 0.154 479 2 1 1.33 0.0833 0.154 480 2 2 1.67 0.0667 0.154 481 2 1 1.33 0.0833 0.154 482 2 2 1.67 0.0667 0.154 483 2 1 1.33 0.0833 0.154 484 2 2 1.67 0.0667 0.154 485 2 1 1.33 0.0833 0.154 486 2 2 1.67 0.0667 0.154 487 2 1 1.33 0.0833 0.154 488 2 2 1.67 0.0667 0.154 489 2 1 1.33 0.0833 0.154 490 2 2 1.67 0.0667 0.154 491 2 1 1.33 0.0833 0.154 492 2 2 1.67 0.0667 0.154 493 2 1 1.33 0.0833 0.154 494 2 2 1.67 0.0667 0.154 495 2 1 1.33 0.0833 0.154 496 2 2 1.67 0.0667 0.154 497 2 1 1.33 0.0833 0.154 498 2 2 1.67 0.0667 0.154 499 2 1 1.33 0.0833 0.154 500 2 2 1.67 0.0667 0.154

Chisq= 0.2 on 1 degrees of freedom, p= 0.7 rho = 0 gamma = 0

fac1 fac2 group y failed 1: 1 0 1 160 TRUE 2: 1 1 1 137 TRUE 3: 1 0 2 145 TRUE 4: 0 1 2 155 TRUE 5: 0 0 3 131 TRUE 6: 0 1 3 13 TRUE

Confidence Band

  • Ref: https://www.nature.com/articles/s41416-022-01920-5
  • https://scholar.princeton.edu/sites/default/files/mikkelpm/files/conf_band.pdf
  • For a one dimensional variable there is a confidence interval, and for a two dimensional plot there is a confidence band.
  • Confidence bands is a collections of confidence intervals for each component of a parameter vector.
  • Pointwise confidence band: the confidence interval for the survival probability at each time point \[ \hat{S}(t_i) \pm z_{1 - \alpha/2} \hat{se} (t_i)\]
  • Simutaneous confidence band: the probability of \(f(x_i)\) is within the intervals for all of \(x_i\) . Assuming \(n\) times of simulation, less than \(\alpha\) percent of \(n\) has any of \(f(x_i)\) locates outside of the intervals (band).

Proportional Hazard

Cox Model

  S
Predictors Estimates CI p
fac1 [1] 2.18 1.87 – 2.53 <0.001
Observations 1000
R2 Nagelkerke 0.092

Testing proportional Hazards Assumption

  • cox.zph() tests corresponding scaled Schoenfeld residuals with time
  • The Schoenfeld residuals are the differences between one individual’s covariates values at the event time and the corresponding risk-weighted average of covariate values among all then at risk.
  • Schoenfeld’s residuals are defined as \[\hat{r}_{(i)} = Z_{(i)} - \frac{\sum Z_j exp(\hat{\beta} Z_j)}{\sum exp(\hat{\beta}Z_j)}\]

where \(Z_{i}\) is the covaraite vector at time \(i\), and the weight is the risk at the time (hazard) considering all covaraites (each individual has different hazard at the time)

  chisq df    p

fac1 0.00285 1 0.96 GLOBAL 0.00285 1 0.96

Example from mgcv

Family: Cox PH Link function: identity

Formula: time ~ sex

Parametric coefficients: Estimate Std. Error z value Pr(>|z|) sex1 -0.08346 0.09248 -0.902 0.367

Deviance explained = 0.0371% -REML = 3041.5 Scale est. = 1 n = 929

Mixed-effect Cox Model

R survival package

Call: coxph(formula = Surv(y, failed) ~ fac2, data = df)

n= 1000, number of events= 794

 coef exp(coef) se(coef)     z Pr(>|z|)  

fac2 0.15200 1.16416 0.07786 1.952 0.0509 .

Signif. codes: 0 ‘’ 0.001 ’’ 0.01 ’’ 0.05 ‘.’ 0.1 ’ ’ 1

exp(coef) exp(-coef) lower .95 upper .95 fac2 1.164 0.859 0.9994 1.356

Concordance= 0.523 (se = 0.009 ) Likelihood ratio test= 3.89 on 1 df, p=0.05 Wald test = 3.81 on 1 df, p=0.05 Score (logrank) test = 3.82 on 1 df, p=0.05

Weibull AFT Regression in R

Sarah R Haile: Weibull AFT Regression Functions in R

Accelerated Failure Time model:

\[ logT = Y = \mu + \alpha^{T}z + \sigma W \]

W has the extreme value distribution.

Extreme Value Distribution

  • Extreme value distributions arise as limiting distributions for maximums or minimums (extreme values) of a sample of independent, identically distributed random variables, as the sample size increases.
  • In the context of reliability modeling, extreme value distributions for the minimum are frequently encountered. For example, if a system consists of n identical components in series, and the system fails when the first of these components fails, then system failure times are the minimum of n random component failure times.
  • Extreme value theory says that, independent of the choice of component model, the system model will approach a Weibull as n becomes large.
  • The same reasoning can also be applied at a component level, if the component failure occurs when the first of many similar competing failure processes reaches a critical level.

\[ \gamma = 1 / \sigma \]

\[ \lambda = exp(-\mu/\sigma)\]

\[ \beta = -\alpha/\sigma \]

The Hazard function of the Weibull model, its first part is the baseline hazard.

\[ h(x|z) = (\gamma \lambda t^{\gamma - 1} ) exp(\beta^{T} z) \]

Weibull

  • $ $ is a shape parameter
  • $ > 1 $ the hazard increases
  • $ = 1 $ the hazard is constant, Weibull reduces to exponential distribution
  • $ < 1 $ the hazard decreases

Hazard Ratio: \[ exp(\beta_i) \]

Event Time Ratio (ETR): the ratio quantifies the relative difference in time it takes to achieve the pth percentile between two lelvels of a covariate \[ exp(\alpha_i) = exp(-\beta_i/\gamma) \]

Surv(time, death) ~ factor(stage) + age

          Estimate         SE

lambda 0.01853664 0.01898690 gamma 1.13014371 0.13844846 factor(stage)2 0.16692694 0.46112943 factor(stage)3 0.66289534 0.35550887 factor(stage)4 1.74502788 0.41476410 age 0.01973646 0.01424135

Weibull with R survreg Package

  • Set scale=0, the scale is estimated
 Length Class           Mode   

formula 3 formula call
coef 12 -none- numeric HR 12 -none- numeric ETR 12 -none- numeric summary 14 summary.survreg list

              HR        LB        UB

factor(stage)2 1.181668 0.4786096 2.917491 factor(stage)3 1.940402 0.9666786 3.894946 factor(stage)4 5.726061 2.5398504 12.909334 age 1.019933 0.9918573 1.048802

          Estimate         SE

lambda 0.01853664 0.01898690 gamma 1.13014371 0.13844846 factor(stage)2 0.16692694 0.46112943 factor(stage)3 0.66289534 0.35550887 factor(stage)4 1.74502788 0.41476410 age 0.01973646 0.01424135

              ETR        LB       UB

factor(stage)2 0.8626863 0.3880879 1.917678 factor(stage)3 0.5562383 0.2971113 1.041364 factor(stage)4 0.2135090 0.1047619 0.435140 age 0.9826879 0.9583820 1.007610

Call: survreg(formula = Surv(time, death) ~ factor(stage) + age, data = larynx, dist = “weibull”) Value Std. Error z p (Intercept) 3.5288 0.9041 3.90 9.5e-05 factor(stage)2 -0.1477 0.4076 -0.36 0.717 factor(stage)3 -0.5866 0.3199 -1.83 0.067 factor(stage)4 -1.5441 0.3633 -4.25 2.1e-05 age -0.0175 0.0128 -1.37 0.172 Log(scale) -0.1223 0.1225 -1.00 0.318

Scale= 0.885

Weibull distribution Loglik(model)= -141.4 Loglik(intercept only)= -151.1 Chisq= 19.37 on 4 degrees of freedom, p= 0.00066 Number of Newton-Raphson Iterations: 5 n= 90

  Surv(time, death)
Predictors Estimates CI p
(Intercept) 34.08 5.79 – 200.50 <0.001
stage [2] 0.86 0.39 – 1.92 0.717
stage [3] 0.56 0.30 – 1.04 0.067
stage [4] 0.21 0.10 – 0.44 <0.001
age 0.98 0.96 – 1.01 0.172
Log(scale) 0.88 0.70 – 1.12 0.318
Observations 90
R2 Nagelkerke 0.201

(Intercept) factor(stage)2 factor(stage)3 factor(stage)4 age 53.9472055 0.8462614 0.5153570 0.1746401 0.9804570

List of 17 $ coefficients : Named num [1:5] 3.5288 -0.1477 -0.5866 -1.5441 -0.0175 ..- attr(, “names”)= chr [1:5] “(Intercept)” “factor(stage)2” “factor(stage)3” “factor(stage)4” … $ icoef : Named num [1:2] 2.0169 -0.0148 ..- attr(, “names”)= chr [1:2] “Intercept” “Log(scale)” $ var : num [1:6, 1:6] 0.8174 -0.0905 -0.0848 -0.0444 -0.0111 … $ loglik : num [1:2] -151 -141 $ iter : int 5 $ linear.predictors: num [1:90] 2.18 2.6 2.74 2.53 2.52 … $ df : int 6 $ scale : num 0.885 $ idf : num 2 $ df.residual : int 84 $ terms :Classes ‘terms’, ‘formula’ language Surv(time, death) ~ factor(stage) + age .. ..- attr(, “variables”)= language list(Surv(time, death), factor(stage), age) .. ..- attr(, “factors”)= int [1:3, 1:2] 0 1 0 0 0 1 .. .. ..- attr(, “dimnames”)=List of 2 .. .. .. ..$ : chr [1:3] “Surv(time, death)” “factor(stage)” “age” .. .. .. ..$ : chr [1:2] “factor(stage)” “age” .. ..- attr(, “term.labels”)= chr [1:2] “factor(stage)” “age” .. ..- attr(, “specials”)=Dotted pair list of 1 .. .. ..$ strata: NULL .. ..- attr(, “order”)= int [1:2] 1 1 .. ..- attr(, “intercept”)= int 1 .. ..- attr(, “response”)= int 1 .. ..- attr(, “.Environment”)=<environment: R_GlobalEnv> .. ..- attr(, “predvars”)= language list(Surv(time, death), factor(stage), age) .. ..- attr(, “dataClasses”)= Named chr [1:3] “nmatrix.2” “factor” “numeric” .. .. ..- attr(, “names”)= chr [1:3] “Surv(time, death)” “factor(stage)” “age” $ contrasts :List of 1 ..$ factor(stage): chr “contr.treatment” $ xlevels :List of 1 ..$ factor(stage): chr [1:4] “1” “2” “3” “4” $ means : Named num [1:5] 1 0.189 0.3 0.144 64.611 ..- attr(, “names”)= chr [1:5] “(Intercept)” “factor(stage)2” “factor(stage)3” “factor(stage)4” … $ call : language survreg(formula = Surv(time, death) ~ factor(stage) + age, data = larynx, dist = “weibull”) $ dist : chr “weibull” $ y : ‘Surv’ num [1:90, 1:2] 0.6 1.3 2.4 2.5+ 3.2 3.2+ 3.3 3.3+ 3.5 3.5 … ..- attr(, “dimnames”)=List of 2 .. ..$ : chr [1:90] “1” “2” “3” “4” … .. ..$ : chr [1:2] “time” “status” ..- attr(, “type”)= chr “right” - attr(, “class”)= chr “survreg”

(Intercept) factor(stage)2 factor(stage)3 factor(stage)4 age 3.12239932 -0.13069503 -0.51901226 -1.36626525 -0.01545261

(Intercept) factor(stage)2 factor(stage)3 factor(stage)4 age 3.52875996 -0.14770417 -0.58655845 -1.54407608 -0.01746367

Call: survreg(formula = Surv(futime, fustat) ~ ecog.ps + rx, data = ovarian, dist = “weibull”, scale = 1)

Coefficients: (Intercept) ecog.ps rx 6.9618376 -0.4331347 0.5815027

Scale fixed at 1

Loglik(model)= -97.2 Loglik(intercept only)= -98 Chisq= 1.67 on 2 degrees of freedom, p= 0.434 n= 26

Call: survreg(formula = Surv(futime, fustat) ~ ecog.ps + rx, data = ovarian, dist = “weibull”, scale = 0)

Coefficients: (Intercept) ecog.ps rx 6.8966931 -0.3850425 0.5286455

Scale= 0.8838731

Loglik(model)= -97.1 Loglik(intercept only)= -98 Chisq= 1.74 on 2 degrees of freedom, p= 0.419 n= 26

AFT Model

AFT Model

\[ log(T) = \alpha_0 + \alpha_1 X + \epsilon\]

  • log(T) = extreme value distribution: Exponential
  • log(T) = extreme value distribution: Weibull, which has an additional parameter that scales \(\epsilon\)
  • log(T) = logistic: log-logistic
  • long(T) = normal: log-normal

  • Accelerated time failure assumption: The probability of a dog surviving past t years is equal to a human surviving past 7*t years.
  • AFT Models describe stretching out or contraction of survival time as a function of predictor variables.
  • AFT assumption: S is survival, \(\gamma\) is acceleration factor \[ S_{non-treatment} = S_{treatment}(\gamma t)\] \[ \gamma T_{non-treatment} = T_{treatment}\]
  • \(\gamma > 1\) exposure benefits survival

Discrete Time Proportional Odds

Data Simulation

  • Assume average daily death rate of 5%
  • Individual baseline death rate has a random effect has standard deviation of the half of the log odds
  • The treatment effect of odds ratio 0.5
  • Subjects are observed for 28 days

[1] 1 [1] 2 [1] 3 [1] 4 [1] 5 [1] 6 [1] 7 [1] 8 [1] 9 [1] 10 [1] 11 [1] 12 [1] 13 [1] 14 [1] 15 [1] 16 [1] 17 [1] 18 [1] 19 [1] 20 [1] 21 [1] 22 [1] 23 [1] 24 [1] 25 [1] 26 [1] 27 [1] 28

x
28000
4
day N
1 1000
2 1000
3 1000
4 1000
5 1000
6 1000
7 1000
8 1000
9 1000
10 1000
11 1000
12 1000
13 1000
14 1000
15 1000
16 1000
17 1000
18 1000
19 1000
20 1000
21 1000
22 1000
23 1000
24 1000
25 1000
26 1000
27 1000
28 1000
day trt N
1 0 500
1 1 500
2 0 500
2 1 500
3 0 500
3 1 500
4 0 500
4 1 500
5 0 500
5 1 500
6 0 500
6 1 500
7 0 500
7 1 500
8 0 500
8 1 500
9 0 500
9 1 500
10 0 500
10 1 500
11 0 500
11 1 500
12 0 500
12 1 500
13 0 500
13 1 500
14 0 500
14 1 500
15 0 500
15 1 500
16 0 500
16 1 500
17 0 500
17 1 500
18 0 500
18 1 500
19 0 500
19 1 500
20 0 500
20 1 500
21 0 500
21 1 500
22 0 500
22 1 500
23 0 500
23 1 500
24 0 500
24 1 500
25 0 500
25 1 500
26 0 500
26 1 500
27 0 500
27 1 500
28 0 500
28 1 500
day event N
1 0 906
1 1 94
2 0 840
2 1 66
2 NA 94
3 0 801
3 1 39
3 NA 160
4 0 756
4 1 45
4 NA 199
5 0 728
5 1 28
5 NA 244
6 0 699
6 1 29
6 NA 272
7 0 668
7 1 31
7 NA 301
8 0 642
8 1 26
8 NA 332
9 0 616
9 1 26
9 NA 358
10 0 594
10 1 22
10 NA 384
11 0 575
11 1 19
11 NA 406
12 0 554
12 1 21
12 NA 425
13 0 538
13 1 16
13 NA 446
14 0 521
14 1 17
14 NA 462
15 0 508
15 1 13
15 NA 479
16 0 490
16 1 18
16 NA 492
17 0 477
17 1 13
17 NA 510
18 0 459
18 1 18
18 NA 523
19 0 445
19 1 14
19 NA 541
20 0 436
20 1 9
20 NA 555
21 0 421
21 1 15
21 NA 564
22 0 414
22 1 7
22 NA 579
23 0 402
23 1 12
23 NA 586
24 0 390
24 1 12
24 NA 598
25 0 382
25 1 8
25 NA 610
26 0 374
26 1 8
26 NA 618
27 0 367
27 1 7
27 NA 626
28 0 365
28 1 2
28 NA 633

[1] 16003 4

day event N 1: 1 1 94 2: 2 1 66 3: 3 1 39 4: 4 1 45 5: 5 1 28 6: 6 1 29 7: 7 1 31 8: 8 1 26 9: 9 1 26 10: 10 1 22 11: 11 1 19 12: 12 1 21 13: 13 1 16 14: 14 1 17 15: 15 1 13 16: 16 1 18 17: 17 1 13 18: 18 1 18 19: 19 1 14 20: 20 1 9 21: 21 1 15 22: 22 1 7 23: 23 1 12 24: 24 1 12 25: 25 1 8 26: 26 1 8 27: 27 1 7 28: 28 0 365 29: 28 1 2 day event N

Longitudinal Mixed-Effect Model R::lme4

Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) [glmerMod] Family: binomial ( logit ) Formula: event ~ trt + (1 | id) Data: dt

AIC BIC logLik deviance df.resid 5201.2 5224.2 -2597.6 5195.2 16000

Scaled residuals: Min 1Q Median 3Q Max -0.4267 -0.2080 -0.1460 -0.1227 5.4049

Random effects: Groups Name Variance Std.Dev. id (Intercept) 1.681 1.296
Number of obs: 16003, groups: id, 1000

Fixed effects: Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.86631 0.08675 -33.042 < 2e-16 trt -0.63140 0.12564 -5.026 5.02e-07 — Signif. codes: 0 ‘’ 0.001 ’’ 0.01 ’’ 0.05 ‘.’ 0.1 ’ ’ 1

Correlation of Fixed Effects: (Intr) trt -0.685

(Intercept) trt 0.05690833 0.53184909

Multi-state Transition Model

Christopher Jackcon: Multi-state modelling with R: the msm package https://cran.r-project.org/web/packages/msm/vignettes/msm-manual.pdf

Basic Setting

PTNUM age years dage sex pdiag cumrej state firstobs statemax
100002 52.49589 0.000000 21 0 IHD 0 1 1 1
100002 53.49863 1.002740 21 0 IHD 2 1 0 1
100002 54.49863 2.002740 21 0 IHD 2 2 0 2
100002 55.58904 3.093151 21 0 IHD 2 2 0 2
100002 56.49589 4.000000 21 0 IHD 3 2 0 2
100002 57.49315 4.997260 21 0 IHD 3 3 0 3
100002 58.35068 5.854794 21 0 IHD 3 4 0 4
100003 29.50685 0.000000 17 0 IHD 0 1 1 1
100003 30.69589 1.189041 17 0 IHD 1 1 0 1
100003 31.51507 2.008219 17 0 IHD 1 3 0 3
100003 32.49863 2.991781 17 0 IHD 2 4 0 4
100004 35.89589 0.000000 16 0 IDC 0 1 1 1
100004 36.89863 1.002740 16 0 IDC 2 1 0 1
100004 37.90685 2.010959 16 0 IDC 2 1 0 1
100004 38.90685 3.010959 16 0 IDC 2 1 0 1
100004 39.90411 4.008219 16 0 IDC 2 1 0 1
100004 40.88767 4.991781 16 0 IDC 2 1 0 1
100004 41.91781 6.021918 16 0 IDC 2 2 0 2
100004 42.91507 7.019178 16 0 IDC 2 3 0 3
100004 43.91233 8.016438 16 0 IDC 2 3 0 3
100004 44.79726 8.901370 16 0 IDC 2 4 0 4
1 2 3 4
1367 204 44 148
46 134 54 48
4 13 107 55

Simple bidirectional model

  • The sizes of the confidence intervals for some of the hazard ratios suggest there is no information in the data about the corresponding covariate effects.
State 1 State 2 State 3 State 4
State 1 -0.1703708 0.1278703 0.0000000 0.0425004
State 2 0.2251191 -0.6079406 0.3426113 0.0402102
State 3 0.0000000 0.1306223 -0.4370975 0.3064751
State 4 0.0000000 0.0000000 0.0000000 0.0000000
State 1 State 2 State 3 State 4
State 1 -0.1693783 0.1274526 0.0000000 0.0419257
State 2 0.2264506 -0.5840266 0.3369304 0.0206457
State 3 0.0000000 0.1305034 -0.4417834 0.3112799
State 4 0.0000000 0.0000000 0.0000000 0.0000000
State 1 State 2 State 3 State 4
State 1 -0.1774692 0.1361227 0.0000000 0.0413466
State 2 0.2199231 -0.6049398 0.3340928 0.0509239
State 3 0.0000000 0.1291315 -0.4105008 0.2813693
State 4 0.0000000 0.0000000 0.0000000 0.0000000

Transition-specific covariate

  • The transition rate from state 1 to state 2, and the rate from state 1 to state 4 are each modelled on sex as a covariate, but no other intensities have covariates on them.
  • The covariate will not apply hazard ratio on the specified transition.
State 1 State 2 State 3 State 4
State 1 -0.1690980 0.1266621 0.0000000 0.0424359
State 2 0.2263286 -0.6085284 0.3420243 0.0401754
State 3 0.0000000 0.1305118 -0.4363934 0.3058815
State 4 0.0000000 0.0000000 0.0000000 0.0000000

Constrained covariate effects

  • This contrains the effect of sex to be equal for the progression rates q12, q23, and recovery rates q21, q32.
  • The index on the transition intensities, ordered by rows, could be used as constraint indicators. There are totally 7 intensities and 7 hazard ratios for covariate sex. list(sex=c(1,2,3,4,5,6,7)) means all hazard ratios are distinct, and list(sex=c(1,2,3,4,5,6,1) means the first and 7th hazard ratios are same.
State 1 State 2 State 3 State 4
State 1 -0.1709543 0.1284715 0.0000000 0.0424828
State 2 0.2308112 -0.6104315 0.3389085 0.0407118
State 3 0.0000000 0.1332416 -0.4320289 0.2987873
State 4 0.0000000 0.0000000 0.0000000 0.0000000

Computing Environment

R version 4.2.0 (2022-04-22) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.3 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3 LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3

locale: [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] msm_1.7 SurvRegCensCov_1.5 KMsurv_0.1-5
[4] npsurvSS_1.0.1 powerSurvEpi_0.1.3 km.ci_0.5-6
[7] sjPlot_2.8.12 survminer_0.4.9 ggpubr_0.6.0
[10] coxed_0.3.3 rms_6.5-0 SparseM_1.81
[13] Hmisc_4.8-0 Formula_1.2-5 lattice_0.20-45
[16] nph_2.1 survival_3.2-13 Wu_0.0.0.9000
[19] flexdashboard_0.6.1 lme4_1.1-31 Matrix_1.5-3
[22] mgcv_1.8-38 nlme_3.1-152 png_0.1-8
[25] scales_1.2.1 nnet_7.3-16 labelled_2.10.0
[28] kableExtra_1.3.4 plotly_4.10.1 gridExtra_2.3
[31] ggplot2_3.4.1 DT_0.27 tableone_0.13.2
[34] magrittr_2.0.3 lubridate_1.9.2 dplyr_1.1.0
[37] plyr_1.8.8 data.table_1.14.8 rmdformats_1.0.4
[40] knitr_1.42

loaded via a namespace (and not attached): [1] backports_1.4.1 systemfonts_1.0.4 lazyeval_0.2.2
[4] splines_4.2.0 TH.data_1.1-1 digest_0.6.29
[7] htmltools_0.5.4 fansi_1.0.4 checkmate_2.1.0
[10] cluster_2.1.2 modelr_0.1.10 sandwich_3.0-2
[13] svglite_2.1.1 timechange_0.2.0 jpeg_0.1-10
[16] colorspace_2.1-0 rvest_1.0.3 mitools_2.4
[19] haven_2.5.2 xfun_0.37 jsonlite_1.8.4
[22] zoo_1.8-11 glue_1.6.2 gtable_0.3.1
[25] emmeans_1.8.4-1 webshot_0.5.4 MatrixModels_0.5-1 [28] sjstats_0.18.2 sjmisc_2.8.9 car_3.1-1
[31] abind_1.4-5 mvtnorm_1.1-3 DBI_1.1.3
[34] rstatix_0.7.2 ggeffects_1.2.0 Rcpp_1.0.10
[37] gridtext_0.1.5 viridisLite_0.4.1 xtable_1.8-4
[40] performance_0.10.2 htmlTable_2.4.1 foreign_0.8-81
[43] survey_4.1-1 datawizard_0.6.5 htmlwidgets_1.5.4
[46] httr_1.4.5 RColorBrewer_1.1-3 ellipsis_0.3.2
[49] farver_2.1.1 pkgconfig_2.0.3 sass_0.4.5
[52] deldir_1.0-6 utf8_1.2.2 effectsize_0.8.3
[55] labeling_0.4.2 tidyselect_1.2.0 rlang_1.1.1
[58] munsell_0.5.0 tools_4.2.0 cachem_1.0.6
[61] cli_3.6.0 generics_0.1.3 sjlabelled_1.2.0
[64] broom_1.0.3 evaluate_0.20 stringr_1.5.0
[67] fastmap_1.1.0 yaml_2.3.7 survMisc_0.5.6
[70] purrr_1.0.1 quantreg_5.94 pracma_2.4.2
[73] xml2_1.3.3 compiler_4.2.0 rstudioapi_0.14
[76] ggsignif_0.6.4 tibble_3.1.8 bslib_0.4.2
[79] stringi_1.7.12 parameters_0.20.2 highr_0.9
[82] forcats_1.0.0 markdown_1.1 nloptr_2.0.3
[85] vctrs_0.5.2 pillar_1.8.1 lifecycle_1.0.3
[88] jquerylib_0.1.4 estimability_1.4.1 insight_0.19.0
[91] R6_2.5.1 latticeExtra_0.6-30 bookdown_0.32
[94] muhaz_1.2.6.4 codetools_0.2-18 polspline_1.1.22
[97] boot_1.3-28 MASS_7.3-54 withr_2.5.0
[100] multcomp_1.4-22 expm_0.999-7 ggtext_0.1.2
[103] bayestestR_0.13.0 hms_1.1.2 grid_4.2.0
[106] rpart_4.1-15 tidyr_1.3.0 coda_0.19-4
[109] minqa_1.2.5 rmarkdown_2.20 carData_3.0-5
[112] numDeriv_2016.8-1.1 base64enc_0.1-3 interp_1.1-3