algorithms.statistics.bayesian_mixed_effects

Module: algorithms.statistics.bayesian_mixed_effects

Generic implementation of multiple regression analysis under noisy measurements.

nipy.algorithms.statistics.bayesian_mixed_effects.two_level_glm(y, vy, X, niter=10)

Inference of a mixed-effect linear model using the variational Bayes algorithm.

Parameters:
yarray-like

Array of observations. Shape should be (n, …) where n is the number of independent observations per unit.

vyarray-like

First-level variances associated with the observations. Should be of the same shape as Y.

Xarray-like

Second-level design matrix. Shape should be (n, p) where n is the number of observations per unit, and p is the number of regressors.

Returns:
betaarray-like

Effect estimates (posterior means)

s2array-like

Variance estimates. The posterior variance matrix of beta[:, i] may be computed by s2[:, i] * inv(X.T * X)

doffloat

Degrees of freedom as per the variational Bayes approximation (simply, the number of observations minus the number of independent regressors)