clear all
close all

x = load('cz.txt');
time = x(:,1);
usd = x(:,3);
cpi = x(:,4);
cpi_ger = x(:,5);
dem = x(:,6);
pribor = x(:,7)/100;

figure
plot(time,dem)
legend('nominal ex. rate CZK/DEM')
grid

basket = dem.^0.65 .* usd.^0.35;  % efective exchange rate, basket of two currencies (dem, usd),crisis in 1997, 
                                  % abandoning of regime of fixed exchange rate and
                                  % changing to regime of floating
                                  % (together with inflation targeting)


figure
plot(time,basket)
legend('effective exchange rate (basket DEM and USD')
grid

q = dem .* cpi_ger ./cpi;  % real exchange rate

figure
plot(time,q)
legend('real exchange rate')
grid

pie12 = cpi(13:end) ./ cpi(1:end-12) - 1;   %inflation rate from CPI (year-on-year) 
pie12 = [nan(12,1);pie12];

lcpi = log(cpi);

pie12L = lcpi(13:end) - lcpi(1:end-12);    %inflation rate from CPI (year-on-year) (logarithmic approximation)
pie12L = [nan(12,1);pie12L];

figure
plot(time,[pie12 pie12L]*100)
legend('inflation rate','inflation (log approximation)')
ylabel('%')
grid

pie1 = cpi(2:end) ./ cpi(1:end-1) -1;      %month-on-month inflation rate
pie1 = [nan;pie1]*12;                      %annualized

figure
plot(time,[pie1 pie12]*100)
legend('\pi_t m/m, p.a.','\pi_t y/y, p.a.')  % comparison m/m vs. y/y inflation rate
ylabel('%')
grid

rir = pribor(1:end-12) - pie12(13:end);    %real interest rate, we assume E_t pie_t+1 = pie_t+1 (perfect foresight)
rir = [rir;nan(12,1)];

figure
plot(time,rir*100)
legend('real interest rate')
ylabel('%')
grid












