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.
getScoreResidualsFromClogit(fit, coefs, y, x, id)
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.
An estimate of the parameters. If the argument fit
is supplied,
this will be replaced by coefficients(fit)
.
The observed outcomes.
The design matrix.
The cluster identification variable.
getScoreResidualsFromClogit
return a list containing:
An \(n\) x \(p\) matrix, where \(n\) is the number of observations and \(p\) is the length of the estimated parameter.
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.
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.