Compute loss associated with a vector of structural parameters between some data and a transformation of structural parameters

loss_function(
  theta,
  prediction_function = {     function(theta) theta },
  weights = 1L,
  verbose = FALSE,
  return_moment = FALSE,
  moments_weights = NULL,
  moments_weighting_formula = "w ~ moments_weights",
  ...
)

Arguments

theta

Vector of structural parameters. Assuming a named vector.

prediction_function

Function that transforms \(\theta\) into vector of moments. In Newey and MacFadden, denoted \(g(\theta)\)

weights

Weight matrix \(W\) that should be used

verbose

Logical value indicating whether we want to print informative messages to monitor progress

return_moment

Logical value indicating whether we want to return moment matrix (observed, simulation, difference)

moments_weights

User-defined weights that should be applied to reweight moments importance. This is a user choice independent of using an optimal weight matrix

moments_weighting_formula

When relevent, how moment weighting should enter in the objective function

...

Additional arguments that should be used to control prediction_function behavior. This function should return a data.table object with a variable denoted epsilon giving the distance that should be minimized

Value

A distance between empirical and simulated moments

estimation_theta for GMM estimation