fname = 'AWM18UP14_comma.xls';
sheet = 'AWM18UP14';
range_legend = 'B1:AW1';
range_data = 'B2:AW177';
range_q = 'A2:A177';

lambda = 1600;

[trash,legends] = xlsread(fname,sheet,range_legend);
[data,trash] = xlsread(fname,sheet,range_data);
[trash,q] = xlsread(fname,sheet,range_q);

N = size(data,1); % number of observations


for j=1:length(legends)
    str=[legends{j} '= data(:,' num2str(j) ');'];
    eval(str); % parse the data
    str=['d' legends{j} '= [NaN; data(2:end,' num2str(j) ') - data(1:end-1,' num2str(j) ')];'];
    eval(str); % and create diffed series
end

[T,C] = hpfilter(log(YER),lambda);
[Ti,Ci] = hpfilter(STN,1600);

figure(1)
    plot([log(YER) T],'linewidth',1);
        ind_x = 1:12:N;
        xticks(ind_x);
        xticklabels(q(ind_x));

figure(2)
    plot(100*C,'linewidth',2);
    xticks(ind_x);
    xticklabels(q(ind_x));
    hold on
        plot(C*0,'-','linewidth',2);
    hold off

return

figure(3)
    plot(dHICP,'linewidth',2)
    
figure(4)
    plot(STN);
    title('Short-term interest rate');
    
figure(5)
    plot([STN 100*C dHICP])
    legend('rate','100*gap','HICP')
    
    
x = [ones(N-1,1) 4*dHICP(2:end) 100*C(2:end)];
y = STN(2:end);

b = x\y; 

figure(6)

    plot([y x*b]);
