-
Notifications
You must be signed in to change notification settings - Fork 1
/
moments_US.m
118 lines (93 loc) · 3.05 KB
/
moments_US.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
117
118
%%==========================================================
%% Moments of US quarterly data
%% Period: 1964:Q1--2009:Q2
%% HP-filtered with weight 10^5
%%==========================================================
clear all;close all;
whp=10^5; % HP-filter weight, from Shimer (2005)
%% --- Get nominal wage data (CES, monthly) 01/1964--06/2009 ---
fid=fopen('data/CES-HWAGEPROD.txt');
TX = textscan(fid,'%s %s %s %f','HeaderLines',1,'delimiter', ',');
fclose(fid);
NW=TX{4};
NW=QUARTER(NW); % Make quarterly averages
%% --- Get price data (CPI, monthly) 01/1947--06/2009 ---
fid=fopen('data/CPI-URBAN.txt');
TX = textscan(fid,'%s %s %s %f','HeaderLines',1,'delimiter', ',');
fclose(fid);
CPI=TX{4};
CPI=QUARTER(CPI);
%% --- Construct (log) real wage series---
ind=max(size(NW));
CPI=CPI(end-ind+1:end);
RW=log(NW)-log(CPI);
%% --- Vacancies (merge two datasets: conference board and JOLTS) ---
% Get vacancy data from Conference Board (index, monthly, 01/1951--07/2006)
fid=fopen('data/HELPWANT.txt');
TX = textscan(fid,'%f %f %f %f','HeaderLines',0,'delimiter', '\t');
fclose(fid);
V=TX{4};
V=QUARTER(V); % Make quarterly averages: 1951:Q1--2006:Q2
Vtest=log(V(end-22+1:end));
V=log(V(1:end-22));
% Get JOLTS (monthly, 1,000, 12/2000 -- 06/2009)
fid=fopen('data/JOLTS-JOLNF.txt');
TX = textscan(fid,'%s %s %s %f','HeaderLines',1,'delimiter', ',');
fclose(fid);
VJ=TX{4}; % Vacancies
VJ=QUARTER(VJ(2:end)); % Make quarterly averages -- get rid of 12/2000
VJtest=log(VJ(1:22));VJ=log(VJ);
V=[V;VJ-VJtest(1)+Vtest(1)]; % Scale jolts series
%% --- Get CPS data 01/1948 -- 06/2009 ---
fid=fopen('data/CPS-UL.txt');
TX = textscan(fid,'%s %s %s %f','HeaderLines',1,'delimiter', ',');
fclose(fid);
UL=TX{4}; % Unemployment level
UL=QUARTER(UL); % Make quarterly averages
UL=log(UL);
fid=fopen('data/CPS-UR.txt');
TX = textscan(fid,'%s %s %s %f','HeaderLines',1,'delimiter', ',');
fclose(fid);
UR=TX{4}; % Unemployment rate
UR=QUARTER(UR); % Make quarterly averages
UR=log(UR);
%% --- Labor market tightness ---
% Adjust size
ind=max(size(V));
UL=UL(end-ind+1:end);
% Combine series
TH=V-UL; % In logs
%% ---Productivity data (quarterly, from MSPC BLS, 1947:Q1--2010:Q2) ---
fid=fopen('data/MSPC-OUTPUT.txt');
TX= textscan(fid,'%s %s %s %f','HeaderLines',1,'delimiter', '\t');
fclose(fid);
Y=TX{4};
fid=fopen('data/MSPC-EMP.txt');
TX= textscan(fid,'%s %s %s %f','HeaderLines',1,'delimiter', '\t');
fclose(fid);
N=TX{4};
alpha=0.666; % In the job-rationing model
Y=log(Y);
N=log(N);
A=Y-alpha.*N;
%% --- Adjust size of series, log, and HP filter ---
ind=max(size(RW)); % Nominal wage series is shortest
A=A(end-ind+1:end);
Y=Y(end-ind+1:end);
V=V(end-ind+1:end);
UR=UR(end-ind+1:end);
TH=TH(end-ind+1:end);
% Detrended with HP filter
a=hpfilter(A,whp);
rw=hpfilter(RW,whp);
unemp=hpfilter(UR,whp);
y=hpfilter(Y,whp);
th=hpfilter(TH,whp);
v=hpfilter(V,whp);
% Tabulate moments for 1964:Q1--2009:Q2
DD=[unemp,v,th,rw,y,a];
[moy,dev,autoc,Q]=SUMSTAT(DD);
TAB3=[dev',autoc',Q];
fid = fopen('moments.txt', 'wt');
fprintf(fid, '& %4.3f & %4.3f & %4.3f & %4.3f & %4.3f & %4.3f \\\\ \n', TAB3);
fclose(fid);