# LinearMixedModel

**URL:** <https://discuss.hail.is/t/linearmixedmodel/1565>\
**Category:** Hail Query & hailctl\
**Created:** [July 31, 2020, 9:11pm UTC](https://discuss.hail.is/t/linearmixedmodel/1565 "2020-07-31T21:11:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![acererak](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@acererak](https://discuss.hail.is/u/acererak)\
**Post date:** [July 31, 2020, 9:11pm UTC](https://discuss.hail.is/t/linearmixedmodel/1565/1 "2020-07-31T21:11:23Z")

</div>

Now that I have my basic GWAS workflow sorted out I was looking more into the LinearMixedModel functionality. I know the documentation mentions this functionality is experimental.

I was wondering if other users have gotten a LinearMixedModel to work, and if not, if this is something dev’s are looking into? Would be great to have functionality so I can more directly compare to Bolt-LMM, say if a collaborator is using LMM and we want to do a meta-analysis!

Right now I try running:

```auto
lmm, _ = hl.linear_mixed_model(
    y=mt.pheno.trait,
    x=[1.0, mt.pheno.cov1, mt.pheno.cov2, mt.pheno.cov3],
    z_t=mt.GT.n_alt_alleles(), 
    p_path=bucket+p_fname)

```

which just seems to keep running without an end in sight. Have tried running it for 4+ hours.

Any tips? Or is this functionality not a current priority in Hail’s feature set?

---

<div class="post-metadata">

**Author:** ![kumarveerapen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/kumarveerapen/32/355_2.png) [@kumarveerapen](https://discuss.hail.is/u/kumarveerapen)\
**Post date:** [August 7, 2020, 2:04am UTC](https://discuss.hail.is/t/linearmixedmodel/1565/2 "2020-08-07T02:04:15Z")

</div>

Thank you for your question.

Perhaps to get us moving along, I wonder what is the size of your dataset? I am assuming that `trait` is a binary trait? And have you tried with 1 covariate at a time and noticed the time shorten?

As for whether this is a priority or not, I am tagging @johnc1231 who is working on linear algebra applications in Hail. He may be able to shed more light on this too!

---

<div class="post-metadata">

**Author:** ![johnc1231](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/johnc1231/32/286_2.png) [@johnc1231](https://discuss.hail.is/u/johnc1231)\
**Post date:** [August 7, 2020, 2:09pm UTC](https://discuss.hail.is/t/linearmixedmodel/1565/3 "2020-08-07T14:09:13Z")

</div>

Linear Mixed Model should work, but it’s not widely used / not very performant. People have mostly been using SAIGE to run their LMMs from what I understand. At some point we will revisit this functionality, but currently it’s not on our near term roadmap.

---

<div class="post-metadata">

**Author:** ![acererak](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@acererak](https://discuss.hail.is/u/acererak)\
**Post date:** [August 7, 2020, 3:31pm UTC](https://discuss.hail.is/t/linearmixedmodel/1565/4 "2020-08-07T15:31:23Z")

</div>

@kumarveerapen the dataset is a large imputed genotype dataset with roughly 30k samples by 6mil variants. I have not tried 1 covariate at a time but will do so.

@johnc1231 indeed many of my colleagues use SAIGE or Bolt-LMM. I think having this functionality being performant in Hail would be a major benefit for those looking to pivot their whole workflow to Hail, but I understand there may be many priorities that may need to be addressed first. Thanks for your response!
