Introduction

MomentOpt.jl

Simulated Method of Moments for Julia

A package providing supporting infrastructure and algorithms to perform Simulated Method of Moments.

Features

For some example usage see the Examples page.

Manual Outline

MProb: Minimisation/Maximisation Problems

MomentOpt.MProbType.

Minimisation Problem: MProb

A moment minimsation problem is defined by an objective function that depends on a vector of unknown parameters params_to_sample, and a set of datamoments moments. The key idea here is the one of simulated method of moments, where we use params_to_sample to simulate a model, some moments of which will be compared to moments from the data.

Fields:

  • initial_value: initial parameter value as a dict
  • params_to_sample: OrderedDict with lower and upper bounds
  • objfunc: objective function
  • objfunc_opts: options passed to the objective function, e.g. printlevel
  • moments: a dictionary or dataframe of data moments to track

Example:

pb    = Dict(p1" => [0.2,-2,2] , "p2" => [-0.2,-2,2] )
moms  = DataFrame(name=["mu2","mu1"],value=[0.0,0.0],weight=rand(2))
m     = MProb() 
addSampledParam!(m,pb) 
addMoment!(m,moms) 
MomentOpt.addEvalFunc!(m,MomentOpt.objfunc_norm)
source
addMoment!(m::MProb,name::String,value,weight)
source
addMoment!(m::MProb,name::String,value)
source
addMoment!(m::MProb,name::Symbol,value,weight)

Add Moments to an MProb. Adds a single moment to the mprob.

name: the name of the moment as a Symbol value: value of the moment weight: weight in the objective function

source
addMoment!(m::MProb,name::Symbol,value)
source

Add initial parameter values to an MProb minimisation problem.

source

Add initial parameter values to an MProb minimisation problem.

Arguments:

  • p: A Dict with (String,Number) pairs
source

Add parameters to be sampled to an MProb.

d: a Dict with a triple (init,lb,ub) as value for each key.

source

Add parameters to be sampled to an MProb.

source
evaluateObjective(m::MProb,ev::Eval)

Evaluate the objective function of an MProb at a given Eval.

source
evaluateObjective(m::MProb,p::Union{Dict,OrderedDict};noseed=false)

Evaluate the objective function of an MProb at a given parameter vector p. Set noseed to true if you want to generate new random draws for shocks in the objective function (necessary for estimation of standard errors in get_stdErrors, for example)

source
MomentOpt.mapto_01Method.
mapto_01(p::OrderedDict,lb::Vector{Float64},ub::Vector{Float64})

map param to [0,1]

source
MomentOpt.mapto_abMethod.
mapto_ab(p::Vector{Float64},lb::Vector{Float64},ub::Vector{Float64})

map param from [0,1] to [a,b]

source
MomentOpt.ms_namesMethod.

Get the name of moments

source

Get sampled parameter names from the MProb

source
MomentOpt.ps_namesMethod.

Get all parameter names from the MProb

source