estimate_sandwich_matrices: Estimate component matrices of the empirical sandwich...

View source: R/estimate_funs.R

estimate_sandwich_matricesR 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 m_estimation_basis

.theta

vector of parameter estimates (i.e. estimated roots)

Details

For a set of estimating equations (sum_i ψ(O_i, θ) = 0), this function computes:

A_i = \partial ψ(O_i, θ)/\partial θ

A = ∑_i A_i

B_i = outer(ψ(O_i, θ), ψ(O_i, θ))

B = ∑_i B_i

where all of the above are evaluated at hat(θ). The partial derivatives in A_i numerically approximated by the function defined in deriv_control.

Note that A = ∑_i A_i and not A = ∑_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)))

geex documentation built on Aug. 8, 2022, 5:05 p.m.