mne.stats.linear_regression#
- mne.stats.linear_regression(inst, design_matrix, names=None)[source]#
Fit Ordinary Least Squares (OLS) regression.
- Parameters
- instinstance of
Epochs
| iterable ofSourceEstimate
The data to be regressed. Contains all the trials, sensors, and time points for the regression. For Source Estimates, accepts either a list or a generator object.
- design_matrix
ndarray
, shape (n_observations, n_regressors) The regressors to be used. Must be a 2d array with as many rows as the first dimension of the data. The first column of this matrix will typically consist of ones (intercept column).
- namesarray-like |
None
Optional parameter to name the regressors (i.e., the columns in the design matrix). If provided, the length must correspond to the number of columns present in design matrix (including the intercept, if present). Otherwise, the default names are
'x0'
,'x1'
,'x2', …, 'x(n-1)'
forn
regressors.
- instinstance of
- Returns
- results
dict
ofcollections.namedtuple()
For each regressor (key), a namedtuple is provided with the following attributes:
beta
: regression coefficientsstderr
: standard error of regression coefficientst_val
: t statistics (beta
/stderr
)p_val
: two-sided p-value of t statistic under the t distributionmlog10_p_val
: -log₁₀-transformed p-value.
The tuple members are numpy arrays. The shape of each numpy array is the shape of the data minus the first dimension; e.g., if the shape of the original data was
(n_observations, n_channels, n_timepoints)
, then the shape of each of the arrays will be(n_channels, n_timepoints)
.
- results
Examples using mne.stats.linear_regression
#
Analysing continuous features with binning and regression in sensor space
Single trial linear regression analysis with the LIMO dataset