This section describes the mathematical details of the calculation of minimum-norm estimates. In Bayesian sense, the ensuing current distribution is the maximum a posteriori (MAP) estimate under the following assumptions:
Computing the inverse operator is accomplished using :func:`mne.minimum_norm.make_inverse_operator` and :func:`mne.minimum_norm.apply_inverse`. The use of these functions is presented in the tutorial :ref:`tut-inverse-methods`.
The measured data in the source estimation procedure consists of MEG and EEG data, recorded on a total of N channels. The task is to estimate a total of Q strengths of sources located on the cortical mantle. If the number of source locations is P, Q = P for fixed-orientation sources and Q = 3P if the source orientations are unconstrained. The regularized linear inverse operator following from regularized maximal likelihood of the above probabilistic model is given by the Q×N matrix
where G is the gain matrix relating the source strengths to the measured MEG/EEG data, C is the data noise-covariance matrix and R’ is the source covariance matrix. The dimensions of these matrices are N×Q, N×N, and Q×Q, respectively. The Q×1 source-strength vector is obtained by multiplying the Q×1 data vector by Q.
The expected value of the current amplitudes at time t is then given by ĵ(t) = Mx(t), where x(t) is a vector containing the measured MEG and EEG data values at time t.
For computational convenience, the linear inverse operator is not computed explicitly. See :ref:`mne_solution` for mathematical details, and :ref:`CIHCFJEI` for a detailed example.
The a priori variance of the currents is, in practice, unknown. We can express this by writing R’ = R ⁄ λ2 = Rλ − 2, which yields the inverse operator
where the unknown current amplitude is now interpreted in terms of the regularization parameter λ2. Larger λ2 values correspond to spatially smoother and weaker current amplitudes, whereas smaller λ2 values lead to the opposite.
We can arrive at the regularized linear inverse operator also by minimizing a cost function S with respect to the estimated current ĵ (given the measurement vector x at any given time t) as
where the first term consists of the difference between the whitened measured data (see :ref:`whitening_and_scaling`) and those predicted by the model while the second term is a weighted-norm of the current estimate. It is seen that, with increasing λ2, the source term receive more weight and larger discrepancy between the measured and predicted data is tolerable.
The MNE software employs data whitening so that a 'whitened' inverse operator assumes the form
where
is the spatially whitened gain matrix. We arrive at the whitened inverse operator equation :eq:`inv_m_tilde` by making the substitution for G from :eq:`inv_g_tilde` in :eq:`inv_m` as
The expected current values are
knowing :eq:`inv_m_tilde` and taking
as the whitened measurement vector at time t. The spatial whitening operator C − 1 ⁄ 2 is obtained with the help of the eigenvalue decomposition C = UCΛ2CU⊤C as C − 1 ⁄ 2 = Λ − 1CU⊤C. In the MNE software the noise-covariance matrix is stored as the one applying to raw data. To reflect the decrease of noise due to averaging, this matrix, C0, is scaled by the number of averages, L, i.e., C = C0 ⁄ L.
Note
When EEG data are included, the gain matrix G needs to be average referenced when computing the linear inverse operator M. This is incorporated during creating the spatial whitening operator C − 1 ⁄ 2, which includes any projectors on the data. EEG data average reference (using a projector) is mandatory for source modeling and is checked when calculating the inverse operator.
As shown above, regularization of the inverse solution is equivalent to a change in the variance of the current amplitudes in the Bayesian a priori distribution.
A convenient choice for the source-covariance matrix R is such that trace(G̃RG̃⊤) ⁄ trace(I) = 1. With this choice we can approximate λ2 ∼ 1 ⁄ \rmSNR2, where SNR is the (amplitude) signal-to-noise ratio of the whitened data.
Note
The definition of the signal to noise-ratio/ λ2 relationship given above works nicely for the whitened forward solution. In the un-whitened case scaling with the trace ratio trace(GRG⊤) ⁄ trace(C) does not make sense, since the diagonal elements summed have, in general, different units of measure. For example, the MEG data are expressed in T or T/m whereas the unit of EEG is Volts.
See :ref:`tut-compute-covariance` for example of noise covariance computation and whitening.
Since finite amount of data is usually available to compute an estimate of the noise-covariance matrix C, the smallest eigenvalues of its estimate are usually inaccurate and smaller than the true eigenvalues. Depending on the seriousness of this problem, the following quantities can be affected:
Fortunately, the latter two are least likely to be affected due to regularization of the estimates. However, in some cases especially the EEG part of the noise-covariance matrix estimate can be deficient, i.e., it may possess very small eigenvalues and thus regularization of the noise-covariance matrix is advisable.
Historically, the MNE software accomplishes the regularization by replacing a noise-covariance matrix estimate C with
where the index k goes across the different channel groups (MEG planar gradiometers, MEG axial gradiometers and magnetometers, and EEG), εk are the corresponding regularization factors, ‒σk are the average variances across the channel groups, and I(k) are diagonal matrices containing ones at the positions corresponding to the channels contained in each channel group.
See :ref:`plot_compute_covariance_howto` for details on computing and regularizing the channel covariance matrix.
The most straightforward approach to calculate the MNE is to employ the expression of the original or whitened inverse operator directly. However, for computational convenience we prefer to take another route, which employs the singular-value decomposition (SVD) of the matrix
where the superscript 1 ⁄ 2 indicates a square root of R. For a diagonal matrix, one simply takes the square root of R while in the more general case one can use the Cholesky factorization R = RCR⊤C and thus R1 ⁄ 2 = RC.
Combining the SVD from :eq:`inv_a` with the inverse equation :eq:`inv_m` it is easy to show that
where the elements of the diagonal matrix Γ are simply
From our expected current equation :eq:`inv_j_hat_t` and our whitened measurement equation :eq:`inv_tilde_x_t`, if we take
we can see that the expression for the expected current is just
where ‒vk = R1 ⁄ 2vk, with vk being the k th column of V. It is thus seen that the current estimate is a weighted sum of the "weighted" eigenleads vk.
It is easy to see that w(t) ∝ √(L). To maintain the relation (G̃RG̃⊤) ⁄ trace(I) = 1 when L changes we must have R ∝ 1 ⁄ L. With this approach, λk is independent of L and, for fixed λ, we see directly that j(t) is independent of L.
The minimum-norm estimate is computed using this procedure in :func:`mne.minimum_norm.make_inverse_operator`, and its usage is illustrated in :ref:`CIHCFJEI`.
Noise normalization serves three purposes:
In practice, noise normalization is implemented as a division by the square root of the estimated variance of each voxel. In computing these noise normalization factors, it's convenient to reuse our "weighted eigenleads" definition from equation :eq:`inv_j_hat_t` in matrix form as
Noise-normalized linear estimates introduced by Dale et al. :footcite:`DaleEtAl1999` require division of the expected current amplitude by its variance. In practice, this requires the computation of the diagonal elements of the following matrix, using SVD equation :eq:`inv_m_tilde` and :eq:`inv_eigenleads_weighted`:
Because we only care about the diagonal entries here, we can find the variances for each source as
Under the conditions expressed at the end of :ref:`mne_solution`, it follows that the t-statistic values associated with fixed-orientation sources) are thus proportional to √(L) while the F-statistic employed with free-orientation sources is proportional to L, correspondingly.
Note
The MNE software usually computes the square roots of the F-statistic to be displayed on the inflated cortical surfaces. These are also proportional to √(L).
sLORETA :footcite:`Pascual-Marqui2002` estimates the current variances as the diagonal entries of the resolution matrix, which is the product of the inverse and forward operators. In other words, the diagonal entries of (using :eq:`inv_m_tilde_svd`, :eq:`inv_g_tilde`, and :eq:`inv_a`)
Because R is diagonal and we only care about the diagonal entries, we can find our variance estimates as
While dSPM and sLORETA solve for noise normalization weights σ2k that are applied to standard minimum-norm estimates ĵ(t), eLORETA :footcite:`Pascual-Marqui2011` instead solves for a source covariance matrix R that achieves zero localization bias. For fixed-orientation solutions the resulting matrix R will be a diagonal matrix, and for free-orientation solutions it will be a block-diagonal matrix with 3×3 blocks.
In :footcite:`Pascual-Marqui2011` eq. 2.13 states that the following system of equations can be used to find the weights, ∀i ∈ 1, ..., P (note that here we represent the equations from that paper using our notation):
And an iterative algorithm can be used to find the values for the weights ri that satisfy these equations as:
In particular, for step (2) we can use our substitution from :eq:`inv_g_tilde` as:
Then defining Ñ as the whitened version of N, i.e., the regularized pseudoinverse of G̃RG̃⊤, we can compute N as:
In step (3) we left and right multiply with subsets of G, but making the substitution :eq:`inv_g_tilde` we see that we equivalently compute:
For convenience, we thus never need to compute N itself but can instead compute the whitened version Ñ.
Under noiseless conditions the SNR is infinite and thus leads to λ2 = 0 and the minimum-norm estimate explains the measured data perfectly. Under realistic conditions, however, λ2 > 0 and there is a misfit between measured data and those predicted by the MNE. Comparison of the predicted data, here denoted by x(t), and measured one can give valuable insight on the correctness of the regularization applied.
In the SVD approach we easily find
where the diagonal matrix Π has elements πk = λkγk The predicted data is thus expressed as the weighted sum of the 'recolored eigenfields' in C1 ⁄ 2U.
If the add_dists=True option was used in source space creation, the source space file will contain Cortical Patch Statistics (CPS) for each vertex of the cortical surface. The CPS provide information about the source space point closest to it as well as the distance from the vertex to this source space point. The vertices for which a given source space point is the nearest one define the cortical patch associated with with the source space point. Once these data are available, it is straightforward to compute the following cortical patch statistics for each source location d:
use_cps parameter in :func:`mne.convert_forward_solution`, and :func:`mne.minimum_norm.make_inverse_operator` controls whether to use cortical patch statistics (CPS) to define normal orientations or not (see :ref:`CHDBBCEJ`).
The principal sources of MEG and EEG signals are generally believed to be postsynaptic currents in the cortical pyramidal neurons. Since the net primary current associated with these microscopic events is oriented normal to the cortical mantle, it is reasonable to use the cortical normal orientation as a constraint in source estimation. In addition to allowing completely free source orientations, the MNE software implements three orientation constraints based of the surface normal data:
The minimum-norm estimates have a bias towards superficial currents. This tendency can be alleviated by adjusting the source covariance matrix R to favor deeper source locations. In the depth weighting scheme employed in MNE analyze, the elements of R corresponding to the p th source location are be scaled by a factor
where g1p, g2p, and g3p are the three columns of G corresponding to source location p and γ is the order of the depth weighting, which is specified via the depth option in :func:`mne.minimum_norm.make_inverse_operator`.
It is often the case that the epoch to be analyzed is a linear combination over conditions rather than one of the original averages computed. As stated above, the noise-covariance matrix computed is originally one corresponding to raw data. Therefore, it has to be scaled correctly to correspond to the actual or effective number of epochs in the condition to be analyzed. In general, we have
where Leff is the effective number of averages. To calculate Leff for an arbitrary linear combination of conditions
we make use of the the fact that the noise-covariance matrix
which leads to
An important special case of the above is a weighted average, where
and, therefore
Instead of a weighted average, one often computes a weighted sum, a simplest case being a difference or sum of two categories. For a difference w1 = 1 and w2 = − 1 and thus
or
Interestingly, the same holds for a sum, where w1 = w2 = 1. Generalizing, for any combination of sums and differences, where wi = 1 or wi = − 1, i = 1…n, we have