trentool / TRENTOOL3

Open-Source MATLAB toolbox for transfer entropy estimation
http://trentool.github.io/TRENTOOL3/
GNU General Public License v3.0
56 stars 26 forks source link

Conceptual issues in InteractionDelayReconstruction_analyze.m #9

Closed goocy closed 8 years ago

goocy commented 9 years ago

I'm trying to understand InteractionDelayReconstruction_analyze.m, but I've hit a number of issues.

First, the required cell structure is a bit inconvenient. You say that data is the "output of InteractionDelayReconstruction_calculate", but the actual output of TEsurrogatestats is spread over several dozens or hundreds of files: two for each calculated interaction delay. Of course, I can load them and put them into a cell structure. But InteractionDelayReconstruction_calculate dealt with this issue so much more elegantly, it would be nice if _analyze could do the same.

Second, all the core calculations rely on TGA.TEpermvaluesTmp. But this variable is only initialized with NaNs (in line 142), never actually filled with any data. The only place where it could be filled with data is in line 159, but this line is deactivated. This means that the entire function is currently dysfunctional.

Third, several variables (TEmat, dimord, cfg, sgncmb and TEprepare) are identically named in the source structures (TEresult and TEpermtest). This is very confusing. At least in one instance (TEmat), there is different content expected ("channelcombi x trial" from TEpermtest and "channelpairs x u x trial" from TEresult) for identical variable names. Since you assume in the code that TEmat is a two-dimensional matrix, I've deduced that it actually needs to come from TEpermtest. But I'm not sure, and I'm also not sure which source structure to use for the other four variables. Please don't ask the user to meld variables from two structures together. I'd be perfectly happy with another structure nesting (for example, line 147, TGA.sgncmb=data{1}.TEresult.sgncmb;).

Fourth, this function requires the variable TEpermvalues as input. It's not - as implied in the introductory comments - part of the output file TEpermtest, but needs to be saved as TGAresults manually after running InteractionDelayReconstruction_calculate. And even when the user does that, there's only one such variable, not one for every interaction delay. Is this intended, and do I need to copy the identical matrix into each data cell?

Finally, InteractionDelayReconstruction_calculate already introduces the sixth column that's supposed to be produced by InteractionDelayReconstruction_analyze.

From these combined issues, I'm getting the impression that this function is completely obsolete. Am I correct in these suspicions, and can I just continue with TEgroup_stats?

pwollstadt commented 9 years ago

Hello goocy,

we indeed changed the work flow for the reconstruction of interaction delays. InteractionDelayReconstruction_calculate now does the optimization of interaction delays internally. This is a change from earlier TRENTOOL versions, but makes TE estimation much faster. So, you just call InteractionDelayReconstruction_calculate, but you no longer need to call InteractionDelayReconstruction_analyze in an extra step.

See the example script for a current example analysis and page 21 in the manual for more details on the function's structure.

InteractionDelayReconstruction_analyze is no longer intended to be called by the user directly and we changed its functionality so we can call it from inside IDR_calculate. I'm sorry about the confusion, we're working on cleaning up the function and we'll move it to the private folder in the near future to make things clearer to the user. I'll post a comment here as soon as we have updated the function.

The new work flow for group comparisons is described on p.27 in the manual. If hope this helps, let me know, if you have any more questions or if you want to use IDR_analyze directly.

Best, Patricia

trentool commented 8 years ago

@goocy we updated the manual on the new work flow for delay reconstruction, which no longer requires InteractionDelayReconstruction_analyze.m, and published a release version including these changes (see here). All changes are listed in the release notes. The release includes example scripts on how to use TRENTOOL for delay reconstruction. If you used an old TRENTOOL version, it should be rather easy to adapt the new work flow. In principle, you just have to drop the call to InteractionDelayReconstruction_analyze.m, the final results of TE estimation are now directly returned by InteractionDelayReconstruction_calculate.m.