How can I use time series data to forecast a future value?
I know how to do it in Excel, but I want to be able to compute on paper. I have 4-15 samples taken at a regular interval. I'd like to be able to forecast when the future sample value will reach a given value (how many more samples until we reach N?), and also forecast the value at a specified date (at T+30 what will the value be?) Thanks
Public Comments
- I *think* you want to do linear regression and then use the resulting line for the extrapolation? That is explained here: http://en.wikipedia.org/wiki/Trend_estimation When you have a big number of points in the sample it becomes quickly tedious to do it by hand. The quickest way is to graph the points, guestimate the position of the trendline and draw it by hand.
- Just to add, depending on the shape of the graph of your data, You may want to use a different type of regression to create an equation. ie if its a parbula, use quadratic regression, etc etc
- There r many types of models. AR, MA, ARMA, ARIMA, ARCH, GARCH, and lots of other which names I cannot recall. For the prediction to be of any use, the correct model must be used. Assume u have decided which model to use, u now need to estimate the parameters. The idea is simply to choose the parameter to produce the smallest possible deviation of the model and the data. You said u used Excel. so, i guess the method u used is simply trial and error. u try a range of values for the parameters and then pick the best one. You want to do it by hand. This is extremely tedious. One way to do it is simply to do the thousands of calculations by hand and compare. Another way to do it is by taking derivatives. The idea is simple. u have a model with certain parameter. Say, X(t+1)=aX(t)+et is your model where e is the random component with E(e)=0. So, your forecast of X(t+1) given information up to time t is X(t+1, forecast)=aX(t). The error of your forecast is know when at time t+1 when X(t+1) happens. So, the forecast error is X(t+1, real)-X(t+1, forecast)=(aX(t)+et) - aX(t) = et You do this for a few t's and u collect a bunch of et's for these t's. You then square the et's and sum them and call it S. St=(e1)^2 +(e2)^2 +e3)^2 +....+(et)^2 =(X(1)-aX(0))^2 +(X(2)-aX(1))^2+..... (squaring them is simply to remove the sign of the et's. There r other ways, for example, |et|). You want to pick an 'a' that minimise S. To get this a, take the first derivative of S wrt a and equate it to 0. dS/da = 0 Solve the equation to find possible values of a. Take the second derivative of S, d(dS/da)/da. Substitute possible values of 'a' into it. Those 'a' that make d(dS/da)/da<0 is the local point of maximum. To get the largest maximum, simply substitute these a into St to to find the one that gives the lowest St. This will be your best estimate of parameter. However, when u have more than 1 parameter, thing can get complicated. u would have more than 1 equation to solve and sometimes, u need to use numerical methods to solve them.... which will require the use od Excel again! As for forecasting... it depends on what model u r using. Generally, for those values u have not observe, u simply use the forecast. Say, you have a model that uses t-1, t-2 and t-3 to forecast t.... the history for past 3 periods. So, at time t, if u want to forecast X(t+1), u simply pluck in the observed X(t), X(t-1) and X(t-2): {Forecast of X(t+1) at time t }=F{X(t), X(t-1), X(t-2)}...where F denotes a function. Similarly, if u want to forecast X(t+3) at time t, u have {Forecast of X(t+3) at time t} = F{X(t+2,forecast), X(t+1, forecast), X(t)}. Or u want to forecast, say, t+100, {Forecast of X(t+100) at time t} = F{X(t+99,forecast), X(t+98, forecast), X(t+97, forecast)}. Hope u know what I mean. The difference between a forecast X(t, forecast) and a realisation in the real world X(t) is the random conponent. Without much information, all I can do is to use my best knowledge(the parameter and correct model) to forecast ahead. But as time goes by and i gather more data, I'll reset and improve my prediction everytimes I get more info. So, to predict how long u will need for the process to reach a certain level, u simply use the model(the formula), substitute the X(t) with data u observed(if it's observed already) and forecasted(if has not happened). Let the model evolve until it reach your required level, N. Then look at what the t is.. then this is the best estimate of how long it takes. If u make assumption about the distribution(s) of et's, the random conponent, u can even predict probabilities of the accuracy of your predictions. And also, the estimated parameters has uncertainty in them too, and taking these into account, u can calculate the probability of your forecast being right, allowing for the random fluctuation et and sampling error of estimating parameters. btw, time series analysis is about regression. Regression of data at different point in times instead of regression of different sets of data.
Powered by Yahoo! Answers