Source code for snowdrop.src.preprocessor.f_measurement

from numba import njit
    
[docs] @njit def f_measurement(x, p, exog=[0], order=1, ind=None): ### This code was generated by Python. ### Basic Quarterly Projection Model (QPM) # First order derivatives are employed in most of the models to compute Jacobian. # Higher order derivatives are used in nonlinear rational expectations models. from scipy.special import lambertw as LambertW from snowdrop.src.preprocessor.functions import Heaviside,Max,Min,Abs,DiracDelta from snowdrop.src.preprocessor.condition import IfThenElse,IfThen,Derivative,Subs,Positive,Negative,myzif import numpy as np from numpy import exp, sin, cos, tan, sqrt, sign, log # Initialize variables _xi_1 = 0 _xi_2 = 0 _xi_3 = 0 L_GDP_RW_GAP__ = x[3] D4L_CPI_TAR__ = x[5] DLA_CPI_RW__ = x[6] RS_RW__ = x[15] RS__ = x[19] L_GDP__ = x[20] L_S__ = x[36] L_CPI__ = x[43] OBS_L_GDP__ = x[49] OBS_L_CPI__ = x[50] OBS_RS__ = x[51] OBS_L_S__ = x[52] OBS_D4L_CPI_TAR__ = x[53] OBS_L_GDP_RW_GAP__ = x[54] OBS_DLA_CPI_RW__ = x[55] OBS_RS_RW__ = x[56] SHK_OBS_L_GDP__ = x[57] SHK_OBS_L_CPI__ = x[58] SHK_OBS_RS__ = x[59] SHK_OBS_L_S__ = x[60] SHK_OBS_D4L_CPI_TAR__ = x[61] SHK_OBS_L_GDP_RW_GAP__ = x[62] SHK_OBS_DLA_CPI_RW__ = x[63] SHK_OBS_RS_RW__ = x[64] # Set parameters # Function: function = np.zeros(8) function[0] = OBS_L_GDP__ - (L_GDP__ + SHK_OBS_L_GDP__) function[1] = OBS_L_CPI__ - (L_CPI__ + SHK_OBS_L_CPI__) function[2] = OBS_RS__ - (RS__ + SHK_OBS_RS__) function[3] = OBS_L_S__ - (L_S__ + SHK_OBS_L_S__) function[4] = OBS_D4L_CPI_TAR__ - (D4L_CPI_TAR__ + SHK_OBS_D4L_CPI_TAR__) function[5] = OBS_L_GDP_RW_GAP__ - (L_GDP_RW_GAP__ + SHK_OBS_L_GDP_RW_GAP__) function[6] = OBS_DLA_CPI_RW__ - (DLA_CPI_RW__ + SHK_OBS_DLA_CPI_RW__) function[7] = OBS_RS_RW__ - (RS_RW__ + SHK_OBS_RS_RW__) if order == 0: return function # Jacobian: jacobian = np.zeros((8,65)) jacobian[0,20] = -1 jacobian[0,49] = 1 jacobian[0,57] = -1 jacobian[1,43] = -1 jacobian[1,50] = 1 jacobian[1,58] = -1 jacobian[2,19] = -1 jacobian[2,51] = 1 jacobian[2,59] = -1 jacobian[3,36] = -1 jacobian[3,52] = 1 jacobian[3,60] = -1 jacobian[4,5] = -1 jacobian[4,53] = 1 jacobian[4,61] = -1 jacobian[5,3] = -1 jacobian[5,54] = 1 jacobian[5,62] = -1 jacobian[6,6] = -1 jacobian[6,55] = 1 jacobian[6,63] = -1 jacobian[7,15] = -1 jacobian[7,56] = 1 jacobian[7,64] = -1 if order == 1: return [function, jacobian]