1#ifndef STAN_MATH_PRIM_FUN_AUTOCOVARIANCE_HPP
2#define STAN_MATH_PRIM_FUN_AUTOCOVARIANCE_HPP
38 for (
size_t i = 0; i < y.size(); i++) {
65template <
typename T,
typename DerivedA,
typename DerivedB>
67 Eigen::MatrixBase<DerivedB>& acov, Eigen::FFT<T>&
fft) {
69 acov = acov.array() * (y.array() - y.mean()).
square().sum() / y.size();
94 const Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, 1> > y_map(&y[0], N);
95 Eigen::Map<Eigen::Matrix<T, Eigen::Dynamic, 1> > acov_map(&acov[0], N);
117template <
typename T,
typename DerivedA,
typename DerivedB>
119 Eigen::MatrixBase<DerivedB>& acov) {
double variance(const T &a)
Return the sample variance of the var_value matrix Raise domain error if size is not greater than zer...
Eigen::Matrix< scalar_type_t< V >, -1, 1 > fft(const V &x)
Return the discrete Fourier transform of the specified complex vector.
void autocovariance(const std::vector< T > &y, std::vector< T > &acov, Eigen::FFT< T > &fft)
Write autocovariance estimates for every lag for the specified input sequence into the specified resu...
fvar< T > square(const fvar< T > &x)
void autocorrelation(const std::vector< T > &y, std::vector< T > &ac, Eigen::FFT< T > &fft)
Write autocorrelation estimates for every lag for the specified input sequence into the specified res...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...