makeReturns | R Documentation |
Convenience function to calculate log-returns, also used extensively internally.
Accepts xts
and matrix
-like objects. If you use this with a data.table
object, remember to not pass the DT
column.
\mbox{log return}_t = (\log(\mbox{PRICE}_{t})-\log(\mbox{PRICE}_{t-1})).
makeReturns(ts)
ts |
a possibly multivariate matrix-like object containing prices in levels. If |
Note: the first (row of) observation(s) is set to zero.
Depending on input, either a matrix
or an xts
object containing the log returns.
Jonathan Cornelissen, Kris Boudt, and Emil Sjoerup
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.