# Broadcasting a function that returns a tuple

**URL:** <https://discourse.julialang.org/t/broadcasting-a-function-that-returns-a-tuple/61064>\
**Category:** New to Julia\
**Tags:** broadcast\
**Created:** [May 13, 2021, 7:34am UTC](https://discourse.julialang.org/t/broadcasting-a-function-that-returns-a-tuple/61064 "2021-05-13T07:34:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alessio](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@alessio](https://discourse.julialang.org/u/alessio)\
**Post date:** [May 13, 2021, 7:34am UTC](https://discourse.julialang.org/t/broadcasting-a-function-that-returns-a-tuple/61064/1 "2021-05-13T07:34:30Z")

</div>

I would like to broadcast the `JarqueBeraTest` from package `HypothesisTests`.

Without broadcasting I can do something like:

```julia

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

JarqueBeraTest(randn(10))

```

and I get something like:

```julia
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
julia> JarqueBeraTest(randn(100)).JB
0.2599956595349544

```

I would like to broadcast it:

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

```

but I’m not sure how to get only the JB statistic.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [May 13, 2021, 7:37am UTC](https://discourse.julialang.org/t/broadcasting-a-function-that-returns-a-tuple/61064/2 "2021-05-13T07:37:22Z")

</div>

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

```
