TimeSeries.OBeu v1.2.2 release on CRAN
We are very pleased to announce TimeSeries.OBeu v1.2.2 on CRAN!
TimeSeries.OBeu
is used on OpenBudgets.eu data mininig tool platform with OpenCPU integration of R and JavaScript to estimate and return the needed parameters for visualizations designed for OpenBudgets.eu time series budget or expenditure data.
The vignette shows the way TimeSeries.OBeu (in R and OpenCPU environment) is fitted with datasets of OpenBudgets.eu according to the OpenBudgets.eu data model. Detailed documentation about OpenBudgets.eu data model can be found here.
First install TimeSeries.OBeu
install.packages('TimeSeries.OBeu')
and start using the library
# load TimeSeries.OBeulibrary(TimeSeries.OBeu)
open_spending.ts
is designed to estimate autocorrelation and partial autocorrelation of input time series data, autocorrelation and partial autocorrelation of the model residuals, trend, seasonal (if exists) and remainder components, model parameters such as arima order, arima coefficients etc. and the desired forecasts with their corresponding confidence intervals
of OpenBudgets.eu time series data.
The input data must be a JSON link according to the OpenBudgets.eu data model. The user should specify the amount and time variables, future steps to be predicted (default is 1 step forward) and the arima order (if not specified the most appropriate model will be selected according to AIC value).
Input  Description 

json_data 
The json string, URL or file from Open Spending API 
time 
the time label of the json time series data 
amount 
the amount label of the json time series data 
order 
An integer vector of length 3 specifying the order of the Arima model 
prediction_steps 
The number of prediction steps 
TimeSeries.OBeu includes function that automatically tests the deterministic and stochastic trend of the input time series data. This function uses ACF and PACF functions from forecast package, Phillips Perron test, Augmented Dickey Fuller (ADF) test, Kwiatkowski Phillips Schmidt Shin (KPSS) test, from tseries package and Mann Kendall test for Monotonic Trend Cox Stuart trend test from trend package.
Decomposition of seasonal time series data through arima models is based on stlm from forecast package and returns a list with useful parameters for OBEU. For nonseasonal time series that there is no seasonal component, local regression and likelihood models (locfit package) are used in order to extract the trend and remaider components.
Model fit of time series using arima models of seasonal time series data. The model with the lowest AIC value is selected for forecasts.
Forecasts the model that fits the input data using the auto.arima function(see forecast package). The model selection depends on the results of some diagnostic tests (acf,pacf,pp adf and kpss). For short time series the selected arima model is among various orders of the AR part using the first differences and the first order moving average component, with the lower AIC value.
Here is a sort description of the outputs of each function:
Component  Output  Description 

acf.parameters 


pacf.parameters 


acf.residuals.parameters 


pacf.residuals.parameters 


stl.plot 


stl.general 


residuals 


compare 


forecasts 


