mosaicperm.panel.QuadraticMosaicPanelTest¶
- class mosaicperm.panel.QuadraticMosaicPanelTest(*args, method: str = 'cov', weights: array | None = None, **kwargs)[source]¶
Mosaic permutation test for panel data using quadratic test statistics.
This class extends MosaicPanelTest to perform tests based on quadratic forms of residual covariances or correlations across tiles. It uses dynamic programming to compute the permutation distribution extremely efficiently.
- Parameters:
- *args
Positional arguments passed to the parent MosaicPanelTest class. See
MosaicPanelTestfor details on required arguments (outcomes, test_stat, subjects, times, etc.).- methodstr, default ‘cov’
The method for computing the quadratic test statistic. Options:
‘cov’: Uses covariances between tile-aggregated residuals.
‘abscov’: Uses absolute values of covariances between tile-aggregated residuals.
‘corr’: Uses correlations between tile-aggregated residuals.
‘abscorr’: Uses absolute values of correlations between tile-aggregated residuals.
- weightsnp.array or pd.Series, optional
n_subjects-length array mapping each subject to its weight in the aggregation. Weights may be negative. If provided as a pd.Series, the index should correspond to subject identifiers. If not provided, defaults to equal weights of 1 for all subjects.- **kwargs
Additional keyword arguments passed to the parent MosaicPanelTest class.
Methods
Computes mosaic-style residual estimates.
fit([nrand, verbose])Runs the mosaic permutation test.
fit_tseries([nrand, verbose, n_timepoints, ...])Runs mosaic permutation tests for various windows of the data, producing a time series of p-values.
permute_residuals([_permute_all])Permutes residuals within tiles.
plot_tseries([time_index, alpha, show_plot])Plots the results of
fit_tseries().summary([coordinate_index])Produces an output summarizing the test.
summary_plot([show_plot])Produces a plot summarizing the results of the test.