File size: 7,616 Bytes
b6c95bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
function results = compute_efficiency(commit_models,no_commit_models, ...
        no_p_commit_models)
    % compute efficiency of behavior change & other outcomes from the 
    % commitment contract and two piece-rate incentives
    
    n = length(commit_models);
    
    % compute average change in attendance from the contract
    delta_a_Cs = [];
    avg_delta_a_C = 0;
    for i = 1:n
        
        avg_delta_a_C = avg_delta_a_C + (commit_models(i).mu .* ...
            (commit_models(i).avg_att - no_p_commit_models(i).avg_att));
        delta_a_Cs = [delta_a_Cs, commit_models(i).avg_att - no_p_commit_models(i).avg_att];
        
    end
    results.avg_delta_a_C = avg_delta_a_C;    
    
    % compute average period 1 incremental welfare from the contract
    avg_delta_surplus = 0;
    for i = 1:n
        
        avg_delta_surplus = avg_delta_surplus + (commit_models(i).mu .* ...
            (commit_models(i).t1_utility - no_p_commit_models(i).t1_utility));
        
    end
    results.avg_delta_surplus = avg_delta_surplus;
    
    % compute the surplus just for those who took up the contract
    mu_commit = 0;
    for i = 1:n
        mu_commit = mu_commit + commit_models(i).mu;
    end
    results.commit_delta_surplus = avg_delta_surplus / mu_commit;
    
    
    % compute average change in expected benefits from the contract
    avg_delta_benefits = 0;
    for i = 1:n
        
        avg_delta_benefits = avg_delta_benefits + ...
            (commit_models(i).mu .* commit_models(i).b .* ...
            (commit_models(i).avg_att - no_p_commit_models(i).avg_att));
        
    end
    results.avg_delta_benefits = avg_delta_benefits;
    
    
    % compute average change in expected costs from the contract
    avg_delta_costs = 0;
    for i = 1:n
        
        avg_delta_costs = avg_delta_costs + (commit_models(i).mu .* ...
            (commit_models(i).avg_costs - no_p_commit_models(i).avg_costs));
        
    end
    results.avg_delta_costs = avg_delta_costs;
    
    
    % compute efficiency of behavior change from the commitment contract
    results.V_E = results.avg_delta_benefits - results.avg_delta_costs;
    
    
    % compute the optimal r
    syms r
    eqns_n = []; % placeholder for numerator
    eqns_d = []; % placeholder for denominator
    for k = 1:n
        
        eqns_n = [ eqns_n; commit_models(k).mu .* (1 - commit_models(k).beta) .* ...
            commit_models(k).b .* commit_models(k).beta .* ...
            commit_models(k).f(commit_models(k).beta .* (commit_models(k).b + r)) ];
        
        eqns_n = [ eqns_n; no_commit_models(k).mu .* (1 - no_commit_models(k).beta) .* ...
            no_commit_models(k).b .* no_commit_models(k).beta .* ...
            no_commit_models(k).f(no_commit_models(k).beta .* (no_commit_models(k).b + r)) ];
        
        eqns_d = [ eqns_d; commit_models(k).mu .* (commit_models(k).beta .^ 2) .* ...
            commit_models(k).f(commit_models(k).beta .* (commit_models(k).b + r)) ];
        
        eqns_d = [ eqns_d; no_commit_models(k).mu .* (no_commit_models(k).beta .^ 2) .* ...
            no_commit_models(k).f(no_commit_models(k).beta .* (no_commit_models(k).b + r)) ];
        
    end
    r_opt = vpasolve(sum(eqns_n) ./ sum(eqns_d) == r, r);
    results.r_opt = double(r_opt);
    
    
    % compute outcomes under r_opt
    results.U_E_r_opt = compute_incentive_efficiency(results.r_opt, ...
        commit_models, no_commit_models);
    [results.delta_surplus_r_opt, results.delta_benefits_r_opt, ...
        results.delta_costs_r_opt, results.delta_att_r_opt] = ...
        compute_incentive_outcomes(results.r_opt, ...
        commit_models, no_commit_models);
    
    
    % find the r that generates the same expected change in attendance    
    syms r
    eqns = [];
    for k = 1:n
        
        eqns = [ eqns; (commit_models(k).mu .* ...
            (commit_models(k).F(commit_models(k).beta .* ...
            (commit_models(k).b + r)) ...
            - commit_models(k).F(commit_models(k).beta .* ...
            commit_models(k).b))) ];
        
        eqns = [ eqns; (no_commit_models(k).mu .* ...
            (no_commit_models(k).F(no_commit_models(k).beta .* ...
            (no_commit_models(k).b + r)) ...
            - no_commit_models(k).F(no_commit_models(k).beta .* ...
            no_commit_models(k).b))) ];
        
    end
    r_att = vpasolve(commit_models(1).T .* sum(eqns) == avg_delta_a_C, r);
    results.r_att = double(r_att);
    
    
    % compute outcomes under r_att
    results.U_E_r_att = compute_incentive_efficiency(results.r_att, ...
        commit_models, no_commit_models);
    [results.delta_surplus_r_att, results.delta_benefits_r_att, ...
        results.delta_costs_r_att, results.delta_att_r_att] = ...
        compute_incentive_outcomes(results.r_att, ...
        commit_models, no_commit_models);
            
