The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Simple lag function
Replies: 1   Last Post: Apr 29, 2013 4:03 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 2,359
Registered: 12/6/04
Re: Simple lag function
Posted: Apr 29, 2013 4:03 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Gang-Gyoo " <> wrote in message <klmj51$i7v$>...
> 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?

Date Subject Author
Read Simple lag function
Read Re: Simple lag function

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.