bayespecon.logdet.chebyshev

bayespecon.logdet.chebyshev(W, order=20, rmin=-1.0, rmax=1.0, random_state=None, eigs=None, n_mc_iter=30)[source]

Compute Chebyshev approximation of log|I - rho*W| ([Pace and LeSage, 2004]).

Uses Chebyshev polynomials of the first kind to approximate the log-determinant over [rmin, rmax]. The approximation is near-minimax: for a given polynomial degree it minimises the maximum absolute error on the interval.

Two computation strategies are supported:

  • Eigenvalue-based (default when n ≤ 2000): evaluates the exact log-determinant at Chebyshev nodes via eigenvalues, then computes Chebyshev coefficients from those values.

  • Monte-Carlo trace-based (automatically used when n > 2000): replaces exact traces with Barry-Pace stochastic trace estimates (Barry and Kelley Pace [1999]), avoiding the O(n³) eigenvalue decomposition.

Parameters:
W : array-like

Spatial weights matrix (dense or sparse).

order : int, default=20

Number of Chebyshev terms (polynomial degree). Higher values give better accuracy; 15–30 is usually sufficient.

rmin : float, default=-1.0

Lower bound of the rho interval.

rmax : float, default=1.0

Upper bound of the rho interval.

random_state : int, optional

Seed for the Monte Carlo trace estimator (only used when n > 2000).

eigs : np.ndarray, optional

Pre-computed real eigenvalues of W. When supplied, the eigenvalue decomposition step is skipped, avoiding redundant O(n³) work when the caller already has them cached.

n_mc_iter : int, default=30

Number of Hutchinson probes used by the Monte-Carlo trace estimator (only consulted when n > 2000 and eigs is None). Larger values reduce stochastic variance at linear cost.

Returns:

Dictionary with keys:

  • coeffs : Chebyshev coefficients c_0, c_1, …, c_{m-1}.

  • rmin, rmax : interval bounds (echoed back).

  • order : polynomial degree used.

  • method : 'eigenvalue' or 'mc' indicating how coefficients were computed.

Return type:

dict

Notes

The Chebyshev approximation is

\[\ln|I_n - \rho W| \approx \sum_{j=0}^{m-1} c_j \, T_j\!\left( \frac{2\rho - r_{\max} - r_{\min}} {r_{\max} - r_{\min}} \right)\]

where \(T_j\) are Chebyshev polynomials of the first kind and the coefficients \(c_j\) are computed via the discrete cosine transform of the log-determinant evaluated at Chebyshev nodes.

The error bound for the m-term approximation on \([r_{\min}, r_{\max}]\) is

\[|\text{error}| \leq \frac{n\,|\rho|^{m+1}}{(m+1)(1-|\rho|)}\]

for row-standardised \(W\) with \(|\rho| < 1\).

References

Pace, R.K. & LeSage, J.P. (2004). Chebyshev approximation of log-determinants of spatial weight matrices. Computational Statistics & Data Analysis, 45(2), 179–196. [Pace and LeSage, 2004]

Trefethen, L.N. (2013). Approximation Theory and Approximation Practice. SIAM. (Background on Chebyshev nodes, the Clenshaw recurrence used in logdet_chebyshev() for stable evaluation, and near-minimax convergence rates for analytic functions.)