estimate_sandwich_matrices {geex} | R Documentation |
Estimate component matrices of the empirical sandwich covariance estimator
Description
For a given set of estimating equations computes the 'meat' (B_m
in Stefanski and Boos notation) and 'bread' (A_m
in Stefanski and
Boos notation) matrices necessary to compute the covariance matrix.
Usage
estimate_sandwich_matrices(.basis, .theta)
Arguments
.basis |
basis an object of class |
.theta |
vector of parameter estimates (i.e. estimated roots) |
Details
For a set of estimating equations (\sum_i \psi(O_i, \theta) = 0
),
this function computes:
A_i = \partial \psi(O_i, \theta)/\partial \theta
A = \sum_i A_i
B_i = \psi(O_i, \theta)\psi(O_i, \theta)^T
B = \sum_i B_i
where all of the above are evaluated at \hat{\theta}
. The partial derivatives in A_i
numerically approximated by the function defined in deriv_control
.
Note that A = \sum_i A_i
and not \sum_i A_i/m
, and the same for B
.
Value
a sandwich_components
object
References
Stefanski, L. A., & Boos, D. D. (2002). The calculus of m-estimation. The American Statistician, 56(1), 29-38.
Examples
myee <- function(data){
function(theta){
c(data$Y1 - theta[1],
(data$Y1 - theta[1])^2 - theta[2])
}
}
# Start with a basic basis
mybasis <- create_basis(
estFUN = myee,
data = geexex)
# Now estimate sandwich matrices
estimate_sandwich_matrices(
mybasis, c(mean(geexex$Y1), var(geexex$Y1)))