Fits penalized linear mixed models that correct for unobserved confounding factors. 'plmmr' infers and corrects for the presence of unobserved confounding effects such as population stratification and environmental heterogeneity. It then fits a linear model via penalized maximum likelihood. Originally designed for the multivariate analysis of single nucleotide polymorphisms (SNPs) measured in a genome-wide association study (GWAS), 'plmmr' eliminates the need for subpopulation-specific analyses and post-analysis p-value adjustments. Functions for the appropriate processing of 'PLINK' files are also supplied. For examples, see the package homepage < https://pbreheny.github.io/plmmr/>.

The plmmr (penalized linear mixed models in R) package contains functions that fit penalized linear mixed models to correct for unobserved confounding effects.
Three small datasets ship with plmmr, and tutorials walking through how to analyze these data sets are documented in the plmmr website.
To install the latest version of the package from GitHub, use this:
devtools::install_github("pbreheny/plmmr")
You can also install plmmr from CRAN:
install.packages('plmmr')
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)
plmmr? And how well does it scale?These questions are addressed in our manuscript describing plmmr, along with its accompanying GitHub repository. However, 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.