Performs the extrapolation of a time series
tsout=ts_extrap(tsin,dats,type_extrap,vals)
* tsin = a ts
* dats = the bounds over which the extrapolation is made
* type_extrap = a string, the way the extrapolation will be made:
- 'level' if it is done by entering its values ;
- 'growth rate' if it is done by applying growth rate to the previous value,
- 'delta rate' if it is done by adding values to the previous one,
- 'series' together with the name of a series in the ts applies the growth rates of the reference series to the extrapolated one, over the chosen time period
* vals = either a scalar or a vector of the size of the bounds, providing the value(s) used for extrapolation or the number of periods used to calculate the average growth rate if type_extrap has been set to 'av growth rate'
* tsout = the original ts that has been extrapolated
global GROCERDIR ; // load annual French GDP series from 1949 to 2010 load(GROCERDIR+'\data\Fra_GDP.dat') // extrapolate the ts until year 2015 with values that start from the 2010 value (1775.9922) // and grow at a 1% rate (check the result running growthr(GDP_new)) GDP_new=ts_extrap(Fra_GDP,'2015a','level',1775.9922*cumprod(1.01*ones(5,1))) // extrapolate the ts a at predefined growth rates (check the result by running: growthr(GDP_new)) GDP_new=ts_extrap(Fra_GDP,'2015a','growth rate',[1.02;1.01;1.015;1.015;1.02]) // extrapolate the ts adding 15 at each date (check the result by running: delts(GDP_new)) GDP_new=ts_extrap(Fra_GDP,'2015a','delta rate',15*ones(5,1)) // load the Irish GDP from 1981 to 2016 and extrapolate Fench GDP until year // with the Irish GDP growth rate (ok it does not make much sense on economic grounds!) // (check the result by running: growthr(GDP_new)-growthr(IRE_GDP)) load(GROCERDIR+'\data\ire_gdp.dat') GDP_new=ts_extrap(Fra_GDP,'2015a','series',IRE_GDP) | ![]() | ![]() |