%% HP filter for theta %% Px times series % 1971Q1-2020Q2, export price of all items function xx=AR1hp_c_theta_px(xx) data = xlsread('NewKoreanData.xlsx','Shocks','D49:D246'); data = log(data); [~, data] = hpfilter(data,1600); xx = AR1theta(data); function theta = AR1theta(y) x = y(1:end-1); y = y(2:end); x = [ones(length(x),1) x]; B = (x'*x)\(x'*y); theta = B(2); end end