Date: Apr 29, 2013 4:03 PM
Author: Curious
Subject: Re: Simple lag function

"Gang-Gyoo " <ggjin@hhu.ac.kr> wrote in message <klmj51$i7v$1@newscl01ah.mathworks.com>...
> function test
>
> %Test data(not your data)
> data= rand(12,2);
>
> %Log monthly risk free rate
> lrf_m = log(1+(lag(data(:,2))/(100*12)));
> lrf_m(1,1)=NaN;
>
> %Log monthly exc return German Long term bond
> ly_10_m = (log(1+(data(:,1))/(100*12)));
> dur = 12*((1-(1+(data(:,1)/(100))).^(-10)))./(1-(1+(data(:,1)/(100))).^(-1));
> lret_b_10_m =(lag(dur).*lag(ly_10_m)-(lag(dur)-1).*ly_10_m);
> exlret_b_10 = lret_b_10_m-lrf_m
> end
>
> function y= lag(x)
> y= [NaN x(1:end-1)']';
> end


% Is there a question?