makeReturns {highfrequency} | R Documentation |
Compute log returns
Description
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})).
Usage
makeReturns(ts)
Arguments
ts |
a possibly multivariate matrix-like object containing prices in levels. If |
Details
Note: the first (row of) observation(s) is set to zero.
Value
Depending on input, either a matrix
or an xts
object containing the log returns.
Author(s)
Jonathan Cornelissen, Kris Boudt, and Emil Sjoerup
[Package highfrequency version 1.0.1 Index]