# Hl.agg.linreg() output question

**URL:** <https://discuss.hail.is/t/hl-agg-linreg-output-question/1528>\
**Category:** Hail Query & hailctl\
**Created:** [July 13, 2020, 10:41pm UTC](https://discuss.hail.is/t/hl-agg-linreg-output-question/1528 "2020-07-13T22:41:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![EZXYZ](https://avatars.discourse-cdn.com/v4/letter/e/13edae/32.png) [@EZXYZ](https://discuss.hail.is/u/EZXYZ)\
**Post date:** [July 13, 2020, 10:41pm UTC](https://discuss.hail.is/t/hl-agg-linreg-output-question/1528/1 "2020-07-13T22:41:53Z")

</div>

Hi there,

I know that this might be a stupid question, but when I used hl.agg.linreg() to run GWAS on alternative allele and a set of covariates, I’m not sure about which element in the output array corresponds to the alternative allele. Specifically, I used the following code to run GWAS:

mt = mt.annotate\_rows(gwas=hl.agg.linreg(mt.quant\_pheno,  
[1, mt.covar.isMale, mt.covar.YEAR, mt.covar.isAxiom,  
mt.covar.PC1, mt.covar.PC2, mt.covar.PC3, mt.covar.PC4,  
mt.covar.PC5, mt.covar.PC6, mt.covar.PC7, mt.covar.PC8,  
mt.covar.PC9, mt.covar.PC10, mt.GT.n\_alt\_alleles()]))

For each SNP in the summary statistics, the effect size, se, and p-value estimates are all stored in an array with 15 elements. In this case, I wonder which element in the array corresponds to the estimated coefficient for alternative allele? Thank you very much!

---

<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:** [July 15, 2020, 1:12am UTC](https://discuss.hail.is/t/hl-agg-linreg-output-question/1528/2 "2020-07-15T01:12:11Z")

</div>

The betas (and every other array) are in the same order as the independent variables – in this case, the beta on GT.n\_alt\_alleles() is in the last position, which you can access with `betas[-1]`.

You also might prefer to run `hl.linear_regression_rows `– it’s faster and makes the simple GWAS case a little easier.

---

<div class="post-metadata">

**Author:** ![EZXYZ](https://avatars.discourse-cdn.com/v4/letter/e/13edae/32.png) [@EZXYZ](https://discuss.hail.is/u/EZXYZ)\
**Post date:** [July 16, 2020, 8:02pm UTC](https://discuss.hail.is/t/hl-agg-linreg-output-question/1528/4 "2020-07-16T20:02:22Z")

</div>

Sounds good, thank you very much!
