TSEXTEND {bimets} R Documentation

Extend Time Series

Description

This function extends the time series definition range by using a specified criteria. Values of time series extension are calculated by using the directives specified in the arguments `EXTMODE` and `FACTOR`.

Usage

```TSEXTEND(x = NULL, BACKTO = NULL, UPTO = NULL, EXTMODE = "GROWTH",
FACTOR = NA, avoidCompliance = FALSE, ...)
```

Arguments

 `x` Input time series that must satisfy the compliance control check defined in `is.bimets`. `BACKTO` Define the new start of the time series, that must be provided as `c(YEAR,PERIOD)`. It is possible to convert a `Date()`, or a `yearmon()`, or a `yearqtr()` to the related `c(YEAR,PERIOD)` by using the functions `date2yp`, `ym2yp`, and `yq2yp`. `UPTO` Define the new end of the time series, that must be provided as `c(YEAR,PERIOD)`. It is possible to convert a `Date()`, or a `yearmon()`, or a `yearqtr()` to the related `c(YEAR,PERIOD)` by using the functions `date2yp`, `ym2yp`, and `yq2yp`. `EXTMODE` It must be one of the following: MISSING: extend the time series using missings values `NA`. ZERO: extend the time series by using 0 (zero) values. CONSTANT: extend the time series by using the closest non-missing observation. MEAN4: extend the time series by using the mean of the closest four non-missing observations. LINEAR: extend the time series by using the same increment of the closest couple of observations. QUADRATIC: extend the time series by using the same quadratic increment of the closest eight observations. GROWTH: extends the time series by using the closest growth rate. GROWTH4: extend the time series by using the factor ``` r=(mean(x[-1:-4])/mean(x[-5:-8]))**(1/4)``` MYCONST: extend the time series by using the value defined in `FACTOR` MYRATE: extend the time series by using the increment defined in `FACTOR` `FACTOR` User-defined value used by some options of the `EXTMODE` argument. `avoidCompliance` If `TRUE`, compliance control check of input time series will be skipped. See `is.bimets` `...` Backward compatibility.

Value

This function returns a BIMETS time series built by extending the input time series.

See Also

`TSLAG`
`TSJOIN`
`TSMERGE`
`TSPROJECT`
`CUMSUM`
`INDEXNUM`
`TSTRIM`

Examples

```

n=10;
ts1=TIMESERIES(1:n,START=c(2000,1),FREQ='A')
ts2=TSEXTEND(ts1,BACKTO=c(1990,1),UPTO=c(2020,1),EXTMODE='GROWTH4')
TABIT(ts1,ts2)

xArr=c(0.5,5.6,4.8,3.8,7.3,9.9,7.8,3.7,8.2,10)
ts1=TIMESERIES(xArr,START=c(2000,1),FREQ='A')
ts2=TSEXTEND(ts1,BACKTO=c(1990,1),UPTO=c(2020,1),EXTMODE='QUADRATIC')
TABIT(ts1,ts2)

xArr=(1:n)
dateArr=seq(as.Date('2000/12/31'),by='year',length=n)
dataF=data.frame(dateArr,xArr)
ts1=TIMESERIES(xArr,START=c(2000,1),FREQ='A')
ts2=TSEXTEND(ts1,BACKTO=c(1990,1),UPTO=c(2020,1),EXTMODE='MYRATE',FACTOR=2.5)
TABIT(ts1,ts2)
```

[Package bimets version 1.5.3 Index]