The test statistic is $$BHEP_{n,\beta}=\frac{1}{n} \sum_{j,k=1}^n \exp\left(-\frac{\beta^2\|Y_{n,j}-Y_{n,k}\|^2}{2}\right)- \frac{2}{(1+\beta^2)^{d/2}} \sum_{j=1}^n \exp\left(- \frac{\beta^2\|Y_{n,j}\|^2}{2(1+\beta^2)} \right) + \frac{n}{(1+2\beta^2)^{d/2}}.$$
Here, \(Y_{n,j}=S_n^{-1/2}(X_j-\overline{X}_n)\), \(j=1,\ldots,n\), are the scaled residuals, \(\overline{X}_n\) is the sample mean and \(S_n\) is the sample covariance matrix of the random vectors \(X_1,\ldots,X_n\). To ensure that the computation works properly
\(n \ge d+1\) is needed. If that is not the case the function returns an error.