In [28]:
using RDatasets, DataFrames
using PyPlot
GDP_US = readtable("GDPC1.csv");
Consumption_US = readtable("PCECC96.csv");
EmploymentNonfarmBusiness_US = readtable("PRS85006013.csv");
AverageWeeklyHoursNonfarmBusiness_US = readtable("PRS85006023.csv");
EmploymentManufacturing_US = readtable("PRS30006013.csv");
AverageWeeklyHoursManufacturing_US = readtable("PRS30006023.csv");
EmploymentBusinessServices_US = readtable("PRS84006013.csv");
AverageWeeklyHoursBusinessServices_US = readtable("PRS84006023.csv");
GDP_DE = readtable("CLVMNACSCAB1GQDE.csv")
Consumption_DE = readtable("DEUPFCEQDSNAQ.csv")
EmploymentNonfarmBusiness_DE = readtable("TotalPrivateDE.csv");
EmploymentManufacturing_DE = readtable("ManufacturingDE.csv"); # last column has total hours worker per quarter
EmploymentBusinessServices_DE = readtable("BusinessServicesDE.csv") # last column has total hours worker per quarter
function hp_filter(y::Vector{Float64}, lambda::Float64)
n = length(y)
@assert n >= 4
diag2 = lambda*ones(n-2)
diag1 = [ -2lambda; -4lambda*ones(n-3); -2lambda ]
diag0 = [ 1+lambda; 1+5lambda; (1+6lambda)*ones(n-4); 1+5lambda; 1+lambda ]
D = spdiagm((diag2, diag1, diag0, diag1, diag2), (-2,-1,0,1,2))
return D\y
end
GDP_US[:TREND]=hp_filter(Array(GDP_US[:,:GDPC1]),1600.0)
GDP_US[:CYCLE]=GDP_US[:GDPC1]-GDP_US[:TREND]
GDP_DE[:TREND]=hp_filter(Array(GDP_DE[:,2]),1600.0)
GDP_DE[:CYCLE]=GDP_DE[:,2]-GDP_DE[:TREND]
Consumption_US[:TREND]=hp_filter(Array(Consumption_US[:,2]),1600.0)
Consumption_US[:CYCLE]=Consumption_US[:,2]-Consumption_US[:TREND]
Consumption_DE[:TREND]=hp_filter(Array(Consumption_DE[:,2]),1600.0)
Consumption_DE[:CYCLE]=Consumption_DE[:,2]-Consumption_DE[:TREND]
EmploymentNonfarmBusiness_DE[:,:TREND]=hp_filter(convert(Array{Float64,1},Array(EmploymentNonfarmBusiness_DE[:,:EMP])),1600.0)
EmploymentNonfarmBusiness_DE[:,:CYCLE]=EmploymentNonfarmBusiness_DE[:,2]-EmploymentNonfarmBusiness_DE[:,:TREND]
EmploymentNonfarmBusiness_US[:,:TREND]=hp_filter(convert(Array{Float64,1},Array(EmploymentNonfarmBusiness_US[:,2])),1600.0)
EmploymentNonfarmBusiness_US[:,:CYCLE]=EmploymentNonfarmBusiness_US[:,2]-EmploymentNonfarmBusiness_US[:,:TREND]
EmploymentManufacturing_US[:,:TREND]=hp_filter(Array(EmploymentManufacturing_US[:,2]),1600.0)
EmploymentManufacturing_US[:,:CYCLE]=EmploymentManufacturing_US[:,2]-EmploymentManufacturing_US[:,:TREND]
EmploymentManufacturing_DE[:,:TREND]=hp_filter(convert(Array{Float64,1},Array(EmploymentManufacturing_DE[:,2])),1600.0)
EmploymentManufacturing_DE[:,:CYCLE]=EmploymentManufacturing_DE[:,2]-EmploymentManufacturing_DE[:,:TREND]
EmploymentBusinessServices_US[:,:TREND]=hp_filter(Array(EmploymentBusinessServices_US[:,2]),1600.0)
EmploymentBusinessServices_US[:,:CYCLE]=EmploymentBusinessServices_US[:,2]-EmploymentBusinessServices_US[:,:TREND];
EmploymentBusinessServices_DE[:,:TREND]=hp_filter(convert(Array{Float64,1},Array(EmploymentBusinessServices_DE[:,2])),1600.0)
EmploymentBusinessServices_DE[:,:CYCLE]=EmploymentBusinessServices_DE[:,2]-EmploymentBusinessServices_DE[:,:TREND];
In [29]:
US_peaks=["1990-07-01","2001-04-01","2007-10-01"];
US_troughs=["1991-01-01","2001-10-01","2010-04-01"];
DE_peaks=["1991-01-01","2001-01-01","2008-01-01"];
DE_troughs=["1993-07-01","2005-04-01","2010-10-01"];
In [30]:
figure("gdp_US",figsize=(8,6))
for i in 3:3
#y1=GDP_US[(GDP_US[:DATE].>=US_peaks[i]).&(GDP_US[:DATE].<=US_troughs[i]),2]
y1=100*GDP_US[(GDP_US[:DATE].>=US_peaks[i]).&(GDP_US[:DATE].<=US_troughs[i]),:CYCLE]./
GDP_US[(GDP_US[:DATE].>=US_peaks[i]).&(GDP_US[:DATE].<=US_troughs[i]),:TREND];
#y1=y1./y1[1]
x = linspace(0,length(y1)-1,length(y1))
#ax=subplot(121)
plot(x, y1, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
grid("on")
title("Output")
ylabel("Percentage deviation from trend")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("gdp_US.png")
close("gdp_US")
In [31]:
figure("gdp_DE",figsize=(8,6))
for i in 3:3
y1=100*GDP_DE[(GDP_DE[:DATE].>=DE_peaks[i]).&(GDP_DE[:DATE].<=DE_troughs[i]),:CYCLE]./
GDP_DE[(GDP_DE[:DATE].>=DE_peaks[i]).&(GDP_DE[:DATE].<=DE_troughs[i]),:TREND];
x = linspace(0,length(y1)-1,length(y1))
#ax=subplot(121)
plot(x, y1, linewidth=2, color="red", alpha=0.6, label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
grid("on")
title("Output")
ylabel("Percentage deviation from trend")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("gdp_DE.png")
close("gdp_DE")
In [32]:
figure("gdp_US_DE",figsize=(8,6))
for i in 3:3
y1=100*GDP_US[(GDP_US[:DATE].>=US_peaks[i]).&(GDP_US[:DATE].<=US_troughs[i]),:CYCLE]./
GDP_US[(GDP_US[:DATE].>=US_peaks[i]).&(GDP_US[:DATE].<=US_troughs[i]),:TREND];
y2=100*GDP_DE[(GDP_DE[:DATE].>=DE_peaks[i]).&(GDP_DE[:DATE].<=DE_troughs[i]),:CYCLE]./
GDP_DE[(GDP_DE[:DATE].>=DE_peaks[i]).&(GDP_DE[:DATE].<=DE_troughs[i]),:TREND];
x1 = linspace(0,length(y1)-1,length(y1))
x2 = linspace(0,length(y2)-1,length(y2))
plot(x1, y1, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
plot(x2, y2, linewidth=2, color="red", alpha=0.6, label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
grid("on")
title("Output")
ylabel("Percentage deviation from trend")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("gdp_US_DE.png")
close("gdp_US_DE")
In [33]:
figure("consumption_US",figsize=(7,5))
for i in 3:3
y=100*Consumption_US[(Consumption_US[:DATE].>=US_peaks[i]).&(Consumption_US[:DATE].<=US_troughs[i]),:CYCLE]./
Consumption_US[(Consumption_US[:DATE].>=US_peaks[i]).&(Consumption_US[:DATE].<=US_troughs[i]),:TREND]
#y=100*y./y[1]
x = linspace(0,length(y)-1,length(y))
plot(x, y, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
grid("on")
title("Consumption")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("consumption_US.png")
close("consumption_US")
In [34]:
figure("consumption_DE",figsize=(7,5))
for i in 3:3
y=100*Consumption_DE[(Consumption_DE[:DATE].>=DE_peaks[i]).&(Consumption_DE[:DATE].<=DE_troughs[i]),:CYCLE]./
Consumption_DE[(Consumption_DE[:DATE].>=DE_peaks[i]).&(Consumption_DE[:DATE].<=DE_troughs[i]),:TREND]
x = linspace(0,length(y)-1,length(y))
plot(x, y, linewidth=2, color="red", alpha=0.6, label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
grid("on")
title("Consumption")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("consumption_DE.png")
close("consumption_DE")
In [35]:
figure("consumption_US_DE",figsize=(8,6))
for i in 3:3
y1=100*Consumption_US[(Consumption_US[:DATE].>=US_peaks[i]).&(Consumption_US[:DATE].<=US_troughs[i]),:CYCLE]./
Consumption_US[(Consumption_US[:DATE].>=US_peaks[i]).&(Consumption_US[:DATE].<=US_troughs[i]),:TREND]
y2=100*Consumption_DE[(Consumption_DE[:DATE].>=DE_peaks[i]).&(Consumption_DE[:DATE].<=DE_troughs[i]),:CYCLE]./
Consumption_DE[(Consumption_DE[:DATE].>=DE_peaks[i]).&(Consumption_DE[:DATE].<=DE_troughs[i]),:TREND]
x1 = linspace(0,length(y1)-1,length(y1))
x2 = linspace(0,length(y2)-1,length(y2))
plot(x1, y1, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
plot(x2, y2, linewidth=2, color="red", alpha=0.6, label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
grid("on")
title("Consumption")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("consumption_US_DE.png")
close("consumption_US_DE")
In [36]:
figure("employment_US",figsize=(8,6))
for i in 3:3
# y=EmploymentNonfarmBusiness_US[(EmploymentNonfarmBusiness_US[:DATE].>=US_peaks[i]).&(EmploymentNonfarmBusiness_US[:DATE].<=US_troughs[i]),2]
# y=100*y./y[1]
y=100*EmploymentNonfarmBusiness_US[(EmploymentNonfarmBusiness_US[:DATE].>=US_peaks[i]).&(EmploymentNonfarmBusiness_US[:DATE].<=US_troughs[i]),:CYCLE]./
EmploymentNonfarmBusiness_US[(EmploymentNonfarmBusiness_US[:DATE].>=US_peaks[i]).&(EmploymentNonfarmBusiness_US[:DATE].<=US_troughs[i]),:TREND]
x = linspace(0,length(y)-1,length(y))
plot(x, y, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
grid("on")
title("Employment")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("employment_US.png")
close("employment_US")
In [37]:
figure("employment_DE",figsize=(8,6))
for i in 3:3
y=100*EmploymentNonfarmBusiness_DE[(EmploymentNonfarmBusiness_DE[:DATE].>=DE_peaks[i]).&(EmploymentNonfarmBusiness_DE[:DATE].<=DE_troughs[i]),:CYCLE]./
EmploymentNonfarmBusiness_DE[(EmploymentNonfarmBusiness_DE[:DATE].>=DE_peaks[i]).&(EmploymentNonfarmBusiness_DE[:DATE].<=DE_troughs[i]),:TREND]
x = linspace(0,length(y)-1,length(y))
plot(x, y, linewidth=2, alpha=0.6, label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
grid("on")
title("Employment")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
close("employment_DE")
In [38]:
figure("employment_US_DE",figsize=(8,6))
for i in 3:3
y1=100*EmploymentNonfarmBusiness_US[(EmploymentNonfarmBusiness_US[:DATE].>=US_peaks[i]).&(EmploymentNonfarmBusiness_US[:DATE].<=US_troughs[i]),:CYCLE]./
EmploymentNonfarmBusiness_US[(EmploymentNonfarmBusiness_US[:DATE].>=US_peaks[i]).&(EmploymentNonfarmBusiness_US[:DATE].<=US_troughs[i]),:TREND]
x1 = linspace(0,length(y1)-1,length(y1))
y2=100*EmploymentNonfarmBusiness_DE[(EmploymentNonfarmBusiness_DE[:DATE].>=DE_peaks[i]).&(EmploymentNonfarmBusiness_DE[:DATE].<=DE_troughs[i]),:CYCLE]./
EmploymentNonfarmBusiness_DE[(EmploymentNonfarmBusiness_DE[:DATE].>=DE_peaks[i]).&(EmploymentNonfarmBusiness_DE[:DATE].<=DE_troughs[i]),:TREND]
x2 = linspace(0,length(y2)-1,length(y2))
plot(x1, y1, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
plot(x2, y2, linewidth=2, color="red", alpha=0.6, label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
grid("on")
title("Employment")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("employment_US_DE.png")
close("employment_US_DE")
In [39]:
figure("employment_manufacturing_US",figsize=(8,6))
for i in 3:3
y=100*EmploymentManufacturing_US[(EmploymentManufacturing_US[:DATE].>=US_peaks[i]).&(EmploymentManufacturing_US[:DATE].<=US_troughs[i]),:CYCLE]./
EmploymentManufacturing_US[(EmploymentManufacturing_US[:DATE].>=US_peaks[i]).&(EmploymentManufacturing_US[:DATE].<=US_troughs[i]),:TREND]
x = linspace(0,length(y)-1,length(y))
plot(x, y, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
grid("on")
title("Employment in Manufacturing")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("employment_manufacturing_US.png")
close("employment_manufacturing_US")
In [40]:
figure("employment_manufacturing_DE",figsize=(8,6))
for i in 3:3
y=100*EmploymentManufacturing_DE[(EmploymentManufacturing_DE[:DATE].>=DE_peaks[i]).&(EmploymentManufacturing_DE[:DATE].<=DE_troughs[i]),:CYCLE]./
EmploymentManufacturing_DE[(EmploymentManufacturing_DE[:DATE].>=DE_peaks[i]).&(EmploymentManufacturing_DE[:DATE].<=DE_troughs[i]),:TREND]
x = linspace(0,length(y)-1,length(y))
plot(x, y, linewidth=2, alpha=0.6, label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
grid("on")
title("Employment in Manufacturing")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("employment_manufacturing_DE.png")
close("employment_manufacturing_DE")
In [41]:
figure("employment_manufacturing_US_DE",figsize=(8,6))
for i in 3:3
y1=100*EmploymentManufacturing_US[(EmploymentManufacturing_US[:DATE].>=US_peaks[i]).&(EmploymentManufacturing_US[:DATE].<=US_troughs[i]),:CYCLE]./
EmploymentManufacturing_US[(EmploymentManufacturing_US[:DATE].>=US_peaks[i]).&(EmploymentManufacturing_US[:DATE].<=US_troughs[i]),:TREND]
x1 = linspace(0,length(y1)-1,length(y1))
y2=100*EmploymentManufacturing_DE[(EmploymentManufacturing_DE[:DATE].>=DE_peaks[i]).&(EmploymentManufacturing_DE[:DATE].<=DE_troughs[i]),:CYCLE]./
EmploymentManufacturing_DE[(EmploymentManufacturing_DE[:DATE].>=DE_peaks[i]).&(EmploymentManufacturing_DE[:DATE].<=DE_troughs[i]),:TREND]
x2 = linspace(0,length(y2)-1,length(y2))
plot(x1, y1, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
plot(x2, y2, linewidth=2, alpha=0.6, color="red", label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
grid("on")
title("Employment in Manufacturing")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("employment_manufacturing_US_DE.png")
close("employment_manufacturing_US_DE")
In [42]:
figure("employment_services_US",figsize=(8,6))
for i in 3:3
y=100*EmploymentBusinessServices_US[(EmploymentBusinessServices_US[:DATE].>=US_peaks[i]).&(EmploymentBusinessServices_US[:DATE].<=US_troughs[i]),:CYCLE]./
EmploymentBusinessServices_US[(EmploymentBusinessServices_US[:DATE].>=US_peaks[i]).&(EmploymentBusinessServices_US[:DATE].<=US_troughs[i]),:TREND]
x = linspace(0,length(y)-1,length(y))
plot(x, y, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
grid("on")
title("Employment in Services")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("employment_services_US.png")
close("employment_services_US")
In [43]:
figure("employment_services_DE",figsize=(8,6))
for i in 3:3
y=100*EmploymentBusinessServices_DE[(EmploymentBusinessServices_DE[:DATE].>=DE_peaks[i]).&(EmploymentBusinessServices_DE[:DATE].<=DE_troughs[i]),:CYCLE]./
EmploymentBusinessServices_DE[(EmploymentBusinessServices_DE[:DATE].>=DE_peaks[i]).&(EmploymentBusinessServices_DE[:DATE].<=DE_troughs[i]),:TREND]
x = linspace(0,length(y)-1,length(y))
plot(x, y, linewidth=2, alpha=0.6, label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
grid("on")
title("Employment in Services")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("employment_services_DE.png")
close("employment_services_DE")
In [44]:
figure("employment_services_US_DE",figsize=(8,6))
for i in 3:3
y1=100*EmploymentBusinessServices_US[(EmploymentBusinessServices_US[:DATE].>=US_peaks[i]).&(EmploymentBusinessServices_US[:DATE].<=US_troughs[i]),:CYCLE]./
EmploymentBusinessServices_US[(EmploymentBusinessServices_US[:DATE].>=US_peaks[i]).&(EmploymentBusinessServices_US[:DATE].<=US_troughs[i]),:TREND]
x1 = linspace(0,length(y1)-1,length(y1))
y2=100*EmploymentBusinessServices_DE[(EmploymentBusinessServices_DE[:DATE].>=DE_peaks[i]).&(EmploymentBusinessServices_DE[:DATE].<=DE_troughs[i]),:CYCLE]./
EmploymentBusinessServices_DE[(EmploymentBusinessServices_DE[:DATE].>=DE_peaks[i]).&(EmploymentBusinessServices_DE[:DATE].<=DE_troughs[i]),:TREND]
x2 = linspace(0,length(y2)-1,length(y2))
plot(x1, y1, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
plot(x2, y2, linewidth=2, alpha=0.6, color="red", label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
grid("on")
title("Employment in Services")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("employment_services_US_DE.png")
close("employment_services_US_DE")
In [45]:
figure("average_hours_US",figsize=(8,6))
for i in 3:3
y=AverageWeeklyHoursNonfarmBusiness_US[(AverageWeeklyHoursNonfarmBusiness_US[:DATE].>=US_peaks[i]).&(AverageWeeklyHoursNonfarmBusiness_US[:DATE].<=US_troughs[i]),2]
y=100*y./y[1]
x = linspace(0,length(y)-1,length(y))
grid("on")
title("Average hours per worker")
plot(x, y, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
ylabel("Index, 100=Q1")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("average_hours_US.png")
close("average_hours_US")
In [46]:
figure("average_hours_DE",figsize=(8,6))
for i in 3:3
y=EmploymentNonfarmBusiness_DE[(EmploymentNonfarmBusiness_DE[:DATE].>=DE_peaks[i]).&(EmploymentNonfarmBusiness_DE[:DATE].<=DE_troughs[i]),:H]
y=100*y./y[1]
x = linspace(0,length(y)-1,length(y))
grid("on")
title("Average hours per worker")
plot(x, y, linewidth=2, alpha=0.6, label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
ylabel("Index, 100=Q1")
xlabel("Quarters since Recession")
legend(loc="lower right")
end
savefig("average_hours_DE.png")
close("average_hours_DE")
In [47]:
figure("average_hours_US_DE",figsize=(8,6))
for i in 3:3
y1=AverageWeeklyHoursNonfarmBusiness_US[(AverageWeeklyHoursNonfarmBusiness_US[:DATE].>=US_peaks[i]).&(AverageWeeklyHoursNonfarmBusiness_US[:DATE].<=US_troughs[i]),2]
y1=100*y1./y1[1]
x1 = linspace(0,length(y1)-1,length(y1))
y2=EmploymentNonfarmBusiness_DE[(EmploymentNonfarmBusiness_DE[:DATE].>=DE_peaks[i]).&(EmploymentNonfarmBusiness_DE[:DATE].<=DE_troughs[i]),:H]
y2=100*y2./y2[1]
x2 = linspace(0,length(y2)-1,length(y2))
grid("on")
title("Average hours per worker")
plot(x1, y1, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
plot(x2, y2, linewidth=2, alpha=0.6, color="red", label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
ylabel("Index, 100=Q1")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("average_hours_US_DE.png")
close("average_hours_US_DE")
In [48]:
figure("average_hours_manufacturing_US",figsize=(8,6))
for i in 3:3
y=AverageWeeklyHoursManufacturing_US[(AverageWeeklyHoursManufacturing_US[:DATE].>=US_peaks[i]).&(AverageWeeklyHoursManufacturing_US[:DATE].<=US_troughs[i]),2]
y=100*y./y[1]
x = linspace(0,length(y)-1,length(y))
grid("on")
title("Average hours per worker in Manufacturing")
plot(x, y, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
ylabel("Index, 100=Q1")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("average_hours_manufacturing_US.png")
close("average_hours_manufacturing_US")
In [49]:
figure("hours_manufacturing_DE",figsize=(8,6))
for i in 3:3
y=EmploymentManufacturing_DE[(EmploymentManufacturing_DE[:DATE].>=DE_peaks[i]).&(EmploymentManufacturing_DE[:DATE].<=DE_troughs[i]),:HW]
y=100*y./y[1]
x = linspace(0,length(y)-1,length(y))
grid("on")
title("Average hours per worker in Manufacturing")
plot(x, y, linewidth=2, alpha=0.6, label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
ylabel("Indeex, 100=Q1")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("hours_manufacturing_DE.png")
close("hours_manufacturing_DE")
In [50]:
figure("average_hours_manufacturing_US_DE",figsize=(8,6))
for i in 3:3
y1=AverageWeeklyHoursManufacturing_US[(AverageWeeklyHoursManufacturing_US[:DATE].>=US_peaks[i]).&(AverageWeeklyHoursManufacturing_US[:DATE].<=US_troughs[i]),2]
y1=100*y1./y1[1]
x1 = linspace(0,length(y1)-1,length(y1))
y2=EmploymentManufacturing_DE[(EmploymentManufacturing_DE[:DATE].>=DE_peaks[i]).&(EmploymentManufacturing_DE[:DATE].<=DE_troughs[i]),:HW]
y2=100*y2./y2[1]
x2 = linspace(0,length(y2)-1,length(y2))
grid("on")
title("Average hours per worker in Manufacturing")
plot(x1, y1, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
plot(x2, y2, linewidth=2, color="red", alpha=0.6, label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
ylabel("Index, 100=Q1")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("average_hours_manufacturing_US_DE.png")
close("average_hours_manufacturing_US_DE")
In [51]:
figure("average_hours_services_US",figsize=(8,6))
for i in 3:3
y=AverageWeeklyHoursBusinessServices_US[(AverageWeeklyHoursBusinessServices_US[:DATE].>=US_peaks[i]).&(AverageWeeklyHoursBusinessServices_US[:DATE].<=US_troughs[i]),2]
y=100*y./y[1]
x = linspace(0,length(y)-1,length(y))
grid("on")
title("Average hours per worker in Services")
plot(x, y, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
ylabel("Index, 100=Q1")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("average_hours_services_US.png")
close("average_hours_services_US")
In [52]:
figure("hours_services_DE",figsize=(8,6))
for i in 3:3
y=EmploymentBusinessServices_DE[(EmploymentBusinessServices_DE[:DATE].>=DE_peaks[i]).&(EmploymentBusinessServices_DE[:DATE].<=DE_troughs[i]),:HW]
y=100*y./y[1]
x = linspace(0,length(y)-1,length(y))
grid("on")
title("Average hours per worker in Services")
plot(x, y, linewidth=2, alpha=0.6, label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
ylabel("Indeex, 100=Q1")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("hours_services_DE.png")
close("hours_services_DE")
In [53]:
figure("average_hours_services_US_DE",figsize=(8,6))
for i in 3:3
y1=AverageWeeklyHoursBusinessServices_US[(AverageWeeklyHoursBusinessServices_US[:DATE].>=US_peaks[i]).&(AverageWeeklyHoursBusinessServices_US[:DATE].<=US_troughs[i]),2]
y1=100*y1./y1[1]
x1 = linspace(0,length(y1)-1,length(y1))
y2=EmploymentBusinessServices_DE[(EmploymentBusinessServices_DE[:DATE].>=DE_peaks[i]).&(EmploymentBusinessServices_DE[:DATE].<=DE_troughs[i]),:HW]
y2=100*y2./y2[1]
x2 = linspace(0,length(y2)-1,length(y2))
grid("on")
title("Average hours per worker in Services")
plot(x1, y1, linewidth=2, alpha=0.6, label="United States: "*US_peaks[i]*" to "*US_troughs[i])
plot(x2, y2, linewidth=2, alpha=0.6, color="red", label="Germany: "*DE_peaks[i]*" to "*DE_troughs[i])
ylabel("Index, 100=Q1")
xlabel("Quarters since Recession")
legend(loc="upper right")
end
savefig("average_hours_services_US_DE.png")
close("average_hours_services_US_DE")
In [54]:
UB_US=readtable("W825RC1Q027SBEA.csv");
figure("UB_expenditures_US",figsize=(10,8))
x=linspace(1,length(UB_US[:,2]),length(UB_US[:,2]))
plot(UB_US[:,2], linewidth=2, alpha=0.6)
xticks(1:8:length(x),UB_US[1:8:length(x),1], rotation=60)
title("Unemployment Insurance expenditures, United States")
ylabel("USD Billions")
savefig("UB_expenditures_US.png")
close("UB_expenditures_US")
In [ ]: