Chapter 2 Core Functions

2.1 CES Demand Core Functions

This is the example vignette for function: bfw_mp_func_demand from the PrjLabEquiBFW Package. This function generates a container map with key CES demand-side equations for a particular sub-nest.

2.1.1 Default Test

Default test

bl_verbose = true;
mp_func_demand = bfw_mp_func_demand(bl_verbose);

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CONTAINER NAME: mp_func Functions
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                                i      idx                                                           functionString                                                      
                               ____    ____    __________________________________________________________________________________________________________________________

    fc_OMEGA                   "1"     "1"     "@(p1,p2,rho,beta_1,beta_2)p1.*fc_d1(p1,p2,1,1,rho,beta_1,beta_2)+p2.*fc_d2(p1,p2,1,1,rho,beta_1,beta_2)"                 
    fc_d1                      "2"     "2"     "@(p1,p2,Y,Z,rho,beta_1,beta_2)(Y/Z).*(beta_1+beta_2.*((p1./p2).*(beta_2./beta_1)).^(rho/(1-rho))).^(-1/rho)"             
    fc_d2                      "3"     "3"     "@(p1,p2,Y,Z,rho,beta_1,beta_2)(Y/Z).*(beta_1.*((p2./p1).*(beta_1./beta_2)).^(rho/(1-rho))+beta_2).^(-1/rho)"             
    fc_lagrange_x1             "4"     "4"     "@(p1,rho,beta_1,beta_2,x_1,x_2)p1/(((beta_1*x_1^(rho)+beta_2*x_2^(rho))^((1/rho)-1))*(beta_1*x_1^(rho-1)))"              
    fc_lagrange_x2             "5"     "5"     "@(p2,rho,beta_1,beta_2,x_1,x_2)p2/(((beta_1*x_1^(rho)+beta_2*x_2^(rho))^((1/rho)-1))*(beta_2*x_2^(rho-1)))"              
    fc_output_nest             "6"     "6"     "@(q1,q2,rho,beta_1,beta_2)((beta_1)*q1^(rho)+beta_2*q2^(rho))^(1/rho)"                                                   
    fc_p1_foc                  "7"     "7"     "@(lagrangem,rho,beta_1,beta_2,x_1,x_2)lagrangem*(((beta_1*x_1^(rho)+beta_2*x_2^(rho))^((1/rho)-1))*(beta_1*x_1^(rho-1)))"
    fc_p2_foc                  "8"     "8"     "@(lagrangem,rho,beta_1,beta_2,x_1,x_2)lagrangem*(((beta_1*x_1^(rho)+beta_2*x_2^(rho))^((1/rho)-1))*(beta_2*x_2^(rho-1)))"
    fc_share_given_elas_foc    "9"     "9"     "@(rho,p1,p2,x1,x2)fc_share_given_elas_foc_Q(rho,p1,p2,x1,x2)/(1+fc_share_given_elas_foc_Q(rho,p1,p2,x1,x2))"             
    fc_w1dw2                   "10"    "10"    "@(x_1,x_2,rho,beta_1,beta_2)(x_2/x_1)^(1-rho)*(beta_1/beta_2)"                                                           
    fc_yz_ratio                "11"    "11"    "@(p1,p2,q1,q2,rho,beta_1,beta_2)fc_revenue(p1,p2,q1,q2)/fc_OMEGA(p1,p2,rho,beta_1,beta_2)"                               

2.2 Multinomial Logit Core Functions

This is the example vignette for function: bfw_mp_func_supply from the PrjLabEquiBFW Package. This function generates a container map with key multinomial logit supply-side equations.

2.2.1 Test BL_LOG_WAGE is false

Default test

bl_log_wage = false;
bl_verbose = true;
mp_func_supply = bfw_mp_func_supply(bl_log_wage, bl_verbose);

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CONTAINER NAME: mp_func Functions
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                         i     idx                                                                                                                                   functionString                                                                                                                               
                        ___    ___    ____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

    fc_ar_prob_wrk      "1"    "1"    "@(arpsi0,psi1,mtwage,probdenom)fc_v_occ(reshape(arpsi0,[1,length(arpsi0)]),psi1,mtwage)./probdenom"                                                                                                                                                                        
    fc_log_pmdpo_occ    "2"    "2"    "@(psi0,psi1,arwage,pie1,pie2,pie3,pie4,pie5,pie6,t,prbchd,prbmar,prbapp,prbjsy)(psi0+psi1.*arwage)-(pie1+pie2.*(t)+pie3.*prbchd+pie4.*prbmar+pie5.*prbapp+pie6.*prbjsy)"                                                                                                   
    fc_prob_denom       "3"    "3"    "@(arpsi0,psi1,arpie,arwage1,arwage2,arwage3,t,prbchd,prbmar,prbapp,prbjsy)fc_v_occ(arpsi0(1),psi1,arwage1)+fc_v_occ(arpsi0(2),psi1,arwage2)+fc_v_occ(arpsi0(3),psi1,arwage3)+fc_v_lei(arpie(1),arpie(2),arpie(3),arpie(4),arpie(5),arpie(6),t,prbchd,prbmar,prbapp,prbjsy)"
    fc_prob_lei         "4"    "4"    "@(arpie,t,prbchd,prbmar,prbapp,prbjsy,probdenom)fc_v_lei(arpie(1),arpie(2),arpie(3),arpie(4),arpie(5),arpie(6),t,prbchd,prbmar,prbapp,prbjsy)./probdenom"                                                                                                                  
    fc_s1               "5"    "5"    "@(p1,G_1,zeta_1_0,zeta_1_1)G_1./(1+(exp(-zeta_1_0-zeta_1_1.*p1)))"                                                                                                                                                                                                         
    fc_s2               "6"    "6"    "@(p2,G_2,zeta_2_0,zeta_2_1)G_2./(1+(exp(-zeta_2_0-zeta_2_1.*p2)))"                                                                                                                                                                                                         
    fc_supply           "7"    "7"    "@(potlabor,prob)potlabor.*prob"                                                                                                                                                                                                                                            

