Differences between revisions 2 and 3
Revision 2 as of 2009-09-18 08:48:16
Size: 2731
Comment:
Revision 3 as of 2009-09-18 10:56:22
Size: 5668
Comment:
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
--({{{xparam1}}} becomes)-- {{{parameters_description}}} is a (global?) strucure array (with n lines) describing the estimated parameters with the following fields:
 * type (1,2,3,4,5)
   - 1: standard deviation of a structural shock.
   - 2: standard deviation of a measurement error.
   - 3: correlation betwwen two structural shocks.
   - 4: correlation between two measurement errors.
   - 5: "deep" parameter.
 * ID1 (first exogenous or endogenous variable index for the estimated standard deviation)
 * ID2 (second exogenous or endogenous variable index for the estimated correlations)
 * Period1 (beginning of sub-period)
 * Period2 (end of sub-period)
{{{parameters_description}}} is a (global?) strucure of arrays describing the estimated parameters with the following fields:
Line 23: Line 13:
Remark 1. Field ID2 is empty if the corresponding estimated parameter is not a correlation.  * {{{type}}} is a n by one vector of integers (1,2,3,4,5) where:
Line 25: Line 15:
Remark 2. Field ID1 is empty if the corresponding estimated parameter is not a correlation or standard deviation.    1 -> standard deviation of a structural shock.
Line 27: Line 17:
Remark 3. Period1 and Period2 specify the closed sub sample used to estimate the parameter.    2 -> standard deviation of a measurement error.

   3 -> correlation betwwen two structural shocks.

   4 -> correlation between two measurement errors.

   5 -> "deep" parameter.

 * {{{ID1}}} is a n by 1 vector of indices targeting to the (parameter, exogenous variable or endogenous variable) names (in M_.param_names, M_.exo_names and M_.endo_names).

 * {{{ID2}}} is a n by 1 vector of NaNs or indices (second exogenous or endogenous variable index for the estimated correlations).

 * {{{StartPeriod}}} n by 1 (beginning of sub-period)

 * {{{EndPeriod}}} n by 1 (end of sub-period)

 * {{{Prior}}} is a sub-structure describing the prior belief on a parameter. The fiels are:

  * {{{shape}}} is an n by 1 vector of integers (1,2,3,4,5,6) where:
   1 -> Beta density.

   2 -> Gamma density.

   3 -> Gaussian density.

   4 -> Inverse gamma (type 1) density.

   5 -> Uniform density.

   6 -> Inverse gamma (type 2) density.

  * {{{mean}}} is an n by 1 vector of doubles (mean of the prior density).

  * {{{mode}}} is an n by 1 vector of doubles (mode of the prior density).

  * {{{standard}}} is an n by 1 vector of doubles (standard deviation of the prior density).

  * {{{lower_bound}}} is an n by 1 vector of doubles (and Inf/-Inf) (prior density domain).

  * {{{upper_bound}}} is an n by 1 vector of doubles (and Inf/-Inf) (prior density domain).

  * {{{fhp}}} is an n by 1 vector of doubles (first hypermarameter <<latex($\alpha$)>> for the beta and gamma priors, <<latex($s$)>> for the inverse gamma prior, lower bound for the uniform prior).

  * {{{shp}}} is an n by 1 vector of doubles (second hypermarameter <<latex($\beta$)>> for the beta and gamma priors, <<latex($\nu$)>> for the inverse gamma prior, upper bound for the uniform prior).
 
 * {{{lower_bound}}} n ny 1 vector of doubles (effective lower bound for the estimated parameter).

 * {{{upper_bound}}} n by 1 vector of doubles (effective upper bound for the estimated parameter).

 * {{{nvx}}} integer scalar (number of estimated structural shock standard deviations).

 * {{{nvx_id}}} nvx by 1 vector of integers.

 * {{{nvn}}} integer scalar (number of estimated measurement error standard deviations).

 * {{{nvn_id}}} nvn by 1 vector of integers.

 * {{{ncx}}} integer scalar (number of estimated structural shock correlations).

 * {{{ncx_id}}} ncx by 1 vector of integers.

 * {{{ncn}}} integer scalar (number of estimated measurement error correlations).

 * {{{ncn_id}}} ncn by 1 vector of integers.

 * {{{np}}} integer scalar (number of estimated "deep" parameters).

 * {{{np_id}}} np by 1 vector of integers.

