# Odd slight perturbation in HypothesisTests

**URL:** <https://discourse.julialang.org/t/odd-slight-perturbation-in-hypothesistests/17582>\
**Category:** Statistics\
**Created:** [November 16, 2018, 12:21am UTC](https://discourse.julialang.org/t/odd-slight-perturbation-in-hypothesistests/17582 "2018-11-16T00:21:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Post date:** [November 16, 2018, 12:21am UTC](https://discourse.julialang.org/t/odd-slight-perturbation-in-hypothesistests/17582/1 "2018-11-16T00:21:03Z")

</div>

```julia
julia> using HypothesisTests, Random;

julia> Random.seed!(0); x= randn(100); y= randn(100);

julia> OneSampleTTest(x,y)

```

the point estimate is slightly unstable. it may output one of the two:

```julia
     point estimate: 0.121977870355099
     point estimate: 0.12197787035509895

```

is this indeterminacy a buglet? can HT be forced to lower and perfect precision?

/iaw

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [November 16, 2018, 7:18am UTC](https://discourse.julialang.org/t/odd-slight-perturbation-in-hypothesistests/17582/2 "2018-11-16T07:18:49Z")

</div>

> [@iwelch](#):
>
> the point estimate is slightly unstable

Are the `x` and `y` the same (`==`) otherwise?

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andreasnoack/32/27_2.png) [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)\
**Post date:** [November 16, 2018, 8:27am UTC](https://discourse.julialang.org/t/odd-slight-perturbation-in-hypothesistests/17582/3 "2018-11-16T08:27:00Z")

</div>

Do you get the two different results on the same machine or does it only vary across machines? The latter can happen if the two machines have different instruction sets as the order of operations can then vary. May I ask why this is a concern? The difference doesn’t have any practical implications for a statistical computation.

---

<div class="post-metadata">

**Author:** ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Post date:** [November 16, 2018, 3:20pm UTC](https://discourse.julialang.org/t/odd-slight-perturbation-in-hypothesistests/17582/4 "2018-11-16T15:20:43Z")

</div>

same machine. presumably same x and y, after a seed init. always a new julia command line start, with nothing else invoked earlier…

I stumbled onto this, because my cookbook has an automatic checker, which confirms that the results are still the same. when it tripped, I changed the output, ran again. after a few more such checks, it triggered again.

it’s a nuisance, not a problem. nevertheless, it would be nice to have determinate output. one way to solve this nuisance is to round the output to something that is not so near machine precision. like 5 significant digits.

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andreasnoack/32/27_2.png) [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)\
**Post date:** [November 16, 2018, 3:33pm UTC](https://discourse.julialang.org/t/odd-slight-perturbation-in-hypothesistests/17582/5 "2018-11-16T15:33:08Z")

</div>

Where does the checker for the Cookbook run? Couldn’t it be the case that different cloud instances are running it?

---

<div class="post-metadata">

**Author:** ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Post date:** [November 16, 2018, 3:42pm UTC](https://discourse.julialang.org/t/odd-slight-perturbation-in-hypothesistests/17582/6 "2018-11-16T15:42:22Z")

</div>

nope. perfectly local. macos.
