Skip to contents

s_i = x_i minus the weighted risk-set mean at each event time. Grambsch and Therneau's scaled version tests proportional hazards by regressing the residuals on time.

Usage

Schoenfeld(time, event, X, beta, vcov = NULL, scaled = TRUE)

morie_survival_schoenfeld(time, event, X, beta, vcov = NULL, scaled = TRUE)

Arguments

time

observed follow-up times.

event

event indicator, 1 = event, 0 = censored.

X

covariate matrix, one row per subject.

beta

fitted coefficient vector.

vcov

covariance matrix of beta, used to scale the residuals.

scaled

whether to return the scaled residuals.

Value

list with the residuals, the event times, and the proportional-hazards test statistic and p-value.

References

Grambsch, P. M. and Therneau, T. M. (1994). Proportional hazards tests and diagnostics based on weighted residuals. Biometrika 81(3), 515-526.

Examples

ST <- c(5, 6, 6, 2.5, 4, 4, 3, 3, 1, 2, 2, 3, 7, 8, 9, 10)
SE <- c(1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1)
SX <- matrix((seq_along(ST) - 1)%%2, ncol = 1)
Schoenfeld(ST, SE, SX, 0.3, vcov = matrix(0.25, 1, 1))
#> $time
#>  [1]  1.0  2.0  2.5  3.0  4.0  5.0  6.0  7.0  9.0 10.0
#> 
#> $residuals
#>             [,1]
#>  [1,] -0.5744425
#>  [2,]  0.3932834
#>  [3,]  0.3883744
#>  [4,] -0.5744425
#>  [5,] -0.5192047
#>  [6,] -0.5030794
#>  [7,] -0.5744425
#>  [8,] -0.5744425
#>  [9,] -0.5744425
#> [10,]  0.0000000
#> 
#> $n_events
#> [1] 10
#> 
#> $ties_dropped
#> [1] 2
#> 
#> $p
#> [1] 1
#> 
#> $method
#> [1] "Grambsch and Therneau (1994) scaled Schoenfeld residuals and the correlation-with-time PH test"
#> 
#> $scaled
#>             [,1]
#>  [1,] -1.1361063
#>  [2,]  1.2832085
#>  [3,]  1.2709359
#>  [4,] -1.1361063
#>  [5,] -0.9980116
#>  [6,] -0.9576986
#>  [7,] -1.1361063
#>  [8,] -1.1361063
#>  [9,] -1.1361063
#> [10,]  0.3000000
#> 
#> $ph_test
#> $ph_test[[1]]
#> $ph_test[[1]]$rho
#> [1] -0.2120096
#> 
#> $ph_test[[1]]$z
#> [1] -0.6360289
#> 
#> $ph_test[[1]]$p_value
#> [1] 0.5247576
#> 
#> 
#> 
#> $ph_violated
#> [1] FALSE
#>