Constructs a transparent additive example consisting of a nonstationary linear covariance component, a periodic covariance component, and a local Matérn-3/2 component. The components are explicit so stationarity is never implied for the full model.
Usage
time_series_kernel(
period,
trend_variance = 1,
periodic_variance = 1,
periodic_length_scale = 1,
local_variance = 1,
local_length_scale = 1,
changepoint = NULL,
changepoint_steepness = 1
)Arguments
- period
Positive period in the same units as the time index.
- trend_variance
Positive variance of the linear trend component.
- periodic_variance
Positive variance of the periodic component.
- periodic_length_scale
Positive periodic length scale.
- local_variance
Positive variance of the local Matérn component.
- local_length_scale
Positive local Matérn length scale.
- changepoint
Optional location of a structural break, on the time index scale of
gp_time_index(): elapsed time since the first training time, in its unit.- changepoint_steepness
Positive steepness of the break.
Details
With a changepoint, the kernel is a changepoint_kernel() between two
independent copies of the trend-periodic-local kernel, so every component
can change at the break; the copies start from the same parameter values
and are estimated separately. To place a break at a date, convert it with
the training times: gp_time_index(c(time[1], date), unit)[2].
Stability
Stable: from version 1.0.0 this interface changes incompatibly only in a
major release, after a deprecation period. Results and options that
concern an experimental model class, kernel, or argument follow that
interface's tier. See gaussianprocesses-package for the
policy. The changepoint argument, which builds a changepoint_kernel(), is experimental.
Examples
kernel <- time_series_kernel(period = 12)
kernel
#> SumKernel(
#> Linear(variance=1)
#> Periodic(variance=1, length_scale=1, period=12)
#> Matern-3/2(variance=1, length_scale=1)
#> )
# A structural break 30 time units after the first observation.
names(kernel_parameters(
time_series_kernel(period = 12, changepoint = 30),
flatten = TRUE
))
#> [1] "location" "steepness"
#> [3] "before.kernel1.variance" "before.kernel2.variance"
#> [5] "before.kernel2.length_scale" "before.kernel2.period"
#> [7] "before.kernel3.variance" "before.kernel3.length_scale"
#> [9] "after.kernel1.variance" "after.kernel2.variance"
#> [11] "after.kernel2.length_scale" "after.kernel2.period"
#> [13] "after.kernel3.variance" "after.kernel3.length_scale"