[FieldTrip] Calculating goodness of fit

Robert Oostenveld r.oostenveld at donders.ru.nl
Thu Apr 18 10:23:59 CEST 2013

Hi Jim

On 27 Mar 2013, at 0:24, Jim McKay wrote:
> I am trying to figure out how to calculate the goodness of fit (gof) after a dipole fit on MEG data. The equation for gof has two input variables, the measured data vector and the model data vector from the EC dipole fit. The measured data vector is easy, but I am confused which vector to use for the model data, which is a vector of length (1:Num_sensors). If dip1 is the output from the ft_dipolefitting function, candidates are:
> dip1.Vdata  - perhaps this is the measured data?
> dip1.Vmodel - sounds promising?
> dip1.dip.pot - or maybe this?

The output from ft_dipolefitting is a bit archaic. It is on the todo list to update this data structure and make it more self-explanatory.

dip1.Vdata  is the Nchans*Ntime matrix with the data that was fitted (can be either EEG or MEG, so don't be comfused by the "V" in the name)
dip1.Vmodel is the Nchans*Ntime matrix with the forward solution predicted by the dipole model 

you can subtract the two and for example visualize the resudual. The field dip.dip.pot contains the same as dip.Vmodel.

You might want to take a look at ft_dipolefitting around line 500, where these fields and the gof (actually residual variance) are dealt with.

best regards,

More information about the fieldtrip mailing list