Package 'forecasteR'

Title: Time Series Forecast System
Description: A web application for displaying, analysing and forecasting univariate time series. Includes basic methods such as mean, naïve, seasonal naïve and drift, as well as more complex methods such as Holt-Winters Box,G and Jenkins, G (1976) <doi:10.1111/jtsa.12194> and ARIMA Brockwell, P.J. and R.A.Davis (1991) <doi:10.1007/978-1-4419-0320-4>.
Authors: Oldemar Rodriguez [aut, cre], Diego Jiménez [aut]
Maintainer: Oldemar Rodriguez <[email protected]>
License: GPL (>=2)
Version: 2.0.2
Built: 2024-11-14 04:30:00 UTC
Source: https://github.com/PROMiDAT/forecasteR

Help Index


Best parameters arima model

Description

Best parameters arima model

Usage

calibrar.arima(train, test, period, ar = 0:2, es = 0:1)

Arguments

train

a ts object (train of a time series).

test

a ts object (test of a time series).

period

value indicate the period to use.

ar

vector of values to test p, d, q of arima model.

es

vector of values to test P, D, Q of arima model.

Value

arima model

Author(s)

Diego Jimenez <[email protected]>

Examples

calibrar.arima(AirPassengers[1:132], AirPassengers[133:144], 12, 0:1)

Best parameters HoltWinters model

Description

Best parameters HoltWinters model

Usage

calibrar.HW(train, test, paso = 0.1)

Arguments

train

a ts object (train of a time series).

test

a ts object (test of a time series).

paso

indicates by value to test alpha, beta and gamma.

Value

HoltWinters model

Author(s)

Diego Jimenez <[email protected]>

Examples

calibrar.HW(window(AirPassengers, end = c(1959, 12)), window(AirPassengers, start = 1960), 0.5)

Periodogram Data.frame

Description

Periodogram Data.frame

Usage

df_periods(x)

Arguments

x

a ts object.

Value

data.frame

Author(s)

Diego Jimenez <[email protected]>

Examples

df_periods(AirPassengers)

Data.frame with normal test

Description

Data.frame with normal test

Usage

dfnormal(data)

Arguments

data

a data.frame object only with the numeric columns.

Value

data.frame

Author(s)

Diego Jimenez <[email protected]>

Examples

dfnormal(iris[, -5])

Best parameters arima model

Description

Best parameters arima model

Usage

e_acf(x)

Arguments

x

a ts object.

Value

echarts4r plot

Author(s)

Diego Jimenez <[email protected]>

Examples

e_acf(AirPassengers)

Decompose plot

Description

Decompose plot

Usage

e_decompose(serie, f = NULL, noms = NULL)

Arguments

serie

a ts object.

f

vector of dates for the time series.

noms

vector of names for y axis.

Value

echarts4r plot

Author(s)

Diego Jimenez <[email protected]>

Examples

e_decompose(AirPassengers)

Normal plot

Description

Normal plot

Usage

e_histnormal(
  data,
  colorbar = "steelblue",
  colorline = "gray",
  nombres = c("Histograma", "Curva Normal")
)

Arguments

data

a numeric column of a data.frame.

colorbar

a color for the bars.

colorline

a color for the line.

nombres

a character vector of length 2 specifying the titles to use on legend.

Value

echarts4r plot

Author(s)

Diego Jimenez <[email protected]>

Examples

e_histnormal(iris$Sepal.Length)

Best parameters arima model

Description

Best parameters arima model

Usage

e_pacf(x)

Arguments

x

a ts object.

Value

echarts4r plot

Author(s)

Diego Jimenez <[email protected]>

Examples

e_pacf(AirPassengers)

Periodogram Plot

Description

Periodogram Plot

Usage

e_periods(x, p = NULL, noms = NULL)

Arguments

x

a ts object.

p

which important period to plot.

noms

vector of lenght 3 to indicate the text to use.

Value

echarts4r plot

Author(s)

Diego Jimenez <[email protected]>

Examples

e_periods(AirPassengers)

Qplot + Qline

Description

Qplot + Qline

Usage

e_qq(data, colorpoint = "steelblue", colorline = "gray")

Arguments

data

a numeric column of a data.frame.

colorpoint

a color for the points.

colorline

a color for the line.

Value

echarts4r plot

Author(s)

Diego Jimenez <[email protected]>

Examples

e_qq(iris$Sepal.Length)

Tendencia y Estacionalidad

Description

Tendencia y Estacionalidad

Usage

e_tc(x, d = NULL, noms = c("Time Series", "Trend", "Cyclicality"))

Arguments

x

a ts object.

d

a vector of dates to use on axis x (Optional).

noms

a vector of 3 to indicate the names to use on legend.

Value

data.frame

Author(s)

Diego Jimenez <[email protected]>

Examples

e_tc(AirPassengers)

Time Series Forecast System

Description

A web application for displaying, analysing and forecasting univariate time series. Includes basic methods such as mean, naïve, seasonal naïve and drift, as well as more complex methods such as Holt-Winters Box,G and Jenkins, G (1976) <doi:10.1111/jtsa.12194> and ARIMA Brockwell, P.J. and R.A.Davis (1991) <doi:10.1007/978-1-4419-0320-4>.

Details

Package: forecasteR
Type: Package
Version: 2.0.2
Date: 2023-06-19
License: GPL (>=2)

Author(s)

Maintainer: Oldemar Rodriguez Rojas <[email protected]>


Get ts start of a time series

Description

Get ts start of a time series

Usage

get_start(ini, tipo_f, patron)

Arguments

ini

a Date object.

tipo_f

type of the time series ('year', 'month', ..., 'seconds').

patron

frequency of time series.

Value

numeric vector of lenght 2

Author(s)

