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 ]
Gang-Gyoo

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


Date Subject Author
4/29/13
Read Simple lag function
Gang-Gyoo
4/29/13
Read Re: Simple lag function
Curious

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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.