Financial Time Series | ![]() ![]() |
Create Return Series
Now calculate the return series from the stock price data. A stock return is calculated by dividing the difference between the current closing price and the previous closing price by the previous closing price.
tret = (t0.Spot - lagts(t0.Spot, 1)) ./ lagts(t0.Spot, 1); tret = chfield(tret, 'Spot', 'Return');
Ignore any warnings you receive during this sequence. Since the operation on the first line above preserves the data series name Spot
, it has to be changed with the chfield
command to reflect the contents correctly.
![]() | Adjust Closing Prices and Make Them Spot Prices | Regress Return Series Against Metric Data | ![]() |