# 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: y : array-like Array of observations. Shape should be (n, …) where n is the number of independent observations per unit. vy : array-like First-level variances associated with the observations. Should be of the same shape as Y. X : array-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. beta : array-like Effect estimates (posterior means) s2 : array-like Variance estimates. The posterior variance matrix of beta[:, i] may be computed by s2[:, i] * inv(X.T * X) dof : float Degrees of freedom as per the variational Bayes approximation (simply, the number of observations minus the number of independent regressors)