2.2.2 Test BL_LOG_WAGE is false

Default test

bl_log_wage = true;
mp_func_supply = bfw_mp_func_supply(bl_log_wage, bl_verbose);

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CONTAINER NAME: mp_func Functions
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                         i     idx                                                                                                                                   functionString                                                                                                                               
                        ___    ___    ____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

    fc_ar_prob_wrk      "1"    "1"    "@(arpsi0,psi1,mtwage,probdenom)fc_v_occ(reshape(arpsi0,[1,length(arpsi0)]),psi1,mtwage)./probdenom"                                                                                                                                                                        
    fc_log_pmdpo_occ    "2"    "2"    "@(psi0,psi1,arwage,pie1,pie2,pie3,pie4,pie5,pie6,t,prbchd,prbmar,prbapp,prbjsy)(psi0+psi1.*log(arwage))-(pie1+pie2.*(t)+pie3.*prbchd+pie4.*prbmar+pie5.*prbapp+pie6.*prbjsy)"                                                                                              
    fc_prob_denom       "3"    "3"    "@(arpsi0,psi1,arpie,arwage1,arwage2,arwage3,t,prbchd,prbmar,prbapp,prbjsy)fc_v_occ(arpsi0(1),psi1,arwage1)+fc_v_occ(arpsi0(2),psi1,arwage2)+fc_v_occ(arpsi0(3),psi1,arwage3)+fc_v_lei(arpie(1),arpie(2),arpie(3),arpie(4),arpie(5),arpie(6),t,prbchd,prbmar,prbapp,prbjsy)"
    fc_prob_lei         "4"    "4"    "@(arpie,t,prbchd,prbmar,prbapp,prbjsy,probdenom)fc_v_lei(arpie(1),arpie(2),arpie(3),arpie(4),arpie(5),arpie(6),t,prbchd,prbmar,prbapp,prbjsy)./probdenom"                                                                                                                  
    fc_s1               "5"    "5"    "@(p1,G_1,zeta_1_0,zeta_1_1)G_1./(1+(exp(-zeta_1_0-zeta_1_1.*p1)))"                                                                                                                                                                                                         
    fc_s2               "6"    "6"    "@(p2,G_2,zeta_2_0,zeta_2_1)G_2./(1+(exp(-zeta_2_0-zeta_2_1.*p2)))"                                                                                                                                                                                                         
    fc_supply           "7"    "7"    "@(potlabor,prob)potlabor.*prob"                                                                                                                                                                                                                                            

2.3 Equilibrium Core Functions

This is the example vignette for function: bfw_mp_func_equi from the PrjLabEquiBFW Package.

2.3.1 Default Test

Default test

bl_verbose = true;
mp_func_demand = bfw_mp_func_equi(bl_verbose);

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CONTAINER NAME: mp_func Functions
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                             i     idx                                                                                     functionString                                                                                  
                            ___    ___    _________________________________________________________________________________________________________________________________________________________________________________

    f_x_root                "1"    "1"    "@(x,price_ratio,yfz_per_input,rho)(1-x)+(x).*(price_ratio.*(x./(1-x))).^((rho)./(1-rho))-(yfz_per_input).^rho"                                                                  
    fc_p1_of_p2             "2"    "2"    "@(p2,G_2,zeta_2_0,zeta_2_1,Y,Z,rho,beta_1,beta_2)((((((1+exp(-zeta_2_0-zeta_2_1.*p2))./(G_2)).*(Y/Z)).^rho).*(1/beta_1)-(beta_2/beta_1)).^((rho-1)/(rho))).*(beta_1/beta_2).*p2"
    fc_p1_of_p2andSupply    "3"    "3"    "@(p2,supplyQofP,Y,Z,rho,beta_1,beta_2)((((((Y/Z)./supplyQofP)).^rho).*(1/beta_1)-(beta_2/beta_1)).^((rho-1)/(rho))).*(beta_1/beta_2).*p2"                                       
    fc_p2_of_p1             "4"    "4"    "@(p1,G_1,zeta_1_0,zeta_1_1,Y,Z,rho,beta_1,beta_2)((((((1+exp(-zeta_1_0-zeta_1_1.*p1))./(G_1)).*(Y/Z)).^rho).*(1/beta_2)-(beta_1/beta_2)).^((rho-1)/(rho))).*(beta_2/beta_1).*p1"
    fc_p2_of_p1andSupply    "5"    "5"    "@(p1,supplyQofP,Y,Z,rho,beta_1,beta_2)((((((Y/Z)./supplyQofP)).^rho).*(1/beta_2)-(beta_1/beta_2)).^((rho-1)/(rho))).*(beta_2/beta_1).*p1"