end

%% Helper functions

function U_E = compute_incentive_efficiency(r, commit_models, ...
    no_commit_models)
    % compute the efficiency of behavior change under incentive r

N = length(commit_models);
U_E = 0;
inc = [r 0];
for j = 1:N
    
    commit_models(j) = commit_models(j).compute_incentive_behavior(inc);
    U_E = U_E + commit_models(j).mu .* ...
        (commit_models(j).net_surplus_r(1) - ...
        commit_models(j).net_surplus_r(2));
    
    no_commit_models(j) = no_commit_models(j).compute_incentive_behavior(inc);
    U_E = U_E + no_commit_models(j).mu .* ...
        (no_commit_models(j).net_surplus_r(1) - ...
        no_commit_models(j).net_surplus_r(2));
    
end

end

function [delta_surplus, delta_benefits, delta_costs, delta_a_r] = ...
    compute_incentive_outcomes(r, commit_models, no_commit_models)
    % compute the expected change in agent surplus, benefits, and costs
    % under incentive r

N = length(commit_models);
delta_surplus = 0;
delta_benefits = 0;
delta_costs = 0;
delta_a_r = 0;
inc = [r 0];
for j = 1:N
    
    commit_models(j) = commit_models(j).compute_incentive_behavior(inc);
    no_commit_models(j) = no_commit_models(j).compute_incentive_behavior(inc);
    
    % expected change in agent surplus
    delta_surplus = delta_surplus + commit_models(j).mu .* ...
        (commit_models(j).surplus_r(1) - ...
        commit_models(j).surplus_r(2));
    delta_surplus = delta_surplus + no_commit_models(j).mu .* ...
        (no_commit_models(j).surplus_r(1) - ...
        no_commit_models(j).surplus_r(2));
    
    % expected change in health benefits
    delta_benefits = delta_benefits + commit_models(j).mu .* ...
        (commit_models(j).benefits_r(1) - ...
        commit_models(j).benefits_r(2));
    delta_benefits = delta_benefits + no_commit_models(j).mu .* ...
        (no_commit_models(j).benefits_r(1) - ...
        no_commit_models(j).benefits_r(2));
    
    % expected change in costs
    delta_costs = delta_costs + commit_models(j).mu .* ...
        (commit_models(j).costs_r(1) - ...
        commit_models(j).costs_r(2));
    delta_costs = delta_costs + no_commit_models(j).mu .* ...
        (no_commit_models(j).costs_r(1) - ...
        no_commit_models(j).costs_r(2));
    
    % expected change in attendance
    delta_a_r = delta_a_r + commit_models(j).mu .* ...
        commit_models(j).change_att_r(1);
    delta_a_r = delta_a_r + no_commit_models(j).mu .* ...
        no_commit_models(j).change_att_r(1);
     
end
        
end