Given a set of spectral coefficients and a B-spline basis, this function reconstructs
the autocovariance function via inverse Fourier transform.
Usage
reconstruct_acf(c, knots, k, tau)
Arguments
- c
A numeric vector of spectral coefficients (length equals number of basis functions).
- knots
A numeric vector of knots.
- k
The degree of the B-spline basis function (must be 0, 1, or 2).
- tau
A numeric vector of frequencies at which to evaluate the inverse Fourier transform.
Value
A real-valued numeric vector of the same length as tau
, representing the reconstructed autocovariance.
Details
The function computes a weighted sum of inverse Fourier transforms of the B-spline basis functions.
The zero-lag autocovariance (at tau[1]
) is manually set to the total spectral mass sum(c)
,
ensuring numerical consistency.
Examples
knots <- c(0, 1, 2, 3, 4, 5)
c <- c(1, 0.5, 0.2)
tau <- seq(0, 10, length.out = 200)
acf <- reconstruct_acf(c, knots, k = 1, tau = tau)
plot(tau, acf, type = "l")
#> Warning: imaginary parts discarded in coercion