inference
The Debiased Whittle Likelihood estimator is based on the periodogram of the data and the expected periodogram corresponding to the combination of a sampling grid and covariance model.
periodogram
This module provides tools to define a periodogram and to obtain its expectation, the expected periodogram.
The periodogram is defined according to, $$ I(\mathbf{k}) = \frac{1}{|n|} \left| \sum_{\mathbf{s}} { g_{\mathbf{s}} X_{\mathbf{s}} \exp(-i\mathbf{k}\cdot\mathbf{s}) } \right|^2 $$ where the summation is over grid points, and where \(g_{\mathbf{s}}\) is obtained from both the grid mask and the periodogram taper function. In practice, this is implemented using the Fast Fourier Transform.
Periodogram(taper=None)
Provides the capability to compute the periodogram of the data.
Attributes:
| Name | Type | Description |
|---|---|---|
taper |
function handle
|
tapering function |
fold |
boolean
|
Whether to fold the periodogram. |
fold
property
writable
Whether to compute a folded version of the periodogram.
__call__(sample: Union[xp.ndarray, SampleOnRectangularGrid])
Computes the periodogram of the data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample
|
Union[ndarray, SampleOnRectangularGrid]
|
Sampled data on the grid. Can either be an ndarray, or an instance of SampleOnRectangularGrid. In the latter case, repeated calls to this method will access cached values of the periodogram rather than carrying out the same computation again. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
periodogram |
ndarray
|
Periodogram of the data - shape (2 * n1 + 1, ..., 2 * nk + 1) if the fold attribute is False - shape (n1, ..., nk) if the fold attribute is True |
__setattr__(key, value)
Sets attribute and update version of the object, which will update its hash, so that stored periodogram values are not used if properties of the periodogram are changed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
name of the attribute |
required | |
value
|
value of the attribute |
required |
ExpectedPeriodogram(grid: RectangularGrid, periodogram: Periodogram)
Provides the capability to compute the expected periodogram on a fixed grid for any covariance model.
Attributes:
| Name | Type | Description |
|---|---|---|
grid |
RectangularGrid
|
sampling grid |
periodogram |
Periodogram
|
periodogram for which we require the expectation. This is necessary to account for tapering for instance. |
Notes
In dimension 1, the formula for the expected periodogram can be written as,
or equivalently,
The latter can naturally be implemented via FFT and generalizes to higher-dimension domains.
grid: RectangularGrid
property
writable
Sampling grid
periodogram
property
writable
periodogram for which we require the expectation.
__call__(model: CovarianceModel) -> xp.ndarray
Compute the expected periodogram for this covariance model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
Covariance model under which we compute the expectation of the periodogram |
required |
Returns:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
ep |
ndarray
|
The shape depends n univariate versus multivariate (\(p\)) and on unique versus vectorized model (\(m\)), as per the table below.
If the fold attribute of the periodogram is False, the shape of the returned array is instead (2 * n1 + 1, ..., 2 * nd + 1). |
compute_ep(acv: xp.ndarray, fold: bool = True, d: Tuple[int, int] = (0, 0), apply_cg: bool = True)
Computes the expected periodogram, and more generally any diagonal of the covariance matrix of the Discrete Fourier Transform identitied by the two-dimensional offset d. The standard expected periodogram corresponds to the default d = (0, 0).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
acv
|
ndarray
|
Autocovariance evaluated on the grid's lags. For a grid with shape (n1, ..., nd), the first d dimensions of acv should have sizes (2 * n1 - 1, ..., 2 * nd - 1). The standard way to obtain acv is through the call of the autocov method of a rectangular grid. acv may have extra dimensions. The following other cases are standard (see the documentation of the call and gradient methods of models.ModelInterface):
The case of gradient computation combined with vectorized models (not shown above) might work, but has not been tested as of now. |
required |
fold
|
bool
|
Whether to apply folding of the expected periodogram |
True
|
d
|
Tuple[int, int]
|
Offset that identifies a hyper-diagonal of the covariance matrix of the DFT. |
(0, 0)
|
Returns:
| Name | Type | Description |
|---|---|---|
ep |
ndarray
|
Expectation of the periodogram. Same shape as acv when fold is True. |
Notes
For standard use cases, this should not be called directly. Instead, one should directly call the call method.
gradient(model: CovarianceModel, params: list[ModelParameter]) -> ndarray
Provides the gradient of the expected periodogram with respect to the parameters of the model at all frequencies of the Fourier grid. The last dimension of the returned array indexes the parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
Covariance model. It should implement the gradient method. |
required |
params
|
list[ModelParameter]
|
Parameters with which to take the gradient. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
gradient |
ndarray
|
Array providing the gradient of the expected periodogram at all Fourier frequencies with respect to the requested parameters. The last dimension of the returned array indexes the parameters. |
Notes
This requires that the model's _gradient method be implemented.
cov_dft_matrix(model: CovarianceModel)
Provides the complex-valued covariance matrix of the Discrete Fourier Transform. Implemented via FFT, but still requires the full covariance matrix of the data, hence this is not viable for large grids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
Covariance model for which we request the covariance matrix of the Discrete Fourier Transform |
required |
Returns:
| Name | Type | Description |
|---|---|---|
cov_dft |
ndarray(n1, n2, ..., nd)
|
Covariance matrix of the Discrete Fourier Transform of the data. |
Notes
The result of this method corresponds to,
where \(\mathbf{J}\) is the Discrete Fourier Transform (DFT) of the data \(\mathbf{X}\), whose covariance matrix is denoted by \(C_X\), and \(U\) is the DFT matrix.
rel_dft_matrix(model: CovarianceModel)
Provides the relation matrix of the Discrete Fourier Transform. Requires storing the full covariance matrix, hence not viable for large grids. Useful however to check other methods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
Covariance model for which we request the covariance matrix of the Discrete Fourier Transform |
required |
Returns:
| Name | Type | Description |
|---|---|---|
rel_dft |
ndarray(n1, n2, ..., nk)
|
Relation matrix of the Discrete Fourier Transform of the data |
cov_dft_diagonals(model: CovarianceModel, m: Tuple[int, int])
Returns the covariance of the DFT over a given diagonal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
Covariance model. The covariance matrix of the DFT will depend on both the model and the sampling. |
required |
m
|
Tuple[int, int]
|
Offset in Fourier frequency indices. More precisely, m = (m1, m2) is the offset between two frequencies. In dimension 1 this would correspond to i2 - i1 = m1 in terms of the indices of Fourier frequencies. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
cov_dft |
ndarray
|
The covariance of the DFT between Fourier frequencies separated by the offset. |
Notes
When m is zero everywhere, this is just the expected periodogram.
cov_diagonals(model: CovarianceModel, m: Tuple[int, int])
Returns the covariance of the periodogram (valid only in 2d).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
True covariance model |
required |
m
|
Tuple[int, int]
|
frequency offset |
required |
Returns:
| Name | Type | Description |
|---|---|---|
cov |
ndarray
|
Covariance of the periodogram between frequencies offset by m |
cov_dft_antidiagonals(model: CovarianceModel, m: Tuple[int, int])
Returns the covariance of the DFT over a given diagonal. More precisely, m = (m1, m2) is the offset between two frequencies. In dimension 1 this would correspond to i2 + i1 = m1 in terms of the indices of Fourier frequencies
cov_antidiagonals(model: CovarianceModel, m: Tuple[int, int])
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
|
required |
m
|
Tuple[int, int]
|
|
required |
SeparableExpectedPeriodogram(grid: RectangularGrid, periodogram: Periodogram)
Bases: ExpectedPeriodogram
Class to obtain the expected periodogram on a rectangular grid for a separable covariance model, in which case separability offers computational gains since the full expected periodogram can be computed as the outer product of the expected periodograms in the lower dimensions.
gradient(model)
Provides the derivatives of the expected periodogram with respect to the parameters of the model at all frequencies of the Fourier grid. The last dimension is used for different parameters.
compute_ep(acv: xp.ndarray, fold: bool = True, d: Tuple[int, int] = (0, 0)) -> xp.ndarray
Computes the expected periodogram for the passed finite autocovariance function, in the case where...
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
acv
|
ndarray
|
|
required |
fold
|
bool
|
|
True
|
d
|
Tuple[int, int]
|
|
(0, 0)
|
autocov(cov_func, shape)
Compute the covariance function on a grid of lags determined by the passed shape. In d=1 the lags would be -(n-1)...n-1, but then a iffshit is applied so that the lags are 0 ... n-1 -n+1 ... -1. This may look weird but it makes it easier to do the folding operation when computing the expecting periodogram
compute_ep(acf: ndarray, spatial_kernel: ndarray, grid: ndarray = None, fold: bool = True) -> ndarray
Computes the expected periodogram, for the passed covariance function and grid. The grid is an array, in the simplest case just an array of ones :param cov_func: covariance function :param grid: array :param fold: True if we compute the expected periodogram on the natural Fourier grid, False if we compute it on a frequency grid with twice higher resolution :return:
compute_ep_old(cov_func, grid, fold=True)
Computes the expected periodogram, for the passed covariance function and grid. The grid is an array, in the simplest case just an array of ones :param cov_func: covariance function :param grid: array :param fold: True if we compute the expected periodogram on the natural Fourier grid, False if we compute it on a frequency grid with twice higher resolution :return:
multivariate_periodogram
This module provides a class for the definition of a multi-variate periodogram.
Periodogram()
This class defines a periodogram for a multivariate random field.
__call__(z: List[xp.ndarray], return_fft: bool = False) -> xp.ndarray
Compute the multivariate periodogram. The data z is expected to be a list of p arrays with the same shape, where p is the number of variates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
List[ndarray]
|
Data, list of arrays corresponding to the distinct variates |
required |
return_fft
|
bool
|
If true, returns the Discrete Fourier Transform rather than the periodogram |
False
|
Returns:
| Type | Description |
|---|---|
periodogram
|
Shape (n1, n2, ..., nd, p, p) if the data is p-variate and over d spatial dimensions. |
likelihood
This module provides tools to define the Debiased Whittle Likelihood and the associated estimator. More specifically, the Debiased Whittle Likelihood is defined by, $$ l(\boldsymbol{\theta}) = \sum_{\mathbf{k}\in\Omega} \left[ \log\overline{I}(\mathbf{k}; \boldsymbol{\theta}) + \frac { I(\mathbf{k}) } { \overline{I}(\mathbf{k}; \boldsymbol{\theta}) } \right] $$ where \(I(\mathbf{k})\) is the periodogram at space-time frequency \(\mathbf{k}\), \(\overline{I}(\mathbf{k}; \boldsymbol{\theta})\) is the expected periodogram and \(\Omega\) is the set of Fourier frequency (one can choose to select a subset of frequencies though).
The Debiased Whittle Likelihood Estimator then uses numerical optimization to approximately solve,
$$ \widehat{\boldsymbol{\theta}} = \argmin_{\boldsymbol{\theta}\in\Theta} l(\boldsymbol{\theta}), $$ where \(\Theta\) is the parameter space, defined within the specified model.
MultivariateDebiasedWhittle(periodogram: MultPeriodogram, expected_periodogram: ExpectedPeriodogram)
Implements the Debiased Whittle Likelihood for multivariate data. This requires the use of a multivariate periodogram. Currently, only implemented for bi-variate.
Attributes:
| Name | Type | Description |
|---|---|---|
periodogram |
Periodogram
|
Multivariate periodogram applied to the multivariate random field |
expected_periodogram |
ExpectedPeriodogram
|
Object used to compute the expectation of the periodogram |
__call__(z: xp.ndarray, model: CovarianceModel, params_for_gradient: list[ModelParameter] = None)
Computes the likelihood for these data
fisher(model: CovarianceModel, params_for_gradient: list[ModelParameter])
Provides the expectation of the hessian matrix
jmatrix_sample(model: CovarianceModel, params_for_gradient: list[ModelParameter], n_sims: int = 400, block_size: int = 100) -> xp.ndarray
Computes the sample covariance matrix of the gradient of the debiased Whittle likelihood from simulated realisations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
Covariance model to sample from |
required |
params_for_gradient
|
list[ModelParameter]
|
Parameters with respect to which we take the gradient |
required |
n_sims
|
int
|
Number of samples used for the estimate covariance matrix |
400
|
block_size
|
int
|
Number of samples per simulations. A higher number should improve computational efficiency, but for large grids this may cause Out Of Memory issues. |
100
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Sample covariance matrix of the gradient of the likelihood |
DebiasedWhittle(periodogram: Periodogram, expected_periodogram: ExpectedPeriodogram)
Implements the Debiased Whittle likelihood for univariate data.
Attributes:
| Name | Type | Description |
|---|---|---|
periodogram |
Periodogram
|
Periodogram applied to the data |
expected_periodogram |
ExpectedPeriodogram
|
Object used to compute the expectation of the periodogram |
frequency_mask |
ndarray
|
mask of zero and ones to select frequencies over which the summation is carried out in the computation of the Whittle. |
Examples:
>>> import numpy as np
>>> np.random.seed(1712)
>>> from debiased_spatial_whittle.grids.base import RectangularGrid
>>> from debiased_spatial_whittle.models.univariate import SquaredExponentialModel
>>> from debiased_spatial_whittle.sampling.simulation import SamplerOnRectangularGrid
>>> from debiased_spatial_whittle.inference.periodogram import Periodogram, ExpectedPeriodogram
>>> grid = RectangularGrid(shape=(256, 256))
>>> model1 = SquaredExponentialModel()
>>> model1.rho = 12
>>> model1.sigma = 1
>>> model2 = SquaredExponentialModel()
>>> model2.rho = 4
>>> model2.sigma = 1
>>> sampler = SamplerOnRectangularGrid(model1, grid)
>>> per = Periodogram()
>>> ep = ExpectedPeriodogram(grid, per)
>>> dbw = DebiasedWhittle(per, ep)
>>> sample = sampler()
>>> dbw(sample, model1), dbw(sample, model2)
(-8.37515633567113, -7.315812857735173)
whittle(periodogram: xp.ndarray, expected_periodogram: xp.ndarray)
Compute the Whittle distance between periodogram values and expectation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
periodogram
|
ndarray
|
periodogram of the data on Fourier grid |
required |
expected_periodogram
|
ndarray
|
expected periodogram or spectral density values on same Fourier grid |
required |
Returns:
| Name | Type | Description |
|---|---|---|
whittle_value |
float
|
whittle distance between periodogram and expected periodogram |
Notes
In standard use cases, this method should not be called directly. Instead, one should use the call method.
__call__(sample: xp.ndarray, model: CovarianceModel, params_for_gradient: list[ModelParameter] = None) -> xp.float64
Computes the Debiased Whittle likelihood for these data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample
|
ndarray
|
sample data |
required |
model
|
CovarianceModel
|
covariance model used to compute the likelihood of the data |
required |
params_for_gradient
|
list[ModelParameter]
|
parameters with respect to which we require the derivative of the likelihood. Default, None |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
likelihood |
float
|
likelihood value |
gradient |
ndarray
|
gradient with respect to the parameters provided in params_for_gradient. If the latter is None, this second output is not returned. |
expected(true_model: CovarianceModel, eval_model: CovarianceModel)
Evaluate the expectation of the Debiased Whittle likelihood estimator for a given parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
true_model
|
CovarianceModel
|
Covariance model of the process |
required |
eval_model
|
CovarianceModel
|
Covariance model for which we evaluate the likelihood |
required |
Returns:
| Name | Type | Description |
|---|---|---|
expected |
float
|
Expectation of the Debiased Whittle likelihood under true_model, evaluated at eval_model |
fisher(model: CovarianceModel, params_for_gradient: list[ModelParameter])
Provides the Fisher Information Matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
True covariance model |
required |
params_for_gradient
|
list[ModelParameter]
|
Parameters with respect to which the Fisher is obtained |
required |
Returns:
| Name | Type | Description |
|---|---|---|
fisher |
ndarray
|
Fisher covariance matrix |
Examples:
>>> from debiased_spatial_whittle.grids.base import RectangularGrid
>>> from debiased_spatial_whittle.models.univariate import ExponentialModel
>>> model = ExponentialModel(rho=30, sigma=1.41)
>>> periodogram = Periodogram()
>>> grid = RectangularGrid((67, 192))
>>> ep = ExpectedPeriodogram(grid, periodogram)
>>> dbw = DebiasedWhittle(periodogram, ep)
>>> dbw.fisher(model, [model.param.rho, model.param.sigma])
array([[ 1.03736229e-03, -4.49238561e-02],
[-4.49238561e-02, 2.01197123e+00]])
jmatrix(model: CovarianceModel, params_for_gradient: list[ModelParameter], mcmc_mode: bool = False)
Provides the variance matrix of the score (gradient of likelihood) under the specified model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
Covariance model |
required |
params_for_gradient
|
list[ModelParameter]
|
Parameters with respect to which we take the derivative |
required |
mcmc_mode
|
bool
|
Whether we use mcmc approximation |
False
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The predicted covariance matrix of the score, with parameters ordered according to params_for_gradient |
jmatrix_sample(model: CovarianceModel, params_for_gradient: list[ModelParameter], n_sims: int = 1000, block_size: int = 100) -> xp.ndarray
Computes the sample covariance matrix of the gradient of the debiased Whittle likelihood from simulated realisations. Specifically, this simulates n_sims samples from model, computes the gradient for each sample using the call method, and computes the sample covariance of those gradients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
Covariance model to sample from |
required |
params_for_gradient
|
list[ModelParameter]
|
Parameters with respect to which we take the gradient |
required |
n_sims
|
int
|
Number of samples used for the estimate covariance matrix |
1000
|
block_size
|
int
|
Number of samples per simulations. A higher number should improve computational efficiency, but for large grids this may cause Out Of Memory issues. |
100
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Sample covariance matrix of the gradient of the likelihood |
Examples:
>>> import numpy.random as nrrandom
>>> nrrandom.seed(1712)
>>> from debiased_spatial_whittle.grids.base import RectangularGrid
>>> from debiased_spatial_whittle.models.univariate import ExponentialModel
>>> model = ExponentialModel(rho=12, sigma=1.41)
>>> periodogram = Periodogram()
>>> grid = RectangularGrid((67, 192))
>>> ep = ExpectedPeriodogram(grid, periodogram)
>>> dbw = DebiasedWhittle(periodogram, ep)
>>> dbw.jmatrix_sample(model, [model.param.rho, model.param.sigma], n_sims=20)
array([[ 1.79844275e-06, -3.36165062e-05],
[-3.36165062e-05, 8.20809861e-04]])
variance_of_estimates(model: CovarianceModel, params: list[ModelParameter], jmat: xp.ndarray = None)
Compute the covariance matrix of the estimated parameters specified by params under the specified covariance model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
Covariance model |
required |
params
|
list[ModelParameter]
|
Estimated parameters. The method returns the covariance matrix of estimates of those parameters |
required |
jmat
|
ndarray
|
The variance of the score, if it has already been pre-computed. If not provided, it is computed exactly which can be computationally expensive. |
None
|
Returns:
| Type | Description |
|---|---|
cov_mat
|
Covariance matrix of the parameter estimates. |
Examples:
>>> import numpy.random as nrrandom
>>> nrrandom.seed(1712)
>>> from debiased_spatial_whittle.grids.base import RectangularGrid
>>> from debiased_spatial_whittle.models.univariate import ExponentialModel
>>> model = ExponentialModel(rho=12., sigma=4.)
>>> periodogram = Periodogram()
>>> grid = RectangularGrid((67, 192))
>>> ep = ExpectedPeriodogram(grid, periodogram)
>>> dbw = DebiasedWhittle(periodogram, ep)
>>> jmat = dbw.jmatrix_sample(model, [model.param.rho, model.param.sigma], n_sims=20)
>>> dbw.variance_of_estimates(model, [model.param.rho, model.param.sigma], jmat)
array([[8.27761908, 1.34780351],
[1.34780351, 0.22064392]])
Estimator(likelihood: DebiasedWhittle, use_gradients: bool = False, max_iter: int = 100, optim_options: dict = dict(), method: str = 'L-BFGS-B')
Class to define an estimator that uses a likelihood.
Attributes:
| Name | Type | Description |
|---|---|---|
likelihood |
DebiasedWhittle
|
Debiased Whittle likelihood used for fitting. |
use_gradients |
bool
|
Whether to use gradients in the optimization procedure. Not working at the moment. |
max_iter |
int
|
Maximum number of iterations of the optimization procedure |
optim_options |
dict
|
Additional options passed to the optimizer. |
method |
string
|
Optimization procedure. Should be one of the methods available in scipy's local or global optimizers. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
likelihood
|
DebiasedWhittle
|
Debiased Whittle likelihood used for fitting. |
required |
use_gradients
|
bool
|
Whether to use gradients in the optimization procedure |
False
|
max_iter
|
int
|
Maximum number of iterations of the optimization procedure |
100
|
optim_options
|
dict
|
Additional options passed to the optimizer. |
dict()
|
method
|
str
|
Optimization procedure |
'L-BFGS-B'
|
__call__(model: CovarianceModel, sample: Union[xp.ndarray, SampleOnRectangularGrid], opt_callback: Callable = None)
Fits the passed covariance model to the passed data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
Covariance model to be fitted to the data. Only free parameters are estimated, that is parameters of the covariance model set to None. |
required |
sample
|
Union[ndarray, SampleOnRectangularGrid]
|
Sampled random field |
required |
opt_callback
|
Callable
|
Callback function called by the optimizer |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
model |
CovarianceModel
|
The fitted covariance model |
Notes
This directly updates the parameters of the passed covariance model.
covmat(model: CovarianceModel, params: list[ModelParameter] = None)
Compute an approximate covariance matrix of the parameter estimates under the specified covariance model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
True covariance model |
required |
params
|
list[ModelParameter]
|
estimated parameters |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
covmat |
ndarray
|
Covariance matrix. |
least_squares
This module provides a method for a least-squares fit of the expected periodogram to the periodogram. This can be used for instance to obtain an initial guess before using Debiased Whittle estimation.
This module provides a method for a least-squares fit of the expected periodogram to the periodogram. This can be used for instance to obtain an initial guess before using Debiased Whittle estimation.
This module provides a method for a least-squares fit of the expected periodogram to the periodogram. This can be used for instance to obtain an initial guess before using Debiased Whittle estimation.
LeastSquareEstimator(periodogram: Periodogram, expected_periodogram: ExpectedPeriodogram, verbose: int = 0)
Implements Least-Square estimation using scipy.optimize's non-linear least-square optimization algorithm. Can be used for instanced to obtain initial guesses for the optimization of the Debiased Spatial Whittle.
Attributes:
| Name | Type | Description |
|---|---|---|
periodogram |
Periodogram applied to the data |
|
expected_periodogram |
Expected periodogram used for the fit |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
periodogram
|
Periodogram
|
Periodogram object that will be applied to the data |
required |
expected_periodogram
|
ExpectedPeriodogram
|
Expected periodogram object |
required |
verbose
|
int
|
Verbosity level passed on to the least_squares function of scipy.optimize |
0
|
__call__(data: xp.array, model: CovarianceModel) -> CovarianceModel
Carries out the Least-Square estimation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
array
|
Sampled random field |
required |
model
|
CovarianceModel
|
Covariance model |
required |
Returns:
| Type | Description |
|---|---|
model
|
Fitted covariance model |
diagnostics
This module provides some diagnostic tools to assess how a covariance model fits a sampled random field.
GoodnessOfFit(model: CovarianceModel, grid: RectangularGrid, sample, n_bins: int = 10)
Class to perform a goodness of fit analysis between a model and a sampled random field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CovarianceModel
|
Covariance model for the data |
required |
grid
|
RectangularGrid
|
Sampling grid |
required |
sample
|
sampled random field data |
required | |
n_bins
|
int
|
Number of bins used in the goodness-of-fit analysis |
10
|