Skip to contents

NeuralProphet keeps the Prophet decomposition but fits it, and adds an autoregression block. With the linear AR-Net the model collapses to a single design matrix: piecewise-linear trend, Fourier seasonality and p lags estimated in one least squares.

Usage

Nprphet(ds, y, ar_layers = 0, n_changepoints = 3, seasonality = c(365.25, 3))

Arguments

ds

Numeric increasing time index.

y

Observed series.

ar_layers

Number of autoregressive lags p.

n_changepoints

Interior trend changepoints at equally spaced quantiles of ds.

seasonality

Length-2 vector: period and number of Fourier terms.

Value

List with estimate, coef, fitted, resid, rmse, n.

Details

Formula: y(t) = T(t) + S(t) + A(t), T(t) = (d0 + G(t)'d) t + (r0 + G(t)'r), S_p(t) = sum_j a_j cos(2 pi j t / p) + b_j sin(2 pi j t / p), linear AR A(t) = sum_i w_i y(t - i).

References

Triebe, O. et al. (2021). NeuralProphet: explainable forecasting at scale. arXiv:2111.15397.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Nprphet(V, V)
#> $estimate
#> [1] 8
#> 
#> $coef
#>  [1]  2.901310e-04  9.998738e-01 -1.476755e-09 -2.954807e-09 -1.476789e-09
#>  [6] -6.084948e-04  1.099033e-02  4.498871e-04 -2.158178e-03 -1.315241e-04
#> [11]  2.204414e-04
#> 
#> $fitted
#> [1] 1 2 3 4 5 6 7 8
#> 
#> $resid
#> [1] -8.881784e-16 -3.108624e-15 -3.108624e-15 -2.664535e-15 -2.664535e-15
#> [6] -2.664535e-15 -2.664535e-15 -5.329071e-15
#> 
#> $rmse
#> [1] 3.100684e-15
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "NeuralProphet decomposition with linear AR-Net"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"