Skip to contents

plmmr

The plmmr (penalized linear mixed models in R) package contains functions that fit penalized linear mixed models to correct for unobserved confounding effects.

Installation

To install the latest version of the package from GitHub, use this:

devtools::install_github("pbreheny/plmmr")

You can also install plmmr from CRAN:

For a description of the motivation of the functions in this package (along with examples) refer to the second module of this GWAS data tutorial

Minimal example

library(plmmr)
X <- rnorm(100*20) |> matrix(100, 20)
y <- rnorm(100)
fit <- plmm(X, y) 
plot(fit)

cvfit <- cv_plmm(X, y)
plot(cvfit)
summary(cvfit)

So how fast is plmmr? And how well does it scale?

To illustrate these important questions, I created a separate GitHub repository that has all the scripts for a plmmr workflow using publicly-available genome-wide association (GWAS) data. The main takeaway: using GWAS data from a study with 1,400 samples and 800,000 SNPs, a full plmmr analysis will run in about half an hour using a single core on a laptop.

Three smaller datasets ship with plmmr, and tutorials walking through how to analyze these data sets are documented in the documentation site. While these datasets are useful for didactic purposes, they are not large enough to really highlight the computational scalability of plmmr – this is what motivated the creation of the separate repository for a GWAS workflow.

Note on branches

The branches of this repo are organized in the following way:

  • master is the main (or ‘head’) branch.

  • gh_pages is where we are keeping all the documentation for plmmr

  • gwas_scale is an archived branch that contains the development version of the package I used to run my dissertation analysis. Will delete this eventually.