coxScoreHess | R Documentation |
Calculate the Score vector or the Hessian matrix for the Cox proportional hazards model with inputs of covariates, survival outcomes and the relative risks
coxScoreHess(X, y, exb, hess = FALSE)
X |
the covariate matrix from model.matrix, without the interecpt term. |
y |
y is a survival object, y = Surv(time, event). |
exb |
exb is the relative risks with exb = exp(X*beta). |
hess |
output the Hessian matrix, with hess = FALSE as the default, which outputs the score vector only, |
The survival time shall be sorted from the largest to the smallest, an error will occur if y is not sorted.
score = sum(event*(X - S1/S))
Sigma = sum(S1*t(S1))
H = sum(event*(S2/S0 - S1*t(S1)/S0))
the robust varaince can be calculated by inv(H)*Sigma*inv(H).
An p by 1 vector of the score of the function calculated at the point relative exp(X*beta). If hess = TRUE, then a list with the following three components is returned:
score |
a 1 x p score vector. |
Sigma |
a p x p matrix for the empirical varaince of the score. |
H |
a p x p hessian matrix. |
numHessian
numScore
multiRoot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.