View source: R/estimate_funs.R
estimate_sandwich_matrices | R Documentation |
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.
estimate_sandwich_matrices(.basis, .theta)
.basis |
basis an object of class |
.theta |
vector of parameter estimates (i.e. estimated roots) |
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.
a sandwich_components
object
Stefanski, L. A., & Boos, D. D. (2002). The calculus of m-estimation. The American Statistician, 56(1), 29-38.
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)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.