Backward prediction stock time series

4 visualizaciones (últimos 30 días)
ingCr
ingCr el 20 de Ag. de 2021
Comentada: ingCr el 24 de Ag. de 2021
Hello Everyone,
Im currently writing my thesis and need to backward predict the values of a stock price time series.
I have data of a stock from 2018-2020, but i want to predict the values for 2016-2017 in order to have
a full time series from 2016-2020.
Could you help me with the coding or advice on how to do this? I the data of one of the stocks.
Appreciate you time guys!

Respuestas (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 20 de Ag. de 2021
In this case, you'd need to perform the followings in order to extrapolate backward:
(1) Import data, e.g.:
D = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/717269/PR1C_dailyvalues.xlsx')
(2) Select rows where nans are not present:
IDX = isnan(D.PR1C);
(3) Convert the dates to numbers:
F1 = D(IDX==1,1).Date; F1D = datenum(F1); F1D=F1D-F1D(1)+1;
F2 = D(IDX==0,1).Date; F2D = datenum(F2); F2D=F2D-F2D(1)+1;
Data = D(IDX==0,2).PR1C;
(4) Find a fit model:
FM = fit(F2D,Data,'poly3'); % Cubic polynomial
(5) Compute the extrapolation values:
FIT_Data = polyval(FM, F1D);
% etc.
  1 comentario
ingCr
ingCr el 24 de Ag. de 2021
Thanks! that helped me a lot. The only thing is that I stil cant make the backward prediction. Keeps telling me that there is a problem with the data structure.
Do you happen to know who to do the same but with a time-series model?
Appreciate your time!

Iniciar sesión para comentar.

Categorías

Más información sobre Financial Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by