pyfan.stats.interpolate.interpolate2d

Created on Mar 7, 2017

@author: fan

Module Contents

Functions

exp_value_interpolate_bp(prod_inst, util_opti, b_ssv_sd, k_ssv_sd, epsilon_ssv_sd, b_ssv, k_ssv, epsilon_ssv, b_ssv_zr, k_ssv_zr, epsilon_ssv_zr, states_vfi_dim, shocks_vfi_dim)

interpolate value function and expected value function.

inter_states_bp(prod_inst, util_opti, b_ssv_sd, k_ssv_sd, epsilon_ssv_sd, b_ssv, k_ssv, epsilon_ssv, b_ssv_zr, k_ssv_zr, epsilon_ssv_zr, states_vfi_dim, shocks_vfi_dim)

interpolate value function and expected value function.

exp_value_interpolate_main(u1, x1, y1, x2, y2, x2_noshk, y2_noshk, states_dim, shocks_dim, return_uxy=False)

  1. Get Interpolant

exp_value_interpolate_bpkp(hhp_inst, util_opti, b, k, b_shk, k_shk)

interpolate value function and expected value function.

k_alpha_cash(hhp_inst, b_vec, k_vec)

interp_griddata(cur_u, cur_x1, cur_x2, new_x1, new_x2)

Centralize the invokation of 2D interpolation tool

interp2d(prod, cash, z=None, interpolant=None, kind='linear')

Centralize the invokation of 2D interpolation tool

interpRbf2D(prod, cash, z=None, interpolant=None, kind='linear')

interpRbf3D(prod, cash, A, z=None, interpolant=None, kind='cubic')

regress_mat(k_alpha, cash)

regress(dependent_var, rhs_var)

pyfan.stats.interpolate.interpolate2d.exp_value_interpolate_bp(prod_inst, util_opti, b_ssv_sd, k_ssv_sd, epsilon_ssv_sd, b_ssv, k_ssv, epsilon_ssv, b_ssv_zr, k_ssv_zr, epsilon_ssv_zr, states_vfi_dim, shocks_vfi_dim)[source]

interpolate value function and expected value function.

Need three matrix here: 1. state matrix x shock matrix where optimal choices were solved at

  • previously, shock for this = 0, but now shock vector might not be zero

  1. state matrix x shock matrix where shocks are drawn monte carlo way to allow

    for averaging, integrating over shocks for each x row

  2. state matrix alone, shock = 0, each of the x row in matrix x

pyfan.stats.interpolate.interpolate2d.inter_states_bp(prod_inst, util_opti, b_ssv_sd, k_ssv_sd, epsilon_ssv_sd, b_ssv, k_ssv, epsilon_ssv, b_ssv_zr, k_ssv_zr, epsilon_ssv_zr, states_vfi_dim, shocks_vfi_dim)[source]

interpolate value function and expected value function.

Need three matrix here: 1. state matrix x shock matrix where optimal choices were solved at

  • previously, shock for this = 0, but now shock vector might not be zero

  1. state matrix x shock matrix where shocks are drawn monte carlo way to allow

    for averaging, integrating over shocks for each x row

  2. state matrix alone, shock = 0, each of the x row in matrix x

pyfan.stats.interpolate.interpolate2d.exp_value_interpolate_main(u1, x1, y1, x2, y2, x2_noshk, y2_noshk, states_dim, shocks_dim, return_uxy=False)[source]
  1. Get Interpolant

pyfan.stats.interpolate.interpolate2d.exp_value_interpolate_bpkp(hhp_inst, util_opti, b, k, b_shk, k_shk)[source]

interpolate value function and expected value function.

cash and k_alpha calculation below does not repeat what happened already inside lifetimeutility. Inside lifetimeutility, we have next period cash and k_alpha here is this period

pyfan.stats.interpolate.interpolate2d.k_alpha_cash(hhp_inst, b_vec, k_vec)[source]
pyfan.stats.interpolate.interpolate2d.interp_griddata(cur_u, cur_x1, cur_x2, new_x1, new_x2)[source]

Centralize the invokation of 2D interpolation tool

Potentially chagne this to something else if I don’t like it.

pyfan.stats.interpolate.interpolate2d.interp2d(prod, cash, z=None, interpolant=None, kind='linear')[source]

Centralize the invokation of 2D interpolation tool

Potentially chagne this to something else if I don’t like it.

pyfan.stats.interpolate.interpolate2d.interpRbf2D(prod, cash, z=None, interpolant=None, kind='linear')[source]
pyfan.stats.interpolate.interpolate2d.interpRbf3D(prod, cash, A, z=None, interpolant=None, kind='cubic')[source]
pyfan.stats.interpolate.interpolate2d.regress_mat(k_alpha, cash)[source]
pyfan.stats.interpolate.interpolate2d.regress(dependent_var, rhs_var)[source]