%% HP filter for theta %% Dollar times series % 1960Q1-2020Q2, average daily exchange rate function xx=AR1hp_c_theta_dollar(xx) data = xlsread('NewKoreanData.xlsx','Shocks','F5:F246'); 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