ahaz (version 1.14)

ahaz.partial: Partial calculation of estimating quantities used by ahaz

Description

Partial calculation of the quantities used in the estimating equations for ahaz.

Usage

ahaz.partial(surv, X, weights, idx)

Arguments

surv

Response in the form of a survival object, as returned by the function Surv() in the package survival. Right-censored and counting process format (left-truncation) is supported. Tied survival times are not supported.

X

Design matrix. Missing values are not supported.

weights

Optional vector of observation weights. Default is 1 for each observation.

idx

Vector of indices of covariates to use in the calculations.

Value

A list containing the following elements:

call

The call that produced this object.

idx

A copy of the argument idx.

nobs

Number of observations.

nvars

Number of covariates.

d

Vector of length length(idx).

D

Matrix of size length(idx) x nvars.

B

Matrix of size length(idx) x nvars.

Details

The function is intended mainly for programming use when a very large number of covariates are considered and direct application of ahaz is unfeasible.

The estimating equations for the semiparametric additive hazards model are of the form \(D\beta=d\) with \(D\) a quadratic matrix with number of columns equal to the number of covariates. The present function returns d[idx], D[idx,], and B[idx,]; the latter a matrix such that \(D^{-1} B D^{-1}\) estimates the covariance matrix of the regression coefficients.

See Also

ahaz, ahaz.adjust.

Examples

Run this code
# NOT RUN {
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)])

# Get D for the first 10 covariates only
a<-ahaz.partial(surv,X,idx=1:10)
pD1 <- a$D

# Equivalent to the (slower) solution
b <- ahaz(surv,X)
pD2 <- b$D[1:10,]
max(abs(pD1-pD2))

# }

Run the code above in your browser using DataCamp Workspace