Get the (conditional) score residuals from conditional logistic regression
Get the (conditional) score residuals from conditional logistic regression
A function to obtain the conditional score residuals from conditional logistic regression as well as the sum of derivatives of these residuals with respect to the parameters evaluated at the estimated parameters.
latin1
getScoreResidualsFromClogit(fit, coefs, y, x, id)
Arguments
fit: A fitted object. Could be any object that has a class.function coefficients, but is intended to be used with clogit in the survival package.
coefs: An estimate of the parameters. If the argument fit is supplied, this will be replaced by coefficients(fit).
y: The observed outcomes.
x: The design matrix.
id: The cluster identification variable.
Details
getScoreResidualsFromClogit calculates the residuals from the conditional score equations used in conditional logistic regression as we as the sums of their derivatives with respect to the paramaters.
This is useful if one wants to use a calculate the sandwich estimate of a variance where the uncertainty in the estimation of a conditional odds ratio needs to be taken into account.
Returns
getScoreResidualsFromClogit return a list containing:
U: An n x p matrix, where n is the number of observations and p is the length of the estimated parameter.
dU.sum: An p x p matrix containing the sums of the derivatives. The rows correspond to the estimating equations and the columns correspond to the partial derivatives.
dU.mean: The mean cluster sum of the derivatives of the score residuals from the conditional likelihood.