# modeling - inverse methods

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Thu Apr 27 10:58:13 CEST 2006

```Dear Punita

On 26 Apr 2006, at 18:07, Punita Christopher wrote:
> I calculate the forward solution using my code but I was wondering if
> there is any inverse modeling code (perhaps using least squares
> method) in
> Fieldtrip that will help me to compare the modeled data and my
> measured
> data.

The usual approach to compare the modelled and measured data, in case
of a model with a limited number of parameters, is by fitting the
modelparameters to the data, based on some error measure. The usual
error measure is the sum of squares (or residual variance) over all
channels. This is implemented in the DIPOLEFITTING function. The
usual model parameters are partially linearly related to the data
(i.e. dipole moment, [qx qy qz]) and partially nonlinear (dipole
position, [rx ry rz]). The optimization technique implemented in
DIPOLEFITTING uses decoupling to estimate both linear and nonlinear
part optimally.

Is in your forward model the dipole moment (incorporating orientation
and strength in a 3x1 vector [qx qy qz]) linear with the data? I
think it is. Then you can use the standard implementation in
DIPOLEFITTING. If it were non-linear, the implementation would have
to be adjusted to prevent the decoupling of linear and nonlinear
parameters, and you would have to fit all 6 parameters nonlinearly.

> My data consists of x,y,z, (coordinates) and v (single potential
> value).  My data is not even EEG data, I am just using the EEG
> approach
> for my research.

To make use of the dipole fitting function in Fieldtrip, you would
function, which is in the private directory. For each iteration of
the non-linear fit, that function is called and it is supposed to

It would be nice in general to have the Zhang 1995 model included in
Fieldtrip. I think that the Mosher 1999 results in exactly the same
leadfields as the 4-shell model that we already have, so that would
not be too interesting to include (unless it is faster). Please
contact me directly outside the mailing list if you have technical