Inheritance diagram for nipy.algorithms.statistics.mixed_effects_stat:
Module for computation of mixed effects statistics with an EM algorithm. i.e. solves problems of the form y = X beta + e1 + e2, where X and Y are known, e1 and e2 are centered with diagonal covariance. V1 = var(e1) is known, and V2 = var(e2) = lambda identity. the code estimates beta and lambda using an EM algorithm. Likelihood ratio tests can then be used to test the columns of beta.
Author: Bertrand Thirion, 2012.
>>> N, P = 15, 500
>>> V1 = np.random.randn(N, P) ** 2
>>> effects = np.random.randn(P) > 0
>>> Y = generate_data(np.ones(N), effects, .25, V1)
>>> T1 = one_sample_ttest(Y, V1, n_iter=5)
>>> T1 = [T1[effects == x] for x in np.unique(effects)]
>>> T2 = [t_stat(Y)[effects == x] for x in np.unique(effects)]
>>> assert np.array([t1.std() < t2.std() for t1, t2 in zip(T1, T2)]).all()
Bases: object
Class to handle multiple one-sample mixed effects models
Methods
fit(Y, V1) | Launches the EM algorithm to estimate self |
log_like(Y, V1) | Compute the log-likelihood of (Y, V1) under the model |
predict(Y, V1) | Return the log_likelihood of the data.See the log_like method |
score(Y, V1) | Return the log_likelihood of the data. |
Set the effects and first-level variance, and initialize related quantities
Parameters : | X: array of shape(n_samples, n_effects), :
n_iter: int, optional, :
verbose: bool, optional, verbosity mode : |
---|
Launches the EM algorithm to estimate self
Parameters : | Y, array of shape (n_samples, n_tests) or (n_samples) :
V1, array of shape (n_samples, n_tests) or (n_samples) :
|
---|---|
Returns : | self : |
Compute the log-likelihood of (Y, V1) under the model
Parameters : | Y, array of shape (n_samples, n_tests) or (n_samples) :
V1, array of shape (n_samples, n_tests) or (n_samples) :
|
---|---|
Returns : | logl: array of shape self.n_tests, :
|
Return the log_likelihood of the data.See the log_like method
Return the log_likelihood of the data. See the log_like method
Check that the given data can be used for the models
Parameters : | Y: array of shape (n_samples, n_tests) or (n_samples) :
V1: array of shape (n_samples, n_tests) or (n_samples) :
|
---|
Generate a group of individuals from the provided parameters
Parameters : | X: array of shape (n_samples, n_reg), :
beta: float or array of shape (n_reg, n_tests), :
V2: float or array of shape (n_tests), :
V1: array of shape(n_samples, n_tests), :
|
---|---|
Returns : | Y: array of shape(n_samples, n_tests) :
|
Run a mixed-effects model test on the column of the design matrix
Parameters : | Y: array of shape (n_samples, n_tests) :
V1: array of shape (n_samples, n_tests) :
X: array of shape(n_samples, n_regressors) :
column: int, :
n_iter: int, optional, :
return_t: bool, optional, :
return_f: bool, optional, :
return_effect: bool, optional, :
return_var: bool, optional, :
verbose: bool, optional, verbosity mode : |
---|---|
Returns : | (tstat, fstat, effect, var): tuple of arrays of shape (n_tests), :
|
Returns the mixed effects F-stat for each row of the X (one sample test) This uses the Formula in Roche et al., NeuroImage 2007
Parameters : | Y: array of shape (n_samples, n_tests) :
V1: array of shape (n_samples, n_tests) :
n_iter: int, optional, :
verbose: bool, optional, verbosity mode : |
---|---|
Returns : | fstat, array of shape (n_tests), :
sign, array of shape (n_tests), :
|
Returns the mixed effects t-stat for each row of the X (one sample test) This uses the Formula in Roche et al., NeuroImage 2007
Parameters : | Y: array of shape (n_samples, n_tests) :
V1: array of shape (n_samples, n_tests) :
n_iter: int, optional, :
verbose: bool, optional, verbosity mode : |
---|---|
Returns : | tstat: array of shape (n_tests), :
|
Returns the t stat of the sample on each row of the matrix
Parameters : | Y, array of shape (n_samples, n_tests) : |
---|---|
Returns : | t_variates, array of shape (n_tests) : |
Returns the mixed effects t-stat for each row of the X (one sample test) This uses the Formula in Roche et al., NeuroImage 2007
Parameters : | Y: array of shape (n_samples, n_tests) :
V1: array of shape (n_samples, n_tests) :
group: array of shape (n_samples) :
n_iter: int, optional, :
verbose: bool, optional, verbosity mode : |
---|---|
Returns : | tstat: array of shape (n_tests), :
|
Returns the mixed effects t-stat for each row of the X (one sample test) This uses the Formula in Roche et al., NeuroImage 2007
Parameters : | Y: array of shape (n_samples, n_tests) :
V1: array of shape (n_samples, n_tests) :
group: array of shape (n_samples) :
n_iter: int, optional, :
verbose: bool, optional, verbosity mode : |
---|---|
Returns : | tstat: array of shape (n_tests), :
|