'''Remark 1.''' The considered subsamples for different parameters may be different.

'''Remark 2.''' {{{StartPeriod}}} and {{{EndPeriod}}} specify the closed sub sample used to estimate the parameter. If these two fields are empty the parameter is estimated using the whole sample.

'''Remark 3.''' The field {{{Prior}}} is empty if the model is estimated by maximum lilkelihood, simulated moments or indirect inference.

'''Remark 4.''' {{{xxx_id}}} vectors select subset of {{{xparam1}}} (for instance, {{{xparam_1(np_id)}}} selects all the lines of {{{xparam1}}} corresponding to the estimated "deep" parameters).
Line 30: Line 96:
Line 31: Line 98:
   - INPUTS: xparam1, data, prior_specifications, ys, coeff_trends, M_.params, M_.Sigma_e, M_.H, list_of_observed_variables
   - OUTPUTS: likelihood/posterior value, info
   * parameter updates (for period 1):
     - INPUTS: xparam1, ys, coeff_trends,M_.params, M_.Sigma_e, M_.H
     - OUTUTS: coeff_trends, params, Sigma_e, H

- INPUTS: {{{xparam1}}}, {{{data}}}, {{{parameters_specification}}}, {{{ys}}}, {{{coeff_trends}}}, {{{M_.params}}}, {{{M_.Sigma_e}}}, {{{M_.H}}}, {{{list_of_observed_variables}}}

   - OUTPUTS: likelihood/posterior value, {{{info}}}

   * Parameter updates (for period 1):

- INPUTS: {{{xparam1}}}, {{{ys}}}, {{{coeff_trends}}},{{{M_.params}}}, {{{M_.Sigma_e}}}, {{{M_.H}}}

     - OUTUTS: {{{coeff_trends}}}, {{{params}}}, {{{Sigma_e}}}, {{{H}}}
Line 37: Line 110:
     - INPUTS: params
     - OUTPUTS: T R ys
     - computes steady state
     - computes linear solution for state variables + observed variables

- INPUTS: {{{params}}}

     - OUTPUTS: {{{T}}} {{{R}}} {{{ys}}}

       * Computes steady state

 * Computes linear solution for state variables + observed variables
Line 42: Line 120:
     - INPUTS: data, ys, coeff_trends, Period1, Period2
     - OUTPUTS: centered_data for subperiod

- INPUTS: {{{data}}}, {{{ys}}}, {{{coeff_trends}}}, {{{StartPeriod}}}, {{{EndPeriod}}}

     - OUTPUTS: {{{centered_data}}} for subperiod
Line 45: Line 126:
     - INPUTS: Sigma_e T R list_of_observed_variables
     - OUTPUTS: a0 P0 Z
     - Remark: Z is computed only for nonstationary models. mfs is computed once before these functions

- INPUTS: {{{Sigma_e}}} {{{T}}} {{{R}}} {{{list_of_observed_variables}}}

     - OUTPUTS: {{{a0}}} {{{P0}}} {{{Z}}}

     - Remark: {{{Z}}} is computed only for nonstationary models. {{{mfs}}} is computed once before these functions
Line 49: Line 133:
Line 50: Line 135:
Line 51: Line 137:
     - INPUTS: a0 Po Z T R centered_data Sigma_e H
     - OUTPUTS: log-likelihood, a(t|t-1), P(t|t-1)
     if period < NP:

 
- INPUTS: {{{a0}}} {{{Po}}} {{{Z}}} {{{T}}} {{{R}}} {{{centered_data}}} {{{Sigma_e}}} {{{H}}}

 
- OUTPUTS: log-likelihood, a(t|t-1), P(t|t-1)

 
if period < NP:
Line 55: Line 145:
Line 56: Line 147:
Line 57: Line 149:

Proposed specification for estimation functions

This includes factorization of common code and extensions for (unexpected) structural change

Estimated parameters description

xparam1 is a column n by 1 vector holding the current values of the estimated parameters (n is the number of parameters).

