Package 'naive'

Title: Empirical Extrapolation of Time Feature Patterns
Description: An application for the empirical extrapolation of time features selecting and summarizing the most relevant patterns in time sequences.
Authors: Giancarlo Vercellino [aut, cre, cph]
Maintainer: Giancarlo Vercellino <[email protected]>
License: GPL-3
Version: 1.2.3
Built: 2024-10-25 06:03:21 UTC
Source: https://github.com/cran/naive

Help Index


naive

Description

Empirical Extrapolation of Time Feature Pattern

Usage

naive(
  df,
  seq_len = NULL,
  ci = 0.8,
  smoother = FALSE,
  cover = NULL,
  stride = NULL,
  method = NULL,
  location = NULL,
  n_windows = 10,
  n_samp = 30,
  dates = NULL,
  error_scale = "naive",
  error_benchmark = "naive",
  seed = 42
)

Arguments

df

A data frame with time features on columns (all numerics or all categories, but not both). In case of missing values, automatic missing imputation through kalman filter will be performed.

seq_len

Positive integer. Time-step number of the forecasting sequence. Default: NULL (random selection within boundaries).

ci

Confidence interval for prediction. Default: 0.8

smoother

Logical. Flag to TRUE for loess smoothing (only for numeric series). Default: FALSE.

cover

Positive numeric. The quantile cover around the location parameter (between 0 and 1). Default: NULL (random selection within boundaries).

stride

Positive integer. Shift between subsequent sequences. Default: NULL (random selection within boundaries).

method

String. Distance method using during the comparison of time sequences. Possible options are: "euclidean", "manhattan", "minkowski". Default: NULL (random selection).

location

String. Statistic used to center the cover parameter. Possible options are: "mean", "mode" (parzen method), "median". Default: NULL (random selection).

n_windows

Positive integer. Number of validation windows to test prediction error. Default: 10.

n_samp

Positive integer. Number of sample selected during random search. Default: 30.

dates

Date. Vector with dates for time features.

error_scale

String. Scale for the scaled error metrics. Two options: "naive" (average of naive one-step absolute error for the historical series) or "deviation" (standard error of the historical series). Default: "naive".

error_benchmark

String. Benchmark for the relative error metrics. Two options: "naive" (sequential extension of last value) or "average" (mean value of true sequence). Default: "naive".

seed

Positive integer. Random seed. Default: 42.

Value

This function returns a list including:

  • exploration: collection of all the models explored with random search

  • history: a table with the explored models' hyper-parameters and validation errors

  • best_model: best combination resulting from the average prediction score across different ranks and features, including:

    • quant_preds: min, max, q25, q50, q75, quantiles at selected ci, mean, sd, mode, skewness, kurtosis, IQR to range, above to below median range, upside probability and divergence for each point fo predicted sequences

    • errors: testing errors for each time feature averaged across validation windows

    • plots: standard plot with confidence interval for each time feature

  • time_log

Author(s)

Giancarlo Vercellino [email protected]

Maintainer: Giancarlo Vercellino [email protected] [copyright holder]

See Also

Useful links:

Examples

{
naive(time_features[, 2:3, drop = FALSE], seq_len = 30, n_samp = 1, n_windows = 5)
}

time features example: IBM, AAPL, AMZN, GOOGL and MSFT Close Prices

Description

A data frame with with daily with daily prices for some Big Tech Companies since March 2017.

Usage

time_features

Format

A data frame with 6 columns and 1336 rows.

Source

finance.yahoo.com