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
number at risk
e
number of events
n1
number at risk (by predictor).
If $2$ groups, should be given as a vector with
the number at risk for group $1$.
If $\geq 2$ groups, a matrix with one column for each group.
Value
An array. The first two dimensions = number of groups.
This is the square matrix below.
The third dimension is the number of observations (time points).
Where there are $2$ groups, the resulting sparse square matrix
(i.e. the non-diagonal elements are $0$)
at time $i$ has diagonal elements:
$$v_i = - \frac{n_{0i} n_{1i} e_i (n_i-e_i)}{n_i^2(n_i-1)}$$
where $n_1$ is the number at risk in group $1$.
For $\geq 2$ 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)}$$