estimation_theta.Rd
User front-end function for indirect inference on microsimulated data. Estimation is performed using simulated method of moments and is a particular case of extremum estimator. Theoretical framework can be found on Gourieroux et al. (1993) .
Weight matrix \(W\) is either assumed to be identity
(approach
= "one_stage") or
estimated with the optimal weight matrix as
proposed by Hansen (1982)
.
In the former case, known as feasible GMM,
(approach
= "two_stage")
estimation_theta( theta_0, prediction_function = { function(theta) theta }, objective_function = loss_function, approach = c("two_step", "one_step"), ... )
theta_0 | Initial values for \(\theta\) parameter. This can be a named vector |
---|---|
prediction_function | Function to transform |
objective_function | How to transform output from prediction_function into an objective function. Included for flexibility but not recommanded to change that default option |
approach | Estimation approach. Either one_step or two_step (default) |
... | Additional arguments that should be used by
|
Gourieroux C, Monfort A, Renault E (1993).
“Indirect inference.”
Journal of applied econometrics, 8(S1), S85--S118.
Hansen LP (1982).
“Large sample properties of generalized method of moments estimators.”
Econometrica: Journal of the Econometric Society, 1029--1054.
if (FALSE) { n <- 10000L ncol <- 3 x <- replicate(ncol, rnorm(n)) y <- 2*x[,2] + runif(n) df <- data.frame(y = y, x1 = x[,1], x2 = x[,2], x3 = x[,3]) moment_function <- function(theta, ...){ return( data.table::data.table( 'epsilon' = as.numeric(df$x1*(df$y - cbind(1L, df$x1) %*% theta)) ) ) } objective_function <- function(theta, weights = 1L, return_moment = FALSE, ...){ if (return_moment) return(moment_function(theta, ...)) if (weights == 1L) return( t(moment_function(theta, ...)$epsilon) %*% moment_function(theta, ...)$epsilon ) return( t(moment_function(theta, ...)$epsilon) %*% weights %*% moment_function(theta, ...)$epsilon ) } msm1 <- estimation_theta(theta_0 = c(0, 0), model_function = objective_function, approach = "one_step") }