Computes the c index and the corresponding
generalization of Somers' Dxy rank correlation for a censored response
variable. Also works for uncensored and binary responses,
although its use of all possible pairings
makes it slow for this purpose. Dxy and c are related by
var{Dxy} = 2*(var{c} - 0.5).
rcorr.cens handles one predictor variable. rcorrcens
computes rank correlation measures separately by a series of
predictors. In addition, rcorrcens has a rough way of handling
categorical predictors. If a categorical (factor) predictor has two
levels, it is coverted to a numeric having values 1 and 2. If it has
more than 2 levels, an indicator variable is formed for the most
frequently level vs. all others, and another indicator for the second
most frequent level and all others. The correlation is taken as the
maximum of the two (in absolute value).
Usage
rcorr.cens(x, S, outx=FALSE)
## S3 method for class 'formula'
rcorrcens(formula, data=NULL, subset=NULL,
na.action=na.retain, exclude.imputed=TRUE, outx=FALSE,
...)
Arguments
x
a numeric predictor variable
S
an Surv object or a vector. If a vector, assumes that every
observation is uncensored.
outx
set to TRUE to not count pairs of observations tied on x as a
relevant pair. This results in a Goodman–Kruskal gamma type rank
correlation.
formula
a formula with a Surv object or a numeric vector
on the left-hand side
data, subset, na.action
the usual options for models. Default for na.action is to retain
all values, NA or not, so that NAs can be deleted in only a pairwise
fashion.
exclude.imputed
set to FALSE to include imputed values (created by
impute) in the calculations.
...
extra arguments passed to biVar.
Value
rcorr.cens returns a vector with the following named elements:
C Index, Dxy, S.D., n, missing,
uncensored, Relevant Pairs, Concordant, and
Uncertain
n
number of observations not missing on any input variables
missing
number of observations missing on x or S
relevant
number of pairs of non-missing observations for which
S could be ordered
concordant
number of relevant pairs for which x and S
are concordant.
uncertain
number of pairs of non-missing observations for which
censoring prevents classification of concordance of x and
S.
rcorrcens.formula returns an object of class biVar
which is documented with the biVar function.