ahaz.adjust {ahaz} | R Documentation |
Fast calculation of univariate association measures in the semiparametric additive risk model, adjusted for user-specified covariates
ahaz.adjust(surv, X, weights, idx, method=c("coef", "z", "crit"))
surv |
Response in the form of a survival object, as returned by the
function |
X |
Design matrix. Missing values are not supported. |
weights |
Optional vector of observation weights. Default is 1 for each observation. |
idx |
Vector specifying the indices of the covariates to adjust for. |
method |
The type of adjusted association measure to calculate. See details. |
The function is intended mainly for programming use and
screening purposes, when a very large number of covariates are considered and direct application of
ahaz
is unfeasible.
Running this function is equivalent to running ahaz
with
design matrix cbind(X[,i],X[,idx])
for each column X[,i]
in
X
. By utilizing basic matrix identities, ahaz.adjust
runs many times faster.
The following univariate association measures are currently implemented:
method="z"
, Z-statistics, obtained from a
fitted ahaz
model.
method="coef"
, regression coefficients, obtained from a
fitted ahaz
model.
method="crit"
, the increase in
the natural loss function of the
semiparametric additive hazards model when the covariate is included
in the model.
A list containing the following elements:
call |
The call that produced this object. |
idx |
A copy of the argument |
adj |
Adjusted association statistic, as specified by |
data(sorlie) # Break ties set.seed(10101) time <- sorlie$time+runif(nrow(sorlie))*1e-2 # Survival data + covariates surv <- Surv(time,sorlie$status) X <- as.matrix(sorlie[,3:ncol(sorlie)]) # Adjust for first 10 covariates idx <- 1:10 a <- ahaz.adjust(surv,X,idx=idx) # Compare with (slower) solution b <- apply(X[,-idx],2,function(x){coef(ahaz(surv,cbind(x,X[,idx])))[1]}) plot(b,a$adj[-idx])