towerTS {toweranNA} | R Documentation |
Tower for Times Series
Description
Fits a linear model or other regression method to to lagged elements,
using the Tower approach. Here k is the number of nearest neighbors as
in toweranNA
. Currently predicts only the component that is just
past the end of the data.
Usage
towerTS(xts,lag,k,regFtnName='lm')
Arguments
xts |
A time series. |
lag |
Lag. A positive integer. |
regFtnName |
Regression model to be used, currently 'lm', 'glm'
( |
k |
k nearest neighbors |
Details
See ?towerLM and ?regtools::TStoX
Value
Predicted value for the next item in the series.
Author(s)
Norm Matloff, Pete Mohanty
Examples
# create noisy cylcic series
set.seed(2020)
x <- rnorm(1000)
x <- runif(1000) * sin(x) + rnorm(1000)
w <- x
# introduce 10 percent missingness
x[sample(1000, 100)] <- NA
# make predictions with lag 3 using k=4 nearest neighbors
towerTS(x, lag=10, k=4)
# -0.1685019
[Package toweranNA version 0.1.0 Index]