-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTECHNO.m
35 lines (26 loc) · 1.31 KB
/
TECHNO.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
%%==============================================================================
%% Construct the time series for technology from US data, HP-filter it, and report detrended series as well as momemts of series
%% Moments are obtained by estimating a weekly AR(1) process
%% Focus on the period 1964:Q1--2009:Q2
%%==============================================================================
function [rho_a,sigma_a,ax]=TECHNO(alpha,nsample)
whp=10^5; % Weight on HP filter
%% --- Get productivity data (quarterly, from BLS) ---
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};
Y=log(Y);
N=log(N);
A=Y-alpha.*N;
A=A(end-(nsample)+1:end);
ahp=hpfilter(A,whp); % Detrended log technology
ax=exp(ahp); % Detrended technology: mean of 1, as normalized
%% --- Run AR(1) regression on detrended technology series ---
[rho,sigma]=AR(ahp,1);
rho_a=(rho).^(1./12) ; % Persistence in labor productivity (estimated for 1964-2009 with AR(1) and brought at weekly frequency)
sigma_a=sigma./(1+rho_a^2+rho_a^4+rho_a^6+rho_a^8+rho_a^10+rho_a^12+rho_a^14+rho_a^16+rho_a^18+rho_a^20+rho_a^22).^(0.5); % Variance of epsilon in log labor productivity