parameters_description is a (global?) strucure of arrays describing the estimated parameters with the following fields:

  • type is a n by one vector of integers (1,2,3,4,5) where:

    • 1 -> standard deviation of a structural shock.

      2 -> standard deviation of a measurement error.

      3 -> correlation betwwen two structural shocks.

      4 -> correlation between two measurement errors.

      5 -> "deep" parameter.

  • ID1 is a n by 1 vector of indices targeting to the (parameter, exogenous variable or endogenous variable) names (in M_.param_names, M_.exo_names and M_.endo_names).

  • ID2 is a n by 1 vector of NaNs or indices (second exogenous or endogenous variable index for the estimated correlations).

  • StartPeriod n by 1 (beginning of sub-period)

  • EndPeriod n by 1 (end of sub-period)

  • Prior is a sub-structure describing the prior belief on a parameter. The fiels are:

    • shape is an n by 1 vector of integers (1,2,3,4,5,6) where:

      • 1 -> Beta density.

        2 -> Gamma density.

        3 -> Gaussian density.

        4 -> Inverse gamma (type 1) density.

        5 -> Uniform density.

        6 -> Inverse gamma (type 2) density.

    • mean is an n by 1 vector of doubles (mean of the prior density).

    • mode is an n by 1 vector of doubles (mode of the prior density).

    • standard is an n by 1 vector of doubles (standard deviation of the prior density).

    • lower_bound is an n by 1 vector of doubles (and Inf/-Inf) (prior density domain).

    • upper_bound is an n by 1 vector of doubles (and Inf/-Inf) (prior density domain).

    • fhp is an n by 1 vector of doubles (first hypermarameter $\alpha$ for the beta and gamma priors, $s$ for the inverse gamma prior, lower bound for the uniform prior).

    • shp is an n by 1 vector of doubles (second hypermarameter $\beta$ for the beta and gamma priors, $\nu$ for the inverse gamma prior, upper bound for the uniform prior).

  • lower_bound n ny 1 vector of doubles (effective lower bound for the estimated parameter).

  • upper_bound n by 1 vector of doubles (effective upper bound for the estimated parameter).

  • nvx integer scalar (number of estimated structural shock standard deviations).

  • nvx_id nvx by 1 vector of integers.

  • nvn integer scalar (number of estimated measurement error standard deviations).

  • nvn_id nvn by 1 vector of integers.

  • ncx integer scalar (number of estimated structural shock correlations).

  • ncx_id ncx by 1 vector of integers.

  • ncn integer scalar (number of estimated measurement error correlations).

  • ncn_id ncn by 1 vector of integers.

  • np integer scalar (number of estimated "deep" parameters).

  • np_id np by 1 vector of integers.

Remark 1. The considered subsamples for different parameters may be different.

Remark 2. StartPeriod and EndPeriod specify the closed sub sample used to estimate the parameter. If these two fields are empty the parameter is estimated using the whole sample.

Remark 3. The field Prior is empty if the model is estimated by maximum lilkelihood, simulated moments or indirect inference.

Remark 4. xxx_id vectors select subset of xparam1 (for instance, xparam_1(np_id) selects all the lines of xparam1 corresponding to the estimated "deep" parameters).

Functions

  • Likelihood/posterior evaluation (separate two functions ?)
    • - INPUTS: xparam1, data, parameters_specification, ys, coeff_trends, M_.params, M_.Sigma_e, M_.H, list_of_observed_variables

      - OUTPUTS: likelihood/posterior value, info

    • Parameter updates (for period 1):
      • - INPUTS: xparam1, ys, coeff_trends,M_.params, M_.Sigma_e, M_.H

        - OUTUTS: coeff_trends, params, Sigma_e, H

    • reduced form (for period 1):
      • - INPUTS: params

        - OUTPUTS: T R ys

        • Computes steady state
        • Computes linear solution for state variables + observed variables
    • data_filtering (for period 1):
      • - INPUTS: data, ys, coeff_trends, StartPeriod, EndPeriod

        - OUTPUTS: centered_data for subperiod

    • Kalman filter initialization
      • - INPUTS: Sigma_e T R list_of_observed_variables

        - OUTPUTS: a0 P0 Z

        - Remark: Z is computed only for nonstationary models. mfs is computed once before these functions

        • Diffuse Kalman filter recursions takes place here ?
      LOOP on periods 1 to NP:
      • Kalman filter
        • - INPUTS: a0 Po Z T R centered_data Sigma_e H - OUTPUTS: log-likelihood, a(t|t-1), P(t|t-1)

          if period < NP:

          • parameter updates
          • reduced form
          • data_filtering
      END LOOP
    • priors evaluation

DynareWiki: EstimationModule (last edited 2011-07-05 09:43:21 by SébastienVillemot)