# Possible incorrect linreg aggregator results in 0.2.29 - 0.2.37

**URL:** <https://discuss.hail.is/t/possible-incorrect-linreg-aggregator-results-in-0-2-29-0-2-37/1375>\
**Category:** Updates\
**Created:** [April 17, 2020, 8:26pm UTC](https://discuss.hail.is/t/possible-incorrect-linreg-aggregator-results-in-0-2-29-0-2-37/1375 "2020-04-17T20:26:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrick-schultz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/patrick-schultz/32/265_2.png) [@patrick-schultz](https://discuss.hail.is/u/patrick-schultz)\
**Post date:** [April 17, 2020, 8:26pm UTC](https://discuss.hail.is/t/possible-incorrect-linreg-aggregator-results-in-0-2-29-0-2-37/1375/1 "2020-04-17T20:26:16Z")

</div>

We just fixed a bug in the linreg aggregator that has existed since release 0.2.29, and which will be fixed in 0.2.38. (It is fixed by [this PR](https://github.com/hail-is/hail/pull/8575), which will merge into master shortly.)

First off, any regressions containing at most 8 covariates (including the intercept), and where the intercept is first in the list of covariates, are not affected by this bug. E.g. `hl.agg.linreg(mt.y, [1, mt.x])` is safe.

If the list of covariates is `[x0, x1, ...]`, then the bug causes rows to be included in the regression even if `x0`, or any of `x8, x9, ...`, are missing. In this case uninitialized memory will be used for the values of the missing covariates, which could be any value.

In regressions with more than 32 covariates, this bug only affects the tail of the list. Specifically, if there are `k` covariates, the last `k % 32` (the remainder after dividing by 32) are affected. If any covariates outside that tail are missing, the row will be correctly skipped.

This is a subtle and concerning bug. If you have any questions about whether any of your pipelines have been affected by this, please don’t hesitate to ask.

---

<div class="post-metadata">

**Author:** ![patrick-schultz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/patrick-schultz/32/265_2.png) [@patrick-schultz](https://discuss.hail.is/u/patrick-schultz)\
**Post date:** [April 17, 2020, 8:27pm UTC](https://discuss.hail.is/t/possible-incorrect-linreg-aggregator-results-in-0-2-29-0-2-37/1375/2 "2020-04-17T20:27:22Z")

</div>



---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [April 17, 2020, 8:37pm UTC](https://discuss.hail.is/t/possible-incorrect-linreg-aggregator-results-in-0-2-29-0-2-37/1375/3 "2020-04-17T20:37:05Z")

</div>

Note that `linear_regression_rows` is **not** affected by this bug.

Also note that this is also likely to result in type 1 error (p-values closer to 1 than the truth) rather than type 2 error (spurious small p-values).
