How to forecast future values of a time series?

Asked

Viewed 935 times

2

I have values of a time series with a sampling every 5 minutes. How can I predict future values using only this information? How can I model something over a period of time and use it to predict the future (I’m trying to predict the value of glucose in a person)? How to predict values if by chance the sampling frequency is not constant?

Since I am not yet very well understood in the matter, some tutorials would be welcome along with your possible explanations.

PS: I need to first understand in theory and then understand in practice ;)

2 answers

0

I’m not the right person to give this answer...

Yet here comes a simplicist starter:

  • associated with a forecast of future values there is usually the choice of a "model" of the expected data behavior (e.g. linear model, polynomial, frame, splines). This model has to do with with the concrete plot, and can sometimes be "guessed" based on existing data.

  • on the basis of the model and existing data, it is possible to determine the constants of the model function; and on the basis of the model function to determine the expected value for a future time point and its confidence.

I suggest you start with some text linked to:

  • I have knowledge at the level of machine Learning but for classification problems. @Jjoao, do you know any documents that explain well the time series? I’ve been reading things related to this subject but it’s a little hard to understand :(

  • I’m not the one... I would suggest that you look at Khan.Academy for a little bit of statistics and "time series", for example http://ocw.metu.edu.tr/course/view.php?id=145. Maybe an old-fashioned book!

  • One of the best "old-fashioned" books: http://www.amazon.com/Pattern-Classification-2nd-Computer-Manual/dp/0471703508/ref=sr_1_1? s=books&ie=UTF8&qid=1439468395&sr=1-1&Keywords=Pattern+Classification+Duda :)

  • Other option more focused: http://www.amazon.com/Time-Analysis-James-Douglas-Hamilton/dp/0691042896/ref=sr_1_2? s=books&ie=UTF8&qid=1439468528&sr=1-2&Keywords=time+series

0

The critical point to predict is to calculate series autocorrelation. This is how past values influence the determination of future values. Then you have to analyze whether this relationship is linear, in this case you have many options of time series modeling using regression models.

Various other information and links can be found in this issue similar

An Example with simulated data is shown below

%# Gerar uma variável aleatória autocorrelacionada em 3 períodos.
T = 1000;
%
RV = zeros(T, 1); RV(1)=10+randn(1); RV(2)=1.5+.8*RV(1)+randn(1);
RV(3)=1.5+.8*RV(1)-.3*RV(1)+randn(1);
for c = 4:T ; RV(c)=1.5+.8*RV(c-1)-.3*RV(c-2)+.25*RV(c-3)+randn(1); end

% Pode iniciar aqui fazendo RV = SuaVariavel

plot(RV)

%# Construindo as variaveis com 3 defasagens
yout = RV(4:end); %# dependente
X1 = RV(3:end-1); %# defasagens da dependente (1er regressor)
X2 = RV(2:end-2);
X3 = RV(1:end-3);
%# matriz de regressores incluindo constante
X_train = [ones(length(X1), 1), X1, X2, X3];

%# MQO
mdl = regress(yout, X_train);
mdl

# Prever
X_test = [1, RV(T-1), RV(T-2), RV(T-3)];
%pred = predict(mdl,X_test);
sum(mdl'.*X_test) ; % Y em T+1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.