The dataset that is being used is a sample json string from OpenBudgets.eu platform.
open_spending.ts
function’s input are data as json link and described with OpenBudgets.eu data model.
#example openbudgets.eu time series datasample.ts.data = '{ "page": 0,
"page_size": 30,
"total_cell_count": 15,
"cell": [],
"status": "ok",
"cells": [{
"global__fiscalPeriod__28951.notation": "2002",
"global__amount__0397f.sum": 290501420.64,
"global__amount__0397f__CZK.sum": 9210928544.2325,
"_count": 4805
},
{
"global__fiscalPeriod__28951.notation": "2003",
"global__amount__0397f.sum": 311242291.07,
"global__amount__0397f__CZK.sum": 9832143974.9013,
"_count": 4988
},
{
"global__fiscalPeriod__28951.notation": "2004",
"global__amount__0397f.sum": 5268500701.1,
"global__amount__0397f__CZK.sum": 170688885714.24,
"_count": 10055
},
{
"global__fiscalPeriod__28951.notation": "2005",
"global__amount__0397f.sum": 2542887761.01,
"global__amount__0397f__CZK.sum": 77204615312.025,
"_count": 2032
},
{
"global__fiscalPeriod__28951.notation": "2006",
"global__amount__0397f.sum": 14803951786.68,
"global__amount__0397f__CZK.sum": 429758720367.32,
"_count": 13632
},
{
"global__fiscalPeriod__28951.notation": "2007",
"global__amount__0397f.sum": 16188514346.44,
"global__amount__0397f__CZK.sum": 445588857385.76,
"_count": 22798
},
{
"global__fiscalPeriod__28951.notation": "2008",
"global__amount__0397f.sum": 18231035815.89,
"global__amount__0397f__CZK.sum": 480643028250.12,
"_count": 24176
},
{
"global__fiscalPeriod__28951.notation": "2009",
"global__amount__0397f.sum": 19079541164.68,
"global__amount__0397f__CZK.sum": 511808691742.54,
"_count": 26250
},
{
"global__fiscalPeriod__28951.notation": "2010",
"global__amount__0397f.sum": 22738650575.01,
"global__amount__0397f__CZK.sum": 597685430364.14,
"_count": 87667
},
{
"global__fiscalPeriod__28951.notation": "2011",
"global__amount__0397f.sum": 24961375670.57,
"global__amount__0397f__CZK.sum": 626230992823.26,
"_count": 134352
},
{
"global__fiscalPeriod__28951.notation": "2012",
"global__amount__0397f.sum": 261513607691.41,
"global__amount__0397f__CZK.sum": 7030666436872.5,
"_count": 147556
},
{
"global__fiscalPeriod__28951.notation": "2013",
"global__amount__0397f.sum": 268946402299.09,
"global__amount__0397f__CZK.sum": 7226220232913.8,
"_count": 150079
},
{
"global__fiscalPeriod__28951.notation": "2014",
"global__amount__0397f.sum": 255222816704.9,
"global__amount__0397f__CZK.sum": 6907598086283.4,
"_count": 176019
},
{
"global__fiscalPeriod__28951.notation": "2015",
"global__amount__0397f.sum": 22976062973.62,
"global__amount__0397f__CZK.sum": 636276111928.46,
"_count": 213777
},
{
"global__fiscalPeriod__28951.notation": "2016",
"global__amount__0397f.sum": 12051686541.16,
"global__amount__0397f__CZK.sum": 325672725401.77,
"_count": 161797
}
],
"order": [
["global__fiscalPeriod__28951.fiscalPeriod", "asc"]
],
"aggregates": ["", "_count"],
"summary": {
"global__amount__0397f.sum": 945126777743.27,
"global__amount__0397f__CZK.sum": 25485085887878
},
"attributes": [""]
}'
result = open_spending.ts( json_data = sample.ts.data, time ="global__fiscalPeriod__28951.notation", amount = "global__amount__0397f.sum"
)
# Pretty output using prettify of jsonlite library
jsonlite::prettify(result,indent = 2)
Go to: yourserver/ocpu/test
Copy and paste the following function to the endpoint
../library/TimeSeries.OBeu/R/open_spending.ts# library/ {name of the library} /R/ {function}
Post
Click add parameters every time you want to add a new parameters and values.
Define the input data:
json_data
Define the time parameter:
time
Define the amount parameter:
amount
You add likewise x.order parameter to fit a specific arima order, see TimeSeries.OBeu reference manual for further details.
copy the /ocpu/tmp/{this_id_number}/R/.val (second on the right panel)
finally, paste yourserver/ocpu/tmp/{this_id_number}/R/.val
on a new tab.
© 2020 TechTarget, Inc. Powered by
Badges  Report an Issue  Privacy Policy  Terms of Service
Most Popular Content on DSC
To not miss this type of content in the future, subscribe to our newsletter.
Other popular resources
Archives: 20082014  20152016  20172019  Book 1  Book 2  More
Most popular articles
You need to be a member of Data Science Central to add comments!
Join Data Science Central