LFMM can be used for screening genomes for signatures of environmental adaptation in genomes (but it can be used for other types of GWAS). LFMM estimates confounders when identifying genetic polymorphisms that exhibit correlation with environmental gradients or other variables like phenotypic traits. The confounders - or latent factors - are then included in a statistical model for testing association between genotypes and the variable of interest.
The original method implements latent factor mixed models based on a Bayesian bootstrap approach (C program LFMM 1.5 and R package LEA). The most recent implementation of LFMM is based on least squares estimates (R package lfmm). The "lfmm" R package is faster for larger data sets and it is sometimes more accurate than the Bayesian version.
The LFMM program is available in the R packages lfmm (recommended for larger data sets) and LEA.