Learn R Programming

survMisc (version 0.4.6)

local: Local tests for a model

Description

Local tests for a model

Usage

locScore(x, ...)

## S3 method for class 'coxph': locScore(x, ..., all = FALSE, hypo = NULL, ties = c("breslow", "efron", "exact"))

locLR(x, ...)

## S3 method for class 'coxph': locLR(x, ..., all = FALSE, hypo = NULL, ties = c("breslow", "efron", "exact"))

locWald(x, ...)

## S3 method for class 'coxph': locWald(x, ..., all = FALSE, hypo = NULL)

Arguments

x
A model of class coxph
...
Additional arguments (not implemented)
all
Fit all combinations of predictors
hypo
Hypothesis to test. There should be at least one coefficient to exclude and one to keep. This is a specified as vector of the same length as the number of coefficients in the model. This should be a logical vector (i.e. composed of TRUE an
ties
Method of handling ties when refitting model. Must be one of breslow, efron or exact.

Value

  • For locScore a list with the following elements, which are data.tables:
  • coefcoefficients from refitted model(s)
  • scorehypothesis and chi-square test
  • For locLR and locWald, a data.table showing the hypothesis being tested and the results of the test.

Details

The null hypothesis is that some of the coefficients in the model are zero ($H_0 : \hat{B}_i=0, \quad i \geq 1$) vs. the alternative that at least one of them is nonzero. All of these tests are distributed as chi-square with degrees of freedom $=$ number of excluded coefficients. For the score test, the model is fitted again with the coefficients of interest excluded. A value for the remaining coefficients is obtained. Then the complete model is fit again using these new values as initial values for those remaining coefficients and using zero as the initial value for the excluded coefficients. Values for the excluded coefficients are generated without iteration. (I.e. the first values calculated, with no convergence towards maximum likelihood estimators). The test is: $$\chi_{SC}^2 = U^T I^{-1} U$$ where $U$ is the score vector and $I^{-1}$ is the covariance or inverse of the information matrix. (These are given by colSums(survival::coxph.detail(x)$score) and x$var respectively). For the likelihood ratio test, the model is also refit with the coefficients of interest excluded. The likelihood ratios from the full model and those with coefficients excluded are used to construct the test: $$\chi^2_{LR} = 2(LR_{full} - LR_{excluded})$$ The Wald chi-squared statistic is given by: $$\chi^2_W = \hat{B}^T I^{-1} \hat{B}$$ Where $\hat{B}$ is the vector of fitted coefficients (from the complete model) thought to be $=0$. $I^{-1}$ is composed of the corresponding elements from the covariance matrix of the model.

References

Examples are from: K&M Example 8.2, pp 264-6.

Examples

Run this code
data(larynx, package="KMsurv")
c1 <- coxph(Surv(time, delta) ~ factor(stage) + age, data=larynx)
locScore(c1, all=TRUE)
locScore(c1, hypo=c(0, 0, 0, 1))
locScore(coxph(Surv(time, delta) ~ stage + age, data=larynx))
###
data(larynx, package="KMsurv")
c1 <- coxph(Surv(time, delta) ~ factor(stage) + age, data=larynx, method="breslow")
locLR(c1, all=TRUE)
locLR(c1, hypo=c(FALSE, FALSE, FALSE, TRUE))
###
data(larynx, package="KMsurv")
c1 <- coxph(Surv(time, delta) ~ factor(stage) + age, data=larynx, method="breslow")
locWald(c1, all=TRUE)
locWald(c1, hypo=c(0, 0, 0, 1))

Run the code above in your browser using DataLab