MATLAB® Script for Replicating Abbring and Daljord (2020)

This script computes the examples in Abbring and Daljord (2020). Its results are stored in .csv and .tex files that are read by LaTeX upon the paper's compilation to produce the graphs and documentation of the paper's examples.

Jaap H. Abbring and Øystein Daljord, May 2020

Contents

Example in Which an Exclusion Restriction on Current Values Suffices for Identification but One on Primitive Utility Does Not

Qi = [0.25 0.25; 0 0.25];
QK = [0.9 0; 0 0.9; 0 1];
p = [0.5; 0.49; 0.1];

example(p,Qi,QK,'identificationFails',[1 2],'yes',[])
Name: identificationFails

Qi =

    0.2500    0.2500    0.5000
         0    0.2500    0.7500


QK =

    0.9000         0    0.1000
         0    0.9000    0.1000
         0    1.0000         0


deltaQ =

   -0.6500    0.9000   -0.2500


p =

    0.5000    0.5000
    0.4900    0.5100
    0.1000    0.9000


m =

    0.6931
    0.6733
    0.1054


lhs =

    0.0400

Slope r.h.s. Magnac and Thesmar (2002):
    0.1291


betaMT =

    0.3098

Example in Which Magnac and Thesmar (2002)'s Rank Condition Fails, but an Exclusion Restriction on Primitive Utility Suffices for Identification

Use the same Qi and QK as in the previous example

p = [0.5; 0.48; 0.1];

example(p,Qi,QK,'moreEmpiricalContent',[1 2],'yes',[])
Name: moreEmpiricalContent

Qi =

    0.2500    0.2500    0.5000
         0    0.2500    0.7500


QK =

    0.9000         0    0.1000
         0    0.9000    0.1000
         0    1.0000         0


deltaQ =

   -0.6500    0.9000   -0.2500


p =

    0.5000    0.5000
    0.4800    0.5200
    0.1000    0.9000


m =

    0.6931
    0.6539
    0.1054


lhs =

    0.0800

Slope r.h.s. Magnac and Thesmar (2002):
    0.1116


betaMT =

    0.7169

Example of Data that are Consistent with an Exclusion Restriction on Current Values but Not with One on Primitive Utility

Qi = [0.0 0.25; 0.25 0.25];
QK = [0 1;0 1;0 0];
p = [0.5; 0.48; 0.5];

example(p,Qi,QK,'needNoMT',[1 2],'yes',[])
Name: needNoMT

Qi =

         0    0.2500    0.7500
    0.2500    0.2500    0.5000


QK =

     0     1     0
     0     1     0
     0     0     1


deltaQ =

   -0.2500         0    0.2500


p =

    0.5000    0.5000
    0.4800    0.5200
    0.5000    0.5000


m =

    0.6931
    0.6539
    0.6931


lhs =

    0.0800

Slope r.h.s. Magnac and Thesmar (2002):
     0


betaMT =

   Inf

Example with Two Moment Conditions of Which One Identifies the Discount Factor

Qi =  [0.4000    0.3333    0.1905;
       0.2647    0.2941    0.2647;
       0.1786    0.3571    0.1786;
       0.1818    0.2727    0.4545];

QK =  [0.1739    0.2609    0.1304;
       0.1333    0.0667    0.2000;
       0.2000    0.3000    0.1000;
       0.2500    0.1500    0.5000];

