Allows to forecast time series using nearest neighbors regression
Francisco Martinez, Maria P. Frias, Maria D. Perez-Godoy and Antonio J.
Rivera (2017)

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

You can install tsfknn from from github with:

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

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

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

- summary and print.summary methods are added for "knnForecast" objects
- String parameters are processed with math.arg
- Fix calculation of how many KNN examples has the model in knn_forecasting
- Weighted combination of the targets of nearest neighbors is implemented
- A function that computes the number of training instances that would have a model has been added