Broadcasting a function that returns a tuple

I would like to broadcast the JarqueBeraTest from package HypothesisTests.

Without broadcasting I can do something like:


Pkg.add(["HypothesisTests"]);
using HypothesisTests

JarqueBeraTest(randn(10))

and I get something like:

Jarque-Bera normality test
--------------------------
Population details:
   parameter of interest:   skewness and kurtosis
   value under h_0:         "0 and 3"
   point estimate:          "-0.1757467150052452 and 1.7292443390356877"

Test summary:
   outcome with 95% confidence: fail to reject h_0
   one-sided p-value:           0.6962

Details:
   number of observations:         10
   JB statistic:                   0.72432

The JB statistic can be accessed with the JB field:

julia> JarqueBeraTest(randn(100)).JB
0.2599956595349544

I would like to broadcast it:

JarqueBeraTest.(eachcol(randn(100,2)))

but Iā€™m not sure how to get only the JB statistic.

julia> getproperty.(JarqueBeraTest.(eachcol(randn(100, 2))), :JB)
2-element Vector{Float64}:
 0.168110113932257
 0.8031357925003382
2 Likes