% Impose $u_1(x_1) = u_1(x_2)$ and $u_1(x_3) = u_1(x_4)$
u1 = 0.5;
u3 = 2;
beta = 0.3;
[~,~,~,p] = avf(QK,Qi,[u1 u1 u3 u3]',beta);

example(p,Qi,QK,'oneRedundant',[1 2;3 4],'yes',[])
Converged in 28 iterations 
 
 Name: oneRedundant

Qi =

    0.4000    0.3333    0.1905    0.0762
    0.2647    0.2941    0.2647    0.1765
    0.1786    0.3571    0.1786    0.2857
    0.1818    0.2727    0.4545    0.0910


QK =

    0.1739    0.2609    0.1304    0.4348
    0.1333    0.0667    0.2000    0.6000
    0.2000    0.3000    0.1000    0.4000
    0.2500    0.1500    0.5000    0.1000


deltaQ =

    0.0947   -0.1550   -0.0046    0.0649
    0.0468   -0.0656    0.1241   -0.1053


p =

    0.5969    0.4031
    0.5924    0.4076
    0.8795    0.1205
    0.8790    0.1210


m =

    0.9086
    0.8975
    2.1160
    2.1121


lhs =

    0.0187
    0.0045

Slope r.h.s. Magnac and Thesmar (2002):
    0.0743
    0.0238


betaMT =

    0.2518
    0.1882

Example with Two Moment Conditions that Jointly Identify the Discount Factor but Individually Do Not

Qi =  [0.4286    0.3333    0.1905;
       0.2647    0.2941    0.2647;
       0.1786    0.3571    0.1786;
       0.1818    0.2727    0.4545];

QK =  [0.1739    0.2609    0.1304;
       0.1333    0.0667    0.2000;
       0.2000    0.3000    0.1000;
       0.2500    0.1500    0.5000];

% Impose $u_1(x_1) = u_1(x_2)$ and $u_1(x_3) = u_1(x_4)$
u1 = 2;
u3 = 0.5;
beta = 0.9;
[~,~,~,p] = avf(QK,Qi,[u1 u1 u3 u3]',beta)

example(p,Qi,QK,'twiceTwo',[2 1;4 3],'yes',[])
Converged in 314 iterations 
 
 
p =

    0.9192
    0.9197
    0.6319
    0.6323

Name: twiceTwo

Qi =

    0.4286    0.3333    0.1905    0.0476
    0.2647    0.2941    0.2647    0.1765
    0.1786    0.3571    0.1786    0.2857
    0.1818    0.2727    0.4545    0.0910


QK =

    0.1739    0.2609    0.1304    0.4348
    0.1333    0.0667    0.2000    0.6000
    0.2000    0.3000    0.1000    0.4000
    0.2500    0.1500    0.5000    0.1000


deltaQ =

   -0.1233    0.1550    0.0046   -0.0363
   -0.0468    0.0656   -0.1241    0.1053


p =

    0.9192    0.0808
    0.9197    0.0803
    0.6319    0.3681
    0.6323    0.3677


m =

    2.5163
    2.5226
    0.9993
    1.0005


lhs =

    0.0068
    0.0019

Slope r.h.s. Magnac and Thesmar (2002):
    0.0490
    0.0291


betaMT =

    0.1385
    0.0656

Same Example with Noise in Choice Probabilities

rng(23670,'twister');
pHat = p + (1/1000)*rand(4,1)

example(pHat,Qi,QK,'twiceTwoNoise',[2 1;4 3],'yes',0.10)
pHat =

    0.9202
    0.9207
    0.6321
    0.6333

Name: twiceTwoNoise

Qi =

    0.4286    0.3333    0.1905    0.0476
    0.2647    0.2941    0.2647    0.1765
    0.1786    0.3571    0.1786    0.2857
    0.1818    0.2727    0.4545    0.0910


QK =

    0.1739    0.2609    0.1304    0.4348
    0.1333    0.0667    0.2000    0.6000
    0.2000    0.3000    0.1000    0.4000
    0.2500    0.1500    0.5000    0.1000


deltaQ =

   -0.1233    0.1550    0.0046   -0.0363
   -0.0468    0.0656   -0.1241    0.1053


p =

    0.9202    0.0798
    0.9207    0.0793
    0.6321    0.3679
    0.6333    0.3667


m =

    2.5282
    2.5342
    1.0000
    1.0031


lhs =

    0.0066
    0.0050

Slope r.h.s. Magnac and Thesmar (2002):
    0.0493
    0.0295


betaMT =

    0.1330
    0.1694


betaSet =

    0.1023
    0.2764
    0.7898
    0.9137

Monotonicity Example

J = 3;
learnRate = 0.75;
Qi = diag((1-learnRate)*ones(J,1))+diag(learnRate*ones(J-1,1),1);
%Qi(end)=1;
Qi = Qi(:,1:end-1);
depRate = 0.5;
QK = diag((1-depRate)*ones(J,1))+diag(depRate*ones(J-1,1),-1);
QK(1)=1;
QK = QK(:,1:end-1);

beta=0.8;
u=@(x)-0.5+(x>2).*(x-2);
[~,~,~,p] = avf(QK,Qi,u(1:J)',beta)
example(p,Qi,QK,'experience',[2 1],'yes',[])

name = 'experienceStructure';
% Save structural parameters to .tex file
f1=fopen(['data//' name '.tex'],'w');
    fprintf(f1,['\\def\\' name 'learnRate{%6.2f}\n'],learnRate);
    fprintf(f1,['\\def\\' name 'depRate{%6.2f}\n'],depRate);
    fprintf(f1,['\\def\\' name 'beta{%6.2f}\n'],beta);
    fprintf(f1,['\\def\\' name 'uBoldPrime{\\left[\\begin{array}{cccc}%4.2f&%4.2f&%4.2f\\end{array}\\right]}\n'],u(1:J));
    fprintf(f1,['\\def\\' name 'uOne{%4.2f}\n'],u(1));
    fprintf(f1,['\\def\\' name 'uTwo{%4.2f}\n'],u(2));
    fprintf(f1,['\\def\\' name 'uThree{%4.2f}\n'],u(3));
fclose(f1);
Converged in 144 iterations 
 
 
p =

    0.4365
    0.5588
    0.7073

Name: experience

Qi =

    0.2500    0.7500         0
         0    0.2500    0.7500
         0         0    1.0000


QK =

    1.0000         0         0
    0.5000    0.5000         0
         0    0.5000    0.5000


deltaQ =

    0.2500   -1.0000    0.7500


p =

    0.4365    0.5635
    0.5588    0.4412
    0.7073    0.2927


m =

    0.5736
    0.8184
    1.2285


lhs =

    0.4918

Slope r.h.s. Magnac and Thesmar (2002):
    0.2465


betaMT =

    1.9953

Dependencies

References