Skip to content
Linear mixed models (@lme4) + custom covariances + restrictions on model parameters
Branch: master
Clone or download
Latest commit eff82da Mar 14, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
R Merge branch 'master' of Feb 14, 2019
data source code is public Jul 31, 2017
inst trying bivar model Jan 2, 2019
misc script for issue #12 Aug 22, 2018
tests lower thr Mar 14, 2019
.Rbuildignore misc/issues/01 Sep 15, 2017
.gitignore misc/issues/01 Sep 15, 2017
.travis.yml source code is public Jul 31, 2017
NAMESPACE exported varcov fun; added gwas demo May 31, 2018
NEWS added citation & ref. to article Mar 10, 2018

About lme4qtl

travis-ci build status

lme4qtl extends the lme4 R package for quantitative trait locus (qtl) mapping. It is all about the covariance structure of random effects. lme4qtl supports user-defined matrices for that, e.g. kinship or IBDs.

See slides introducing the lme4qtl R package or read our article / preprint.

Package Continuous response
stats lm(myTrait ~ myCovariate, myData)
lme4 lmer(myTrait ~ myCovariate + (1|myID), myData)
lme4qtl relmatLmer(myTrait ~ myCovariate + (1|myID), myData, relmat = list(myID = myMatrix))
Package Binary response
stats glm(myStatus ~ 1, myData, family = binomial)
lme4 glmer(myStatus ~ (1|myID), myData, family = binomial)
lme4qtl relmatGlmer(myStatus ~ (1|myID), myData, relmat = list(myID = myMatrix), family = binomial)

Note that rownames/colnames of myMatrix have to be values of myID variable, so matching between relationship matrix and grouping variable is possible. The order doesn't matter.

Quick start

library(lme4) # needed for `VarCorr` function

# load synthetic data set `dat40` distributed within `lme4qtl`
# - table of phenotypes `dat40`
# - the double kinship matrix `kin2`

# (1) model continiuous trait `trait1`
mod <- relmatLmer(trait1 ~ AGE + SEX + (1|FAMID) + (1|ID), dat40, relmat = list(ID = kin2))

# get the estimation of h2
(vf <-[, c("grp", "vcov")])
#       grp      vcov
#1       ID 5.2845001
#2    FAMID 0.0000000
#3 Residual 0.6172059

prop <- with(vf, vcov / sum(vcov))

(h2 <- prop[1]) 
#[1] `0.895419`

# (2) model binary trait `trait1bin`
gmod <- relmatGlmer(trait1bin ~ (1|ID), dat40, relmat = list(ID = kin2), family = binomial)


# install.packages("devtools")


To cite the lme4qtl package in publications use:

  Ziyatdinov et al., lme4qtl: linear mixed models with flexible
  covariance structure for genetic studies of related individuals, 
  BMC Bioinformatics (2018)


You are welcome to submit suggestions and bug-reports at

You can’t perform that action at this time.