-
Notifications
You must be signed in to change notification settings - Fork 20
/
derivative_MPL_discrete_workers.m
116 lines (96 loc) · 2.94 KB
/
derivative_MPL_discrete_workers.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
%% Marginal Product of Labor
% *back to* <https://fanwangecon.github.io *Fan*>*'s* <https://fanwangecon.github.io/Math4Econ/
% *Intro Math for Econ*>*,* <https://fanwangecon.github.io/M4Econ/ *Matlab Examples*>*,
% or* <https://fanwangecon.github.io/MEconTools/ *MEconTools*> *Repositories*
%% Marginal Product of Additional Workers (Discrete Workers)
% Suppose we can not hire fractions of workers, but have to hire 1, 2, 3, etc..
% What is the marginal product of each additional worker?
% fixed capital level
K = 1;
% current labor level
L = [1,2,3,4,5,6,7,8,9,10];
% Cobb Douglas Production Parameters
alpha = 0.5;
beta = 1-alpha;
% Output at x0
fx0 = (K^alpha)*(L.^beta);
% a vector of h
h = 1;
% output at fx0plush
x0plush = L+h;
fx0plush = (K^alpha)*((x0plush).^beta);
% derivatie
outputIncrease = (fx0plush - fx0)./h;
% Show Results in table
T = table(L', x0plush', fx0plush', outputIncrease');
T.Properties.VariableNames = {'L', 'x0plush', 'fx0plush', 'outputIncrease'};
disp(T);
% Graph
close all;
figure();
hold on;
plot(L, outputIncrease);
scatter(L, outputIncrease,'filled');
grid on;
ylabel('Marginal Output Increase from each Additional Worker (h=1)')
xlabel('L, previous/existing number of workers')
title('Discrete Labor Unit, Marginal Product of Each Worker')
%% Using Derivative to approximate Increase in Output from More Workers
% We know the MPL formula, so we can evaluate MPL at the vetor of L
% fixed capital level
K = 1;
% current labor level
L = [1,2,3,4,5,6,7,8,9,10];
% Cobb Douglas Production Parameters
alpha = 0.5;
% Output at x0
fprimeX0 = (1-alpha)*(K^alpha)*(L.^(-alpha));
T = table(L', outputIncrease', fprimeX0');
T.Properties.VariableNames = {'L', 'outputIncrease','fprimeX0'};
disp(T);
%% Marginal Product of Additional Workers Different Capital (Discrete Workers)
% Suppose we can not hire fractions of workers, but have to hire 1, 2, 3, etc..
% What is the marginal product of each additional worker?
% fixed capital level
K1 = 1;
[fprimeX0K1, L] = MPKdiscrete(K1);
K2 = 2;
[fprimeX0K2, L] = MPKdiscrete(K2);
K3 = 3;
[fprimeX0K3, L] = MPKdiscrete(K3);
% Graph
close all;
figure();
hold on;
plot(L, fprimeX0K1);
scatter(L, fprimeX0K1,'filled');
plot(L, fprimeX0K2);
scatter(L, fprimeX0K2,'filled');
plot(L, fprimeX0K3);
scatter(L, fprimeX0K3,'filled');
grid on;
ylabel('Marginal Output Increase from each Additional Worker (h=1)')
xlabel('L, previous/existing number of workers')
title('Discrete Labor Unit, Marginal Product of Each Worker')
legend(['k=',num2str(K1)], ['k=',num2str(K1)],...
['k=',num2str(K2)],['k=',num2str(K2)],...
['k=',num2str(K3)],['k=',num2str(K3)]);
%%
function [fprimeX0, L] = MPKdiscrete(K)
% current labor level
L = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
% Cobb Douglas Production Parameters
alpha = 0.5;
beta = 1-alpha;
% Output at x0
fx0 = (K^alpha)*(L.^beta);
% a vector of h
h = 1;
% output at fx0plush
x0plush = L+h;
fx0plush = (K^alpha)*((x0plush).^beta);
% derivatie
fprimeX0 = (fx0plush - fx0)./h;
end
%%
%