Title

Tuesday, 20 January 2015

Forecasting a Time series using an nls model


I have a time series with over 2000 daily data.

Having used the nls model below to fit half of the data(from 1 to 1000).

I would like to use the output from the fitted data to forecast the remaining 1000. Such that the value forecasted for the next day would be used inturn to forecast for the following day etc.

Could some one help with the codes to program it in R platform?

Thank you.

nls(k ~ a0 - a2*sin(((pi*0.01)/5)*t + phi1) + a4*sin(((2*pi*0.01)/5)*t + phi2) -   a6*sin(((3*pi*0.01)/5)*t + phi3),   data = X,   start = list(a0=0.01,a2=0.01,a4=0.01, a6=0.01, phi1=0.21,phi2= -0.10, phi3=0.35)
Answer

No comments:

Post a Comment