loss_function: Compute loss function in a flexible way

Description Usage Arguments Value

View source: R/loss_function.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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 θ into vector of moments. In Newey and MacFadden, denoted g(θ)

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


linogaliana/mindist documentation built on July 11, 2021, 4:22 a.m.