Back to the main page.

# Bug 3045 - tcdf in external/stats is not fully compatible with its counterpart in matlab R2015b

Status | CLOSED FIXED |

Reported | 2016-01-15 12:29:00 +0100 |

Modified | 2016-06-14 16:14:50 +0200 |

Product: | FieldTrip |

Component: | external |

Version: | unspecified |

Hardware: | PC |

Operating System: | Linux |

Importance: | P5 normal |

Assigned to: | Robert Oostenveld |

URL: | |

Tags: | |

Depends on: | |

Blocks: | |

See also: |

## Andrea Brovelli - 2016-01-15 12:29:12 +0100

Dear all, I have noticed that some replacements functions within /external/stats are not compatible with Mathworks statistical toolbox. This creates errors when executing statistical toolbox functions outside of Fieldtrip. Would it be possible to add the fieldtrip paths at the end of the Matlab search path by default? Thanks Andrea

## Jan-Mathijs Schoffelen - 2016-01-19 16:13:48 +0100

Hi Andrea, Could you indicate which functions this concerns? I suspect some of the nanXXX functions, but am not sure. Besides this, I think that it certainly possible to add the fieldtrip path at the end of your matlab path, but this is something that the user should be able to do, right?

## Andrea Brovelli - 2016-01-19 16:23:00 +0100

Hi Jan-Mathijs, I got a problem when I was executing fitlmematrix and I got an error associated with tcdf.m This is a function that is called also by glmfit, but I did not try it out. Indeed, I solved this problem by removing /external/stats path or by putting it at the end of the path. But I guess that not all Fieldtrip users that use the statistical toolbox are aware of this. Sorry I was not clear. bye and thanks Andrea

## Robert Oostenveld - 2016-01-19 16:31:23 +0100

Hi Andrea which matlab version are you using? Ideally I would keep the replacement stats functions drop in compatible. Moving fieldtrip/external/stats to the bottom won't work, because in that case /Applications/MATLAB_R2015b.app/toolbox/stats/ will be used, which defeats the point of external/stats. So in your case you should explicitly remove external/stats AFTER calling ft_defaults (which adds it, but only once).

## Andrea Brovelli - 2016-01-19 16:36:46 +0100

Hi Robert, I use MatlabR2015b. Ok, thanks I'll do that. Question: can't you simply replace the /external/stats/tcdf.m with the one from the latest Stastical toolbox ? (and thanks again for your tutorial in Marseille)

## Robert Oostenveld - 2016-01-19 16:39:04 +0100

(In reply to Andrea Brovelli from comment #4) no, overwriting /external/stats/tcdf.m with the one from Mathworks won't work. The one from Mathworks will probably have external and private dependencies. Besides, If it were to work, there would not be an advantage, since you would still need the license. Since the license is not a problem for you, simply rmpath the one from FT.

## Robert Oostenveld - 2016-01-19 16:50:42 +0100

the difference in the implementation that I see is that the 2015b version has an optional 3rd argument flag that is not present in external/stats and also not in 2012b. The default is to compute the lower tail. I'll add the upper tail as alternative. this should make it compatible again: mac011> svn commit external/stats/ Sending external/stats/tcdf.m Transmitting file data . Committed revision 11087.

## Andrea Brovelli - 2016-01-19 16:59:37 +0100

Excellent ! Thanks