Timescale model (experimental)#

A state-space model of the pupil size with one fast component and slow components at fixed time scales, for one recording (TimescaleModel) or a group of recordings with shrinkage (TimescaleGroup). See Slow and fast fluctuations of the pupil: the timescale model for an introduction.

TimescaleModel

Model of the slow and fast fluctuations of the pupil size of one recording (experimental).

TimescaleGroup

Group of recordings whose timescale models are estimated together (experimental).

timescale.plots.TimescalePlots

Plots of a TimescaleModel, used as m.plot (e.g., m.plot.decomposition()).

timescale.plots.TimescaleGroupPlots

Plots of a TimescaleGroup, used as g.plot.

Functions on arrays#

The models are built from functions in pp.signal that work on plain arrays.

block_mean

Means of the valid samples in consecutive blocks of factor samples.

coarsen

Coarser block means from block means (see block_mean()): means of factor consecutive blocks, weighted by their numbers of valid samples.

semivariogram

Empirical semivariogram of a signal with missing samples.

plot_variogram

Plot one or several variograms.

spectrum

Power spectral density of a signal with missing samples (Welch's method).

plot_spectrum

Plot one or several spectra.

Gauss-Markov models: pp.signal.gaussmarkov#

TimescaleBank

Structure of a timescale-bank model (see bank) and the map between its parameter vector and state-space matrices.

GaussianPrior

Gaussian prior of the parameter vector of a TimescaleBank.

BankFit

Result of fit_bank().

GroupFit

Result of fit_group().

VariogramCheck

Result of variogram_check().

GaussMarkovModel

Gauss-Markov model: a sum of components plus white measurement noise.

Matern

Matérn process with half-integer smoothness nu = p + 1/2.

OU

Ornstein-Uhlenbeck process, k(r) = sigma^2 exp(-r / tau) (the Matérn process with nu = 1/2).

Constant

Unknown constant (e.g., the mean of the signal) with a diffuse prior.

LGSSM

Linear-Gaussian state-space model.

fit_bank

Fit a timescale-bank model to a signal.

general_prior

General prior for the pupil size in log-% (\(100 \log(x / \mathrm{median})\)), derived from recordings of several experiments.

reference_prior

Wide prior for fits of single recordings without pooling (signals in log-%): it only keeps parameters that the data do not determine from drifting to the bounds.

fit_group

Empirical-Bayes fit of a group of recordings (see hierarchical).

blocked_cv

Blocked cross-validation of a timescale-bank model.

variogram_check

Semivariogram of the data against that of the fitted model.

kalman_filter

Run the Kalman filter and keep everything.

kalman_loglik

Log-likelihood of y under model (Kalman filter without storage).

rts_smoother

Rauch-Tung-Striebel smoother.

forecast_errors

Errors of forecasts several samples ahead.

simulate

Simulate from a state-space model.