Thursday, December 4, 2014

r - Quantmod: what's the difference between ROC(Cl(SPY)) and ClCl(SPY)


I feel like I'm missing something fundamental here, but I can't shake the feeling that these two series should be equivalent.



/edit: there is also dailyReturn(Cl(SPY)). I've seen all 3 of these methods used to calculate stock returns on various blogs, and I'm wondering which is 'correct.' They all give slightly different results...


/edit2: and there is also Delt(Cl(SPY)), which seems to be equivalent to ClCl(SPY)



Answer



TTR::ROC calculates log returns by default. quantmod::ClCl uses quantmod::Delt, which calculates arithmetic returns by default.


ROC(Cl(SPY), type="discrete") should match ClCl(SPY). Which is 'correct' depends on your purpose.


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...