Learn R Programming

survMisc (version 0.4.2)

covMatSurv: Covariance matrix for survival data

Description

Gives variance-covariance matrix for comparing survival data for two or more groups. Inputs are vectors corresponding to observations at a set of discrete time points for right censored data, except for $n1$, the no. at risk by predictor. This should be specified as a vector for one group, otherwise as a matrix with each column corresponding to a group.

Usage

covMatSurv(t, n, e, n1)

Arguments

t
time
n
no. at risk
e
no. events
n1
no. at risk (by predictor). If 2 groups, should be given as a vector n1 with no. at risk for n1. If more than 2 groups, a matrix with a column for each group.

Value

  • An array. First two dimensions = no. groups. Third dimension is no. observations (time points). Where there are two groups, the resulting sparse square matrix at time $i$ has diagonal elements: $$v_i = - \frac{n0_i n1_i e_i (n_i-e_i)}{n_i^2(n_i-1)}$$ where $n1$ is the no. at risk in group 1. For more than two groups, the resulting square matrix has diagonal elements: $$v_{kki} = \frac{n_{ki}(n_i-n_{ki})e_i(n_i-e_i)}{n_i^2(n_i-1)}$$ and off diagonal elements: $$v_{kli} = \frac{ -n_{ki}n_{li} e_i(n_i-e_i)}{n_i^2(n_i-1)}$$

See Also

Called by comp

Examples

Run this code
data(tneKidney)
covMatSurv(t=tneKidney$t,n=tneKidney$n,e=tneKidney$e,n1=tneKidney$n_1)

Run the code above in your browser using DataLab