R-CMD-check

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = FALSE,
  fig.path = "README-"
)

tsfknn

The goal of tsfknn is to forecast time series using KNN regression.

Installation

You can install tsfknn from github with:

# install.packages("devtools")
devtools::install_github("franciscomartinezdelrio/tsfknn")

Example

This is a basic example which shows how to forecast with tsfknn:

library(tsfknn)
pred <- knn_forecasting(USAccDeaths, h = 12, k = 3)
pred$prediction # To see a time series with the forecasts
plot(pred) # To see a plot with the forecast
library(ggplot2)
autoplot(pred, highlight = "neighbors")  # To see the nearest neighbors


franciscomartinezdelrio/tsfknn documentation built on Jan. 31, 2024, 8 a.m.