-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathBenPorathCornerContValueLH.m
101 lines (84 loc) · 2.74 KB
/
BenPorathCornerContValueLH.m
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
% Continuation value for BenPorathCornerLH
%{
Takes a BenPorathContTimeLH object
Wraps it so that the right methods for a continuation value are available
Must be efficient
%}
classdef BenPorathCornerContValueLH
properties
bpS BenPorathContTimeLH
end
methods
%% Constructor
function cvS = BenPorathCornerContValueLH(bpS)
cvS.bpS = bpS;
end
%% Value(h, T)
function valueV = value(cvS, hV, TV)
n = length(hV);
valueV = zeros(size(hV));
for i1 = 1 : n
cvS.bpS.h0 = hV(i1);
cvS.bpS.T = TV(i1);
valueV(i1) = cvS.bpS.pv_earnings;
end
validateattributes(valueV, {'double'}, {'finite', 'nonnan', 'nonempty', 'real', 'positive'})
end
%% dV/dh
function mValueV = marginal_value_h(cvS, hV, TV)
n = length(hV);
mValueV = zeros(size(hV));
for i1 = 1 : n
cvS.bpS.h0 = hV(i1);
cvS.bpS.T = TV(i1);
mValueV(i1) = cvS.bpS.marginal_value_h(0);
end
validateattributes(mValueV, {'double'}, {'finite', 'nonnan', 'nonempty', 'real', 'positive'})
end
%% dV/dT
function mValueV = marginal_value_t(cvS, hV, TV)
n = length(hV);
mValueV = zeros(size(hV));
for i1 = 1 : n
cvS.bpS.h0 = hV(i1);
cvS.bpS.T = TV(i1);
mValueV(i1) = cvS.bpS.marginal_value_T;
end
validateattributes(mValueV, {'double'}, {'finite', 'nonnan', 'nonempty', 'real', 'positive'})
end
%% Value of postponing: -rV + dV/dT
function mValueV = value_postpone(cvS, hV, TV)
n = length(hV);
mValueV = zeros(size(hV));
for i1 = 1 : n
cvS.bpS.h0 = hV(i1);
cvS.bpS.T = TV(i1);
mValueV(i1) = cvS.bpS.marginal_value_age0;
end
validateattributes(mValueV, {'double'}, {'finite', 'nonnan', 'nonempty', 'real', '<', 0})
end
%% Study time at start of OJT
% To figure out whether a given (h, T) combination produces an (admissible)
% interior solution
function n0V = study_time(cvS, hV, TV)
n = length(hV);
n0V = zeros(size(hV));
for i1 = 1 : n
cvS.bpS.h0 = hV(i1);
cvS.bpS.T = TV(i1);
n0V(i1) = cvS.bpS.nh(0) ./ hV(i1);
end
validateattributes(n0V, {'double'}, {'finite', 'nonnan', 'nonempty', 'real', 'positive'})
end
%% Age profiles
function [hV, nV, xV, qV, incomeV] = age_profiles(cvS, h0, T, ageV)
cvS.bpS.h0 = h0;
cvS.bpS.T = T;
validateattributes(ageV, {'double'}, {'finite', 'nonnan', 'nonempty', 'real', '>=', 0, '<=', T})
% [hV, nV] = cvS.bpS.h_age(ageV);
% xV = cvS.bpS.x_age(ageV);
qV = cvS.bpS.marginal_value_h(ageV);
[incomeV, hV, nV, xV] = cvS.bpS.age_earnings_profile(ageV);
end
end
end