Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

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

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

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: 14
Registered: 4/28/10
Simple lag function
Posted: Apr 29, 2013 3:54 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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)));

%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

function y= lag(x)
y= [NaN x(1:end-1)']';

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 1994-2015. All Rights Reserved.