nstat.FitResSummary

class nstat.FitResSummary(fit_results)[source]

Bases: FitSummary

MATLAB-compatible alias for FitSummary.

Parameters:

fit_results (FitResult | Iterable[FitResult])

__init__(fit_results)

Construct a population-level summary (Matlab FitResSummary).

Parameters:

fit_results (FitResult or iterable of FitResult) – One or more per-neuron FitResult objects to summarise. A single FitResult is wrapped in a list automatically.

Raises:

ValueError – If an empty iterable is passed.

Return type:

None

Notes

On construction the summary precomputes per-config means and standard deviations of AIC, BIC, log-likelihood, KS statistics, and the union of covariate labels across all neurons. Rows (neurons) with fewer configs than the maximum are NaN-padded so every metric matrix has shape (numNeurons, numResults).

See also

FitResult

Per-neuron fit container.

binCoeffs(minVal=-12.0, maxVal=12.0, binSize=0.1)

Histogram of regression coefficients per covariate.

Matches Matlab FitResSummary.binCoeffs: for each unique covariate, bins the significant coefficient values across all neurons/fits, normalizes to a PDF, and computes the fraction of times each covariate was significant.

Returns:

  • N ((nBins, nCovariates) per-covariate normalized histograms (PDFs))

  • edges ((nBins + 1,) bin edges)

  • percentSig ((nCovariates,) fraction of times each covariate was significant)

boxPlot(X, diffIndex=1, h=None, dataLabels=None, **kwargs)

General-purpose box-plot of X columns with fit-name labels.

Parameters:

diffIndex (int)

static fromStructure(structure)

Reconstruct a FitSummary from a dict.

Parameters:

structure (dict[str, Any])

Return type:

FitSummary

getCoeffIndex(fitNum=None)

Return 0-based indices into uniqueCovLabels that are NOT history terms.

Parameters:

fitNum (int | list[int] | None)

Return type:

list[int]

getCoeffs(fitNum=0)

Return (coeffMat, labels, seMat) aligned to unique labels.

Parameters:

fitNum (int)

getDiffAIC(idx=1)

Return ΔAIC relative to config idx (0-based).

Parameters:

idx (int)

Return type:

ndarray

getDiffBIC(idx=1)

Return ΔBIC relative to config idx (0-based).

Parameters:

idx (int)

Return type:

ndarray

getDifflogLL(idx=1)

Return Δlog-likelihood relative to config idx (0-based).

Parameters:

idx (int)

Return type:

ndarray

getHistCoeffs(fitNum=0)

Return (histMat, labels, seMat) for history coefficients.

Parameters:

fitNum (int)

getHistIndex(fitNum=None)

Return 0-based indices into uniqueCovLabels that are history terms.

Parameters:

fitNum (int | list[int] | None)

Return type:

list[int]

getSigCoeffs(fitNum=0)

Return (nNeurons × nCov) binary significance matrix.

Parameters:

fitNum (int)

mapCovLabelsToUniqueLabels()

Rebuild the union of covariate labels across all neurons.

plot2dCoeffSummary(handle=None)

Stacked line plot of binned coefficient distributions (Matlab plot2dCoeffSummary).

plot3dCoeffSummary(handle=None)

3D ribbon plot of binned coefficient distributions (Matlab plot3dCoeffSummary).

plotAIC(handle=None)

Box-plot of AIC across neurons (Matlab plotAIC).

plotAllCoeffs(fitNum=None, plotSignificance=True, subIndex=None, handle=None)

Errorbar plot of GLM coefficients across neurons (Matlab plotAllCoeffs).

Parameters:
plotBIC(handle=None)

Box-plot of BIC across neurons (Matlab plotBIC).

plotCoeffsWithoutHistory(fitNum=None, plotSignificance=True, handle=None)

Plot coefficients excluding history terms (Matlab plotCoeffsWithoutHistory).

Parameters:
plotHistCoeffs(fitNum=None, plotSignificance=True, handle=None)

Plot only the history coefficients (Matlab plotHistCoeffs).

Parameters:
plotIC(handle=None)

Plot AIC, BIC, and log-likelihood box-plots side by side.

plotKSSummary(neurons=None, handle=None)

Subplot grid of KS plots per neuron (Matlab plotKSSummary).

Parameters:

neurons (list[int] | None)

plotResidualSummary(handle=None)

Overlay all neurons’ martingale residuals (Matlab plotResidualSummary).

plotSummary(handle=None)

Bar chart of mean AIC, BIC, and log-likelihood across configs.

plotlogLL(handle=None)

Box-plot of log-likelihood across neurons (Matlab plotlogLL).

setCoeffRange(minVal, maxVal)

Set the coefficient range used by binCoeffs.

toStructure()

Serialize to a JSON-compatible dict.

Return type:

dict[str, Any]