# prediction Rolling Prediction

## Recommended Posts

• Seeq Team

Seeq Version: R21.0.42+

Scenario:

A user has a regularly updating signal and wants to predict a future value based on some amount of previous data. For this example the User wants to predict the Area A Temperature  3 days in the future based on the previous week (7 days) of data.

Steps:

1.  Bring in the regularly updating Temperature signal.

2. The Formula Tool can be used to create a condition that contains a single capsule referenced from the current time.  This capsule will be based on the current time and extend 7 days in the past and 3 days into the future.

Formula:

`condition(10d,capsule(now()-7d,now()+3d))`

3. The Prediction Tool requires an input signal to model the Temperature against.  In order to have fit the data with a linear regression, a linear input signal is required.  One of the simplest ways of generating a linear signal is the cumulative amount of time within the capsule.  This will give a straight line to compare against. Use the Formula Tool to generate the cumulative amount of time (in minutes) within the capsule:

Formula:

`1min.toSignal(1min).runningSum(\$condition)`

4. Use the Prediction Tool to linearly fit the data within the capsule.  The signal to model is the "Temperature" and the input is the "Running Time for Forcast".  The training window can be limited to just the condition in  "Advanced" section.

The final result is a linear fit of the data that is extend into the future to the end of the capsule.  Because the "7 days in past to 3 days in future" condition is relative to the current time, the prediction will continuously update.

##### Share on other sites

• 3 years later...
• Seeq Team

This method can now be simplify using the below formula :-

`\$signal.forecastLinear(7d,3d)`

Please do have a look at few other discussions as below links that applied the forecastlinear() function.

The cumulative of time as shown in Step 3 can be simplified to timesince(\$condition,1min).