21 #include<odindata/statistics.h>
60 template <
typename T,
int N_rank>
66 if(x.shape()!=y.shape()) {
67 ODINLOG(odinlog,errorLog) <<
"Shape mismatch" << STD_endl;
71 int n=x.numElements();
73 if(n<2)
return result;
79 sum( (x-xstat.
mean)*(y-ystat.
mean) ) ,
80 sqrt( sum( (x-xstat.
mean) * (x-xstat.
mean) ) ) * sqrt ( sum( (y-ystat.
mean) * (y-ystat.
mean) ) )
84 result.
p=0.5*erfc(fabs(result.
r)*sqrt(
double(n)/2.0));
86 #error erfc() is missing
92 if(n>3) result.
z=0.5*sqrt(
double(n-3))*log(argument);
105 template <
typename T,
int N_rank>
111 if(x.shape()!=y.shape()) {
112 ODINLOG(odinlog,errorLog) <<
"Shape mismatch" << STD_endl;
121 for(
int j=0; j<n; j++) {
122 for(
int i=j+1; i<n; i++) {
123 TinyVector<int,N_rank> ii=index2extent(x.shape(),i);
124 TinyVector<int,N_rank> jj=index2extent(x.shape(),j);
125 float dx=x(jj)-x(ii);
126 float dy=y(jj)-y(ii);
135 double tau=
secureDivision(diff,sqrt(
double(nx))*sqrt(
double(ny)));
correlationResult correlation(const Array< T, N_rank > &x, const Array< T, N_rank > &y)
correlationResult kendall(const Array< T, N_rank > &x, const Array< T, N_rank > &y)
fmriResult fmri_eval(const Data< float, 1 > &timecourse, const Data< float, 1 > &designvec)
statisticResult statistics(const Array< T, N_rank > &ensemble, const Array< T, N_rank > *mask=0)
double secureDivision(double numerator, double denominator)