Skip to content

Commit bf2583b

Browse files
committed
jb func changed
1 parent 9154d03 commit bf2583b

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/statistics.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,9 @@ T pchisq(const T &stat, const unsigned int &k) {
8383
* @return A boolean which indicates that x is normally distributed or not.
8484
*
8585
*/
86-
template <typename T = long double>
87-
bool jb_test(const std::vector<T> &x) {
86+
bool jb_test(const std::vector<long double> &x) {
8887
const unsigned long n = x.size();
89-
auto m1 = std::accumulate(x.begin(), x.end(), (T)0.0) / n;
88+
auto m1 = std::accumulate(x.begin(), x.end(), 0.0) / n;
9089
auto m2 = 0;
9190
auto m3 = 0;
9291
auto m4 = 0;
@@ -103,11 +102,7 @@ bool jb_test(const std::vector<T> &x) {
103102
auto K = m4 / std::pow(m2, 2);
104103
auto stat = n * (S / 6 + std::pow(K - 3, 2) / 24);
105104
auto p_val = 1 - pchisq(stat, 2);
106-
if (p_val > 0.05) {
107-
return true;
108-
} else {
109-
return false;
110-
}
105+
return p_val > 0.05;
111106
}
112107

113108
#endif // STATISTICS_H

0 commit comments

Comments
 (0)