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)
Depending on input, either a matrix
or an xts
object containing the log returns.
a possibly multivariate matrix-like object containing prices in levels. If ts
is an xts
object, we return an xts
object. Other types will result in a matrix
Jonathan Cornelissen, Kris Boudt, and Emil Sjoerup
Note: the first (row of) observation(s) is set to zero.