NISOx-BDI / SwE-toolbox

SwE toolbox
GNU General Public License v2.0
16 stars 7 forks source link

Make an informative footer #24

Closed TomMaullin closed 6 years ago

TomMaullin commented 6 years ago

Currently there is no footer information in the display window. This should be addressed in future PRs.

nicholst commented 6 years ago

Here is SPM's footer: screen shot 2018-07-08 at 14 35 11

nicholst commented 6 years ago

Which can be imported:

Next column:

nicholst commented 6 years ago

Based on input from @BryanGuillaume & @TomMaullin, where's what I think the footer should report on the design and DF:

Where X1 X2 ... are the number of subjects per group, same for visits. Number of visits line is suppressed (or lists n/a) for Classic SwE.

A design matrix / contrast summary would be ...

Note I've removed 'effective' to eliminate confusion.

If dof_type == 1 (dumb type) then this DF line is simpler:

@TomMaullin - Does this make sense?

TomMaullin commented 6 years ago

Hi @nicholst ,

I see, it's difficult for me to tell which variable is which in the SwE object for some of these so below is what I think should go in each of these fields - does anything here look obviously incorrect to you?

Number of subjects: X1 X2 ...

This should be SwE.Gr.nSubj_g.

Number of visits ([Mn Max]): [Mn1 Mx1] [Mn2 Mx2] ....

This should be SwE.Vis.nVis_g. I'm not sure what Mn1 and Mx1 would be here? Is this suggesting individual subjects within a group can have a different number of visits? Does the current code support this?

Number of predictors: P

I think this would be size(SwE.xX.X, 2). Should it be something different for a separable design though?

Contrast DF: P1

I think this would be rank(SwE.xCon(Ic).c).

Error DF: (Type X): (min) X.X, (median) X.X, (max) X

I think this would be done by:

if dof_type ~= 1 

    edfmin = min(vedf)
    edfmax = max(vedf)
    edfmed = med(vedf)

else 

    edf = vedf(1)

end

Where vedf is just the array of edf values for each voxel.

Does this all sound correct to you?

nicholst commented 6 years ago

Number of subjects: X1 X2 ... This should be SwE.Gr.nSubj_g.

Yup!

Number of visits ([Mn Max]): [Mn1 Mx1] [Mn2 Mx2] ....

There is a visit indicator somewhere.... you’ll have to do a loop over subjects in each group to find min and max #’s.

(there is no assumption of equal visits per subject… This is crucial… It is a key strength of SWE.)

Number of predictors: P I think this would be size(SwE.xX.X, 2).

Yes!

Contrast DF: P1 I think this would be rank(SwE.xCon(Ic).c).

Yes!

And yes on error DF!

-Tom

Error DF: (Type X): (min) X.X, (median) X.X, (max) X

I think this would be done by:

if dof_type ~= 1

edfmin = min(vedf)
edfmax = max(vedf)
edfmed = med(vedf)

else

edf = vedf(1)

end Where vedf is just the array of edf values for each voxel.

Does this all sound correct to you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

nicholst commented 6 years ago

Please look at TabDat! I forgot about this. There is a field for footer information. When the user right-clicks you can see it. Check if you can find out about this as well.

TomMaullin commented 6 years ago

Hi @nicholst ,

Ah okay I'll code up all of these and then let you know how I get on with number of visits - I am using the TabDat.ftr{} field so I think SPM is taking care of the right clicking already.

TomMaullin commented 6 years ago

Hi @nicholst ,

I have made all the requested changes bar the number of visits. I am a little confused by this as in the SwE code it appears as though it is treating the number of visits as the same for each group. See line 229 of swe_cp for an example of this where the number of visits per group is given by nVis_g. I am unsure what to do for this field.

nicholst commented 6 years ago

This is the max number of visit is, as it needs to construct nVis x nVis covariance matrices. But it allows each subjects to have missing visits.

nicholst commented 6 years ago

More detail & correction:

For each group (see: iGr), loop over subjects (see: iSubj); max and min # visits come from counting number of observations per subject.

Note, I was wrong before: I thought you’d use the visit index (iVis) for this, which is only available for Modified SwE. But that’s not the case. You only need the observation count per subject (by group), which is always available (classic or modified).

TomMaullin commented 6 years ago

Hi @nicholst ,

I think my confusion comes from how the actual visits matrix the user inputs is constructed. Perhaps could you give me some examples of input for visits for the SwE toolbox where a subject missed a visit against an example where the subject did have that visit.

I'm guessing the code needed is something along the lines of:

for g = 1:nGr

        iSubj_g = iSubj(iGr==uGr(g)) % Subject number for each subject in group for each visit... i think
        uSubj_g = unique(iSubj_g); % Unique subject numbers of subjects in group

        nSubj_g(g) = length(uSubj_g); % number of subjects numbers of subjects in group

        for k = 1:nSubj_g 

                  % The number of visits for subject uSubj_g(k)
                 vis_g_subj(subj) = sum(iSubj_g==uSubj_g(k))

        end

        max_nVis_g(g) = max(vis_g_subj)
        min_nVis_g(g) = min(vis_g_subj)

end

But I'm a little uncertain as I am unsure about the format of the input. Does this seem correct to you?

nicholst commented 6 years ago

Firstly, there is no visits matrix, just a visits indicator iVis

Secondly, I’ve corrected myself, and clarified that min/max visits does not require iVis

What we’re after is simply the number of observations per subject (by group), min and max.

Does this help?

TomMaullin commented 6 years ago

Sorry, I think I might have edited my comment whilst you were reading! I think I understand now! Does the updated version match with what you had in mind?

nicholst commented 6 years ago

Yes, that pseudo code looks good, except: vis_g_subj(subj) should be vis_g_subj(k) and that vis_g_subj needs to be cleared each loop since number of subjects varies with group.

TomMaullin commented 6 years ago

Ah okay! I see, thank you! I will implement these changes!

TomMaullin commented 6 years ago

This has been addressed by PR #34