Using the rootFUN specified by the user (defaults to multiroot), this function estimates the roots of the equations: $$G_m = sum_i psi(O_i, \hat{\theta}) = 0$$

estimate_GFUN_roots(.basis)

Arguments

.basis

an object of class m_estimation_basis

Value

the output of the rootFUN function

Details

This is primilary an internal function used within m_estimate, but it is exported for use in debugging and development.

For an example of how to use a different rootFUN, see the root solver vignette, vignette('geex_root_solvers', package = 'geex').

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)

# Add a control for the root solver
mycontrol <- new('geex_control', .root = setup_root_control(start = c(1, 1)))
mybasis@.control <- mycontrol

# Now estimate roots of GFUN
roots <- estimate_GFUN_roots(mybasis)
roots
#> $root
#> [1]  5.044563 10.041239
#> 
#> $f.root
#> [1] -2.131628e-14 -2.238210e-13
#> 
#> $iter
#> [1] 4
#> 
#> $estim.precis
#> [1] 1.225686e-13
#>