Skip to contents

M_i = delta_i - H0(t_i) exp(x_i' beta): observed events minus expected. They sum to zero at the fitted beta, which is returned so the fit can be checked.

Usage

Martingale(time, event, X, beta)

morie_survival_martingale(time, event, X, beta)

Arguments

time

observed follow-up times.

event

event indicator, 1 = event, 0 = censored.

X

covariate matrix, one row per subject.

beta

fitted coefficient vector.

Value

list with the residuals, their sum, and the cumulative baseline hazard.

References

Therneau, T. M., Grambsch, P. M. and Fleming, T. R. (1990). Martingale-based residuals for survival models. Biometrika 77(1), 147-160.

Examples

Martingale(time = c(1, 2, 3, 4, 5, 6, 7, 8), event = c(0, 1, 0, 1, 1, 0, 1, 0),
  X = c(1, 2, 3, 4, 5, 6, 7, 8), beta = 0.5)
#> $residuals
#> [1]  0.00000000  0.97980034 -0.03330361  0.88707941  0.71228910 -0.47435509
#> [7] -0.15961999 -1.91189015
#> 
#> $expected
#> [1] 0.00000000 0.02019966 0.03330361 0.11292059 0.28771090 0.47435509 1.15961999
#> [8] 1.91189015
#> 
#> $sum
#> [1] -3.608225e-16
#> 
#> $sums_to_zero
#> [1] TRUE
#> 
#> $max
#> [1] 0.9798003
#> 
#> $min
#> [1] -1.91189
#> 
#> $upper_bound
#> [1] 1
#> 
#> $n
#> [1] 8
#> 
#> $skewed
#> [1] TRUE
#> 
#> $method
#> [1] "M_i = delta_i - H0(t_i) exp(x_i' beta), Breslow baseline"
#>