Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correlation #8

Open
speters14 opened this issue Aug 11, 2017 · 16 comments
Open

Correlation #8

speters14 opened this issue Aug 11, 2017 · 16 comments

Comments

@speters14
Copy link

Hi Mensen,

I'm trying to use the correlation option with the TFCE code. I'm wondering what the format of the behavioral data should be? I've tried a few different things but I'm getting an error. I was looking to do 6 different behavioral measures (six scores) per subject (19 subjects). For my EEG data, though, I'm still using subject x chan x freq. Do I need to scale that down to one chan or one freq? Thanks.

Error using -
Array dimensions must match for binary array op.

Error in ept_TFCE>@(x)(x-mean(x))./std(x) (line 325)
condition = @(x) (x-mean(x))./std(x);

Error in ept_TFCE (line 334)
T_Obs = (condition(Data{1})' * condition(behavior_repeated)) / sum(condition(Data{1}).^2);

@Mensen
Copy link
Owner

Mensen commented Aug 11, 2017

Hey!

The behavioural option is currently only capable of a single correlation. So the behavioural data should just be a single dimension vector of length n_participants.

If you want to measure 6 different correlations unfortunately you'll have to run each correlation separately for now.

The other way I'm currently working on is using linear mixed models with these 6 predictors... but unfortunately this is still too slow if you have more than just the channels (you mentioned you had multiple frequencies).

Hope this way is not too much of a bother for you. Let me know how you get on!

@Mensen
Copy link
Owner

Mensen commented Aug 11, 2017

I should also mention that the parameter settings for e and h (normally semi-hidden parameters) might not be optimal for correlation analysis (in particular the h parameter)... so you might want to test out a couple of different settings here (e.g. h = 1, or h = 3; default is 2) in case the results aren't quite what you are expecting. We can discuss this parameter more in detail if it turns out other settings than the default give more expected results.

@speters14
Copy link
Author

speters14 commented Aug 11, 2017 via email

@speters14
Copy link
Author

speters14 commented Aug 12, 2017 via email

@Mensen
Copy link
Owner

Mensen commented Aug 12, 2017

So I couldn't reproduce the matrix dimension must agree error ... what version of matlab are you using?

I did find another error with multidimensional data for the correlation calculation and I fixed that in 3b44dcd, and maybe that fixed your particular error by magic? Probably not, but let me know what version you are using and I'll try to reproduce the error.

@speters14
Copy link
Author

speters14 commented Aug 12, 2017 via email

@speters14
Copy link
Author

speters14 commented Aug 12, 2017 via email

@Mensen
Copy link
Owner

Mensen commented Aug 12, 2017

I've recently been seeing a lot of problems with things pre-2014b... I think Matlab made a lot of changes to more basic functions after that, and since I usually keep up-to-date with Matlab, it becomes difficult to make sure things are backwards compatible. I have 2014a on another computer for this reason, and I'll try it out there and see if I can get a workaround for these older versions.

If you can get your hands on the newest possible one (I think still 2017a for now), then this should be fine. However, I think even 2014b should make a difference.


In regards to the ANOVA... your data should be structured in a 2 x 2 cell array. So a 6 x 124 x 141 in each cell array just keeping consistent across the dimensions (e.g. gender differences in columns, and age differences in the rows... or the other way, just not mixed).

@speters14
Copy link
Author

speters14 commented Aug 12, 2017 via email

@speters14
Copy link
Author

speters14 commented Aug 12, 2017 via email

@speters14
Copy link
Author

speters14 commented Aug 12, 2017 via email

@Mensen
Copy link
Owner

Mensen commented Aug 12, 2017

Re: ANOVA...
I should probably redo the initial GUI since the procedure there is not quite clear. However, you could manually create a Data cell array in Matlab itself and then run the command: ept_TFCE_ANOVA(Data, e_loc) and manually put the data through the command line.

I don't get any attachment, but could you send it to my regular email address? (research.mensen (at) gmail...

@speters14
Copy link
Author

speters14 commented Aug 12, 2017 via email

@speters14
Copy link
Author

speters14 commented Aug 12, 2017 via email

@speters14
Copy link
Author

Back to the correlation. Tried it on another computer, now running Matlab 2017a. It appeared to be working this time until this error appeared. I did install the compiler and run mex -setup. But when installing the compiler there was an option for C++ or Fortran, but I ignored it. Not sure if relevant (see below the error for that Matlab message)

Calculating Channel Neighbours...
Done
Calculating Actual Differences...
Invalid MEX-file 'C:\Users\Sue\Documents\MATLAB\ept_TFCE-matlab-master\TFCE\Dependencies\ept_mex_TFCE2D.mexw64':
Missing symbol 'mxErrMsgTxt' in 'C:\Program Files\MATLAB\R2017a/bin/win64\libmx.dll' required by
'C:\Users\Sue\Documents\MATLAB\ept_TFCE-matlab-master\TFCE\Dependencies\ept_mex_TFCE2D.mexw64'.

Error in ept_TFCE (line 354)
TFCE_Obs = ept_mex_TFCE2D(T_Obs, ChN, E_H);

end of error msg
start of mex message

mex -setup
MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. You will be required
to update your code to utilize the new API.
You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.

To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN

@Mensen
Copy link
Owner

Mensen commented Aug 14, 2017

A note on the ANOVA that is not explicitly made in the scripts... The default h value for ANOVA is 1 since the F-values that are compared are already squared T-values. Just good to know for reporting statistics in case you go into that much detail in the methods sections.


Re the mex issue...

At some point the matlab-mex stuff stopped recognising the command mxErrMsgTxt and instead only recognised mexErrMsgTxt... these were changed in the toolbox ".c" files, but you may need to recompile them on a windows system since the pre-compiled windows files might still have the older "mx" convention.

There's probably no issue with the compiler... but you'll still need to go into the dependencies folder and mex each ".c." file separately unfortunately. I'd be happy to do this for you, but I don't use windows so I can't. However, if you manage to create the new "mexw64" files you could send them to me and I'll include these in an update of the toolbox (or you send me a "pull request" with your toolbox version).

I tested my own correlation scripts with your data, and, as you also now saw, they work with the latest matlab version. However, I saw they were incredibly slow! Hope this is not too annoying. I don't have the time at the moment to go through these another way but will make a note on the TODO list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants