Sunteți pe pagina 1din 4

NumXLTipsandHintsBackwardForecast 1 SpiderFinancialCorp,2012

Forecast,Backward?
No,thisisnotmeantasanoxymoronbutratherasaquestionraisedbyoneofourusers.Andwe
thoughtitmaybeinterestingtoothers.
Sothestorygoeslikethis:Whenyouhaveasampletimeseries,mostofthetimeyouwouldliketo
forecastjustthefuturepoints(pasttheendofthesampledata).Butwhatabouttheonesthatfall
beforethestartofthesample?Canwepredictthoseaswell?Andifso,whatcanwesayaboutthe
forecastingprocess?
Whyshouldwecare?
Therearedifferentcaseswhereonewouldwanttopredictthepast.
Forexample,ouruserhadatemperaturetimeseriesthatwasmissingpastobservations,andhewanted
abestguessforthemusingthedynamicsdetectedinthesamedata.
Forfinancialtimeseriesthereisnomoneytomakeherebyforecastingthepast(unlesswehaveatime
machine).Butcantweusethepastdatapointsandtheirforecaststohelpusdiagnosethestabilityof
theunderlyingprocess?
Inthisissue,wewillshowhowtomakeabackwardforecastusingonlyNumXLfunctionsinExcel.We
willalsodiscusstherelationshipbetweenaregulartimeseriesmodelandanimpliedbackward/reversed
timeseriesmodel.
Forthedatasample,wellusethemonthlyMINMAXtemperaturesrecordedinagivencityfrom
January1988toDecember2009.
Background
Intimeseries,weusuallyexpressavalueofadatapointasafunctionofpriorvalues.

1 2 1 1 2 1
( , ,..., , , ,..., )
t t t t t t
X f X X X a a a a

= +
Where
-
1 2 1
{ , ,..., }
t t
X X X

isavaluessetofpastobservations
-
1 2 1
{ , ,..., }
t t
a a a

isasetofpastshocks/innovations
Inordertoreversetheproblemweneedtoexpressthepastobservationvaluesintermsoffutureones.

1 2 1 2
( , ,..., , , ,..., )
t t t T t t T t
X g X X X a a a a
+ + + +
= +

NumXLTipsandHintsBackwardForecast 2 SpiderFinancialCorp,2012

Where
-
1 2
{ , ,..., }
t t T
X X X
+ +
arethevaluesoffutureobservationsuptotheendofthesample
-
1 2
{ , ,..., }
t t T
a a a
+ +
isasetoffutureshocksorinnovationsuptotheendofthesample
Whenexaminingthetwoforms,youcanseethebackwardmodelisbasicallyatimeseriesmodelbut
withthechroniclereversedtimeseries{ }
t
Y data,suchthat:

t T t
t T t
Y X
X Y

=
=

So,letsreformulatetherelationsearlier:

1 2 1 2
( 1) ( 2) ( ) ( 1) ( 2) ( )
1 2 0 1 2 0
( , ,..., , , ,..., )
( , ,..., , , ,..., )
( , ,..., , , ,..., )
T T T t T T t T
T T T T T t T T T T t T
t T
X g X X X a a a a
X g X X X a a a a
Y g Y Y Y
t t t t t t t t
t t t t t t t t
t t t t t t
t
e e e e
+ + + + + +


=
= +
= +
= +

Where
- { } { }
T
a
t t
e

=
Byreversingthechronicleorderofthetimeserieswecanfitaregulartimeseriesmodelandforecast
newvaluesaswehaveusuallydone,butweinterpretthemasthepastvaluesintheoriginaltimeseries
domain.
Application
Foroursampledata,wellusethemonthlyMAXMINtemperature(Celsius)recordedatagivencity;

NumXLTipsandHintsBackwardForecast 3 SpiderFinancialCorp,2012

Notethatthetimeseriesexhibits12monthseasonalityandsomeupwarddrift(trend).
TheobjectivehereistoforecastthemonthlyMINMAXtemperaturesfrom1984and1988.
Notethatminimalandmaximumtemperaturetimeseriesarecorrelated.Butforourpurposeshere,
wellignoretheinterdependencyandforecasteachtimeseriesseparately.
Furthermore,wewillusetheWinterstripleexponentialsmoothingfunctiontodrivetheforecast.
Forecast
Asmentionedearlier,wereversedthechronicleorderoftheinputtimeseries(MINandMAX)suchthat
thefirstobservationisthelastoneandviceversa.WeusedtheNumXLREVERSEfunction.
Next,usingHoltWinterstripleexponentialfunction(TESMTHinNumXL),
(1)Weassumedadefaultvaluefor { , , } o | of0.1andcomputedaninsampleMAXforecastforeach
datapoint.
(2)Usingrootmeansquarederrors(i.e.RMSE)function,wecalculatedthediscrepancymeasure
betweenthemodelsvalueandthesampledatavalues.
(3)UsingtheSolver,weoptimizedthevaluesof { , , } o | thatwouldminimizetheRMSEvalue.For
moredetailsabouthowwecalibratedthecoefficients,pleaserefertoourissueonsmoothingfunctions
wherewetackletheparametersvalueoptimization.
(4)Afterward,weusedtheoptimalvaluesoftheTESMTHfunctiontoforecastoutofsampledata
points.

NumXLTipsandHintsBackwardForecast 4 SpiderFinancialCorp,2012

(5)ThenwerepeatedthesameprocedurefortheMINtimeseries.

Inthegraphabove,allobservationsbeforeDecember1988wereforecastedbytheTESMTHfunction.
Theforecastpreservedtheseasonality,andthetrendisveryminimal.
Conclusion
Wevedemonstratedhowtodoabackwardforecast,whichisapredictionforanobservationthatfalls
beforethestartofthesampledata.Thekeystepwasreversingthechronicleorderoftheinputtime
seriesbeforethestartoftheanalysis.
Furthermore,thetimeseriesprocessoftheoriginaldataisdifferentfromtheprocessofthereversed
timeseries.

1
1
t t t
x x a o | |

= + + <
Toreversetherelationship,

1
t t
t
x a
x
o
|

+
=
Butiftheprocessisstationaryinonedirection,itis,bydefinition,stationaryforthereversedtimeseries
process.
Finally,inourapplicationwemustnotethatforecastingeachseriesindependentlyisnotoptimalaswe
arenottakingintoconsiderationtheinterdependencyoftwotimeseries.

S-ar putea să vă placă și