Diego Jimenez <[email protected]>

Examples

get_start(as.Date("2021-06-30"), 'days', 365)

Error plot for all predictions

Description

Error plot for all predictions

Usage

grafico.errores(errores)

Arguments

errores

a data.frame with errors of a time series.

Value

data.frame

Author(s)

Diego Jimenez <[email protected]>

Examples

model <- arima(window(AirPassengers, end = c(1959, 12)))
pred  <- predict(model, 12)
e <- tabla.errores(list(pred$pred), window(AirPassengers, start = 1960))
grafico.errores(e)

Mean Square Error

Description

Mean Square Error

Usage

MSE(Pred, Real)

Arguments

Pred

a ts object (prediction).

Real

a ts object (real).

Value

numeric

Author(s)

Diego Jimenez <[email protected]>

Examples

model <- arima(window(AirPassengers, end = c(1959, 12)))
pred  <- predict(model, 12)
MSE(pred$pred, window(AirPassengers, start = 1960))

Time series forecasts for a keras model.

Description

Time series forecasts for a keras model.

Usage

pred.tskeras(object, h = 1)

Arguments

object

An object from keras.

h

Number of periods for forecasting.

Value

Point forecasts as a time series.

Author(s)

Diego Jimenez <[email protected]>

Examples

library(keras)
  modelo.deep <- keras_model_sequential() %>% 
  layer_lstm(
    units = 10, activation = 'tanh', batch_input_shape = c(1, 12, 1),
    return_sequences = TRUE, stateful = TRUE) %>%
  layer_dense(units = 1) %>%
  compile(loss = 'mse', optimizer = 'adam', metrics = 'mse')
  modelo.deep <- tskeras(AirPassengers, modelo.deep, lag = 12, epochs = 1)
  pred.tskeras(modelo.deep, h = 12)

Relative Error

Description

Relative Error

Usage

RE(Pred, Real)

Arguments

Pred

a ts object (prediction).

Real

a ts object (real).

Value

numeric

Author(s)

Diego Jimenez <[email protected]>

Examples

model <- arima(window(AirPassengers, end = c(1959, 12)))
pred  <- predict(model, 12)
RE(pred$pred, window(AirPassengers, start = 1960))

Root Mean Square Error

Description

Root Mean Square Error

Usage

RMSE(Pred, Real)

Arguments

Pred

a ts object (prediction).

Real

a ts object (real).

Value

numeric

Author(s)

Diego Jimenez <[email protected]>

Examples

model <- arima(window(AirPassengers, end = c(1959, 12)))
pred  <- predict(model, 12)
RMSE(pred$pred, window(AirPassengers, start = 1960))

RSS

Description

RSS

Usage

RSS(Pred, Real)

Arguments

Pred

a ts object (prediction).

Real

a ts object (real).

Value

numeric

Author(s)

Diego Jimenez <[email protected]>

Examples

model <- arima(window(AirPassengers, end = c(1959, 12)))
pred  <- predict(model, 12)
RSS(pred$pred, window(AirPassengers, start = 1960))

Run the Shiny Application

Description

Run the Shiny Application

Usage

run_app(...)

Arguments

...

A series of options to be used inside the app.


Apply rolling to a numeric vector.

Description

Apply rolling to a numeric vector.

Usage

smoothing(v, n)

Arguments

v

a numeric vector.

n

integer value specifying the window width.

Value

numeric vector

Author(s)

Diego Jimenez <[email protected]>

Examples

smoothing(AirPassengers, 5)

Error table for all predictions

Description

Error table for all predictions

Usage

tabla.errores(Preds, Real, nombres = NULL)

Arguments

Preds

a list of ts objects (prediction).

Real

a ts object (real).

nombres

names for the data.frame (optional).

Value

data.frame

Author(s)

Diego Jimenez <[email protected]>

Examples

model <- arima(window(AirPassengers, end = c(1959, 12)))
pred  <- predict(model, 12)
tabla.errores(list(pred$pred), window(AirPassengers, start = 1960))

Convert character to dates

Description

Convert character to dates

Usage

text_toDate(f)

Arguments

f

a vector of character.

Value

list

Author(s)

Diego Jimenez <[email protected]>

Examples

text_toDate(c("2023 january 27", "2023 january 28"))

keras model for time series.

Description

keras model for time series.

Usage

tskeras(x, model, lag = 1, batch_size = 1, epochs = 20, verbose = 0)

Arguments

x

a ts object.

model

a keras model.

lag

indicates by value to test alpha, beta and gamma.

batch_size

indicates by value to test alpha, beta and gamma.

epochs

indicates by value to test alpha, beta and gamma.

verbose

indicates by value to test alpha, beta and gamma.

Value

keras model

Author(s)

Diego Jimenez <[email protected]>

Examples

library(keras)
  modelo.deep <- keras_model_sequential() %>% 
  layer_lstm(
    units = 10, activation = 'tanh', batch_input_shape = c(1, 12, 1),
    return_sequences = TRUE, stateful = TRUE) %>%
  layer_dense(units = 1) %>%
  compile(loss = 'mse', optimizer = 'adam', metrics = 'mse')
  tskeras(AirPassengers, modelo.deep, lag = 12, epochs = 1)

Filter category variables of a data.frame

Description

Filter category variables of a data.frame

Usage

var.categoricas(data)

Arguments

data

a data.frame object.

Value

data.frame

Author(s)

Diego Jimenez <[email protected]>

Examples

var.categoricas(iris)

Filter numeric variables of a data.frame

Description

Filter numeric variables of a data.frame

Usage

var.numericas(data)

Arguments

data

a data.frame object.

Value

data.frame

Author(s)

Diego Jimenez <[email protected]>

Examples

var.numericas(iris)