Univariate time series analysis for short and long time series data using the appropriate model.

ts.analysis(tsdata, x.order=NULL, prediction.steps=1, tojson=T)

Arguments

tsdata

The input univariate time series data

x.order

An integer vector of length 3 specifying the order of the Arima model

prediction.steps

The number of prediction steps

tojson

If TRUE the results are returned in json format, default returns a list

Value

A json string with the parameters:

  • acf.param

    • acf.parameters:

      • acf The estimated acf values of the input time series

      • acf.lag The lags at which the acf is estimated

      • confidence.interval.up The upper limit of the confidence interval

      • confidence.interval.low The lower limit of the confidence interval

    • pacf.parameters:

      • pacf The estimated pacf values of the input time series

      • pacf.lag The lags at which the pacf is estimated

      • confidence.interval.up The upper limit of the confidence interval

      • confidence.interval.low The lower limit of the confidence interval

    • acf.residuals.parameters:

      • acf.res The estimated acf values of the model residuals

      • acf.res.lag The lags at which the acf is estimated of the model residuals

      • confidence.interval.up The upper limit of the confidence interval

      • confidence.interval.low The lower limit of the confidence interval

    • pacf.residuals.parameters:

      • pacf.res The estimated pacf values of the model residuals

      • pacf.res.lag The lags at which the pacf is estimated of the model residuals

      • confidence.interval.up The upper limit of the confidence interval

      • confidence.interval.low The lower limit of the confidence interval

  • param

    • stl.plot:

      • trend The estimated trend component

      • trend.ci.up The estimated up limit for trend component (for non seasonal time series)

      • trend.ci.low The estimated low limit for trend component (for non seasonal time series)

      • seasonal The estimated seasonal component

      • remainder The estimated remainder component

      • time The time of the series was sampled

    • stl.general:

      • stl.degree The degree of fit

      • degfr The effective degrees of freedom for non seasonal time series

      • degfr.fitted The fitted degrees of freedom for non seasonal time series

      • fitted The model's fitted values

    • residuals The residuals of the model (fitted innovations)

    • compare:

      • arima.order The Arima order for seasonal time series

      • arima.coef A vector of AR, MA and regression coefficients

      • arima.coef.se The standard error of the coefficients

      • covariance.coef The matrix of the estimated variance of the coefficients

      • resid.variance The residuals variance

      • not.used.obs The number of not used observations for the fitting

      • used.obs The used observations for the fitting

      • loglik The maximized log-likelihood (of the differenced data), or the approximation to it used

      • aic The AIC value corresponding to the log-likelihood

      • bic The BIC value corresponding to the log-likelihood

      • gcv The generalized cross-validation statistic time series

      • aicc The second-order Akaike Information Criterion corresponding to the log-likelihood for seasonal time series

  • forecasts

    • ts.model a string indicating the arima orders

    • data_year The time that time series data were sampled

    • data The time series values

    • predict_time The time that defined by the prediction_steps parameter

    • predict_values The predicted values that defined by the prediction_steps parameter

    • up80 The upper limit of the 80% predicted confidence interval

    • low80 The lower limit of the 80% predicted confidence interval

    • up95 The upper limit of the 95% predicted confidence interval

    • low95 The lower limit of the 95% predicted confidence interval

Details

This function automatically tests for stationarity of the input time series data using ts.stationary.test function. Depending the nature of the time series data and the stationary tests there are four branches: a.)short and non seasonal, b.)short and seasonal, c.)long and non seasonal and d.)long and seasonal. For branches a and c ts.non.seas.model is used and for b and d ts.seasonal.model is used.

This function also decomposes both seasonal and non seasonal time series through ts.non.seas.decomp and ts.seasonal.decomp and forecasts h steps ahead the user selected(default h=1) using ts.forecast.

See also

ts.stationary.test, ts.acf, ts.seasonal.model, ts.seasonal.decomp, ts.non.seas.model, ts.non.seas.decomp, ts.forecast

Examples

