Modifies the matrices in a sandwich_components object using the function and options in a correct_control object. The function correction is a utility for creating correct_control objects.

correct_by(.components, .correct_control)

Arguments

.components

an object of class sandwich_components

.correct_control

an object of class correct_control

Value

the result of .FUN in .correct_control.

Details

See the finite sample corrections vignette for further examples.

See also

fay_bias_correction and fay_df_correction for corrections provided by geex

Examples

myee <- function(data){
   function(theta){
    c(data$Y1 - theta[1],
     (data$Y1 - theta[1])^2 - theta[2])
   }
 }
mybasis <- create_basis(
   estFUN = myee,
   data   = geexex)
mats <- estimate_sandwich_matrices(mybasis, .theta = c(5.04, 10.04))
correct_by(mats,
   .correct_control =  correction(fay_bias_correction, b = .75))
#>            [,1]       [,2]
#> [1,] 0.10142687 0.03705025
#> [2,] 0.03705025 2.51737009