ts.analysis(Athens_draft_ts, prediction.steps=3)
#> {"acf.param":{"acf.parameters":{"acf":[1,0.6701,0.2048,-0.2919,-0.5127,-0.5143,-0.282,-0.0182,0.1093,0.091,0.0325],"acf.lag":[0,1,2,3,4,5,6,7,8,9,10],"confidence.interval.up":[0.5658],"confidence.interval.low":[-0.5658]},"pacf.parameters":{"pacf":[0.6701,-0.4433,-0.4358,0.0271,-0.1179,0.0163,-0.0433,-0.2771,-0.1221,0.0503],"pacf.lag":[1,2,3,4,5,6,7,8,9,10],"confidence.interval.up":[0.5658],"confidence.interval.low":[-0.5658]},"acf.residuals.parameters":{"acf.residuals":[1,0.843,0.7463,0.5848,0.4491,0.2929,0.1525,0.006,-0.1366,-0.2598,-0.3856,-0.4905,-0.6126,-0.5635,-0.522,-0.4455],"acf.residuals.lag":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],"confidence.interval.up":[0.5658],"confidence.interval.low":[-0.5658]},"pacf.residuals.parameters":{"pacf.residuals":[0.843,0.1231,-0.2484,-0.0772,-0.1179,-0.0931,-0.1185,-0.1479,-0.0829,-0.1589,-0.1436,-0.2656,0.4077,0.159,-0.1307],"pacf.residuals.lag":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],"confidence.interval.up":[0.5658],"confidence.interval.low":[-0.5658]}},"decomposition":{"stl.plot":{"trend":[698958230.0959,656722462.4698,666934797.6034,720359312.9533,825103477.7027,927286963.4796,955162556.072,901594076.3243,826636813.9483,777095660.2212,749465108.9076,753417720.7148],"conf.interval.up":[799474104.4628,718316873.2136,728193402.4122,787153597.0524,894791906.2167,998843432.4668,1026719025.0592,971282504.8383,893431098.0473,838354265.03,811059519.6515,853933595.0817],"conf.interval.low":[598442355.729,595128051.7259,605676192.7946,653565028.8543,755415049.1887,855730494.4925,883606087.0849,831905647.8104,759842529.8492,715837055.4123,687870698.1638,652901846.3479],"seasonal":{},"remainder":[21936769.9041,-27785462.4698,-48384797.6034,4470687.0467,33838522.2973,-7778963.4796,22325443.928,30012923.6757,39880579.0517,-109987660.2212,23957446.0924,6141563.2852],"time":[2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015]},"stl.general":{"degfr":[5.4179],"degfr.fitted":[5.1011],"stl.degree":[2]},"residuals_fitted":{"residuals":[21936769.9041,-27785462.4698,-48384797.6034,4470687.0467,33838522.2973,-7778963.4796,22325443.928,30012923.6757,39880579.0517,-109987660.2212,23957446.0924,6141563.2852],"fitted":[698958230.0959,656722462.4698,666934797.6034,720359312.9533,825103477.7027,927286963.4796,955162556.072,901594076.3243,826636813.9483,777095660.2212,749465108.9076,753417720.7148],"time":[2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015],"line":[0]},"compare":{"resid.variance":[1.86531930797979e+015],"used.obs":[2004,2015,2009.5,2006.75,2012.25],"loglik":[-1.02592561938889e+016],"aic":[2.05185123877777e+016],"bic":[2.05185123877777e+016],"gcv":[5.68320742803746e+015]}},"model.param":{"model":{"arima.order":[1,1,0,0,1,1,0],"arima.coef":[0.1441,0.0153],"arima.coef.se":[0.8665,0.8392]},"residuals_fitted":{"residuals":[720894.6302,-90787238.6325,4239112.9372,107712202.5897,117144839.4241,39442974.6622,48646734.4435,-54982432.2565,-57635036.0029,-189145649.1128,137951183.7204,-31298309.7508],"fitted":[720174105.3698,719724238.6325,614310887.0628,617117797.4103,741797160.5759,880065025.3378,928841265.5565,986589432.2565,924152429.0029,856253649.1128,635471371.2796,790857593.7508],"time":[2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015],"line":[0]},"compare":{"resid.variance":[1.10709947302236e+016],"variance.coef":[[0.7508,-0.6832],[-0.6832,0.7043]],"not.used.obs":[0],"used.obs":[11],"loglik":[-217.7045],"aic":[441.409],"bic":[442.6027],"aicc":[444.8376]}},"forecasts":{"ts.model":["ARIMA(1,1,1)"],"data_year":[2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015],"data":[720895000,628937000,618550000,724830000,858942000,919508000,977488000,931607000,866517393,667108000,773422555,759559284],"predict_time":[2016,2017,2018],"predict_values":[757082034.9521,756724985.1315,756673522.9766],"up80":[891925345.8547,963185026.4698,1017532317.1036],"low80":[622238724.0495,550264943.7933,495814728.8496],"up95":[963307082.801,1072478370.4413,1155622621.3081],"low95":[550856987.1032,440971599.8218,357724424.6451]}}