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.
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.
Installation
You can install the development version from GitHub with:
Ziyatdinov et al., lme4qtl: linear mixed models with flexible
covariance structure for genetic studies of related individuals,
BMC Bioinformatics (2018)
Profile the variance components (h2) to get the 95% confidence intervals. The method functions profile and confint are implemented in lme4. Note that a different model m2 is used, because profiling is prone to errors/warnings if model fit is poor.
try(splom(prof))
#> Error in if (singfit) warning("splom is unreliable for singular fits") :
#> missing value where TRUE/FALSE needed
prof_clean <- na.omit(prof) # caution: NAs are indicators of poor fits
splom(prof_clean)
Fit a model with genetic and residual variances that differ by gender (sex-specificity model). The formula syntax with dummy (see ?lme4::dummy) is applied to the residual variance (1|RID) to cancel the residual correlation.
dat40 <- within(dat40, RID <- ID) # replicate ID
m4 <- relmatLmer(trait2 ~ SEX + (0 + SEX|ID) + (0 + dummy(SEX)|RID), dat40, relmat = list(ID = kin2))
VarCorr(m4)
#> Groups Name Std.Dev. Corr
#> ID SEX1 1.94400138
#> SEX2 2.64404940 0.826
#> RID dummy(SEX) 0.00050224
#> Residual 1.22780606
An example of parameter constraints that make the genetic variance between genders equal.
lme4qtl
lme4qtlextends the lme4 R package for quantitative trait locus (qtl) mapping. It is all about the covariance structure of random effects.lme4qtlsupports user-defined matrices for that, e.g. kinship or IBDs.See slides bit.ly/1UiTZvQ introducing the
lme4qtlR package or read our article / preprint.lm(myTrait ~ myCovariate, myData)lmer(myTrait ~ myCovariate + (1|myID), myData)relmatLmer(myTrait ~ myCovariate + (1|myID), myData, relmat = list(myID = myMatrix))glm(myStatus ~ 1, myData, family = binomial)glmer(myStatus ~ (1|myID), myData, family = binomial)relmatGlmer(myStatus ~ (1|myID), myData, relmat = list(myID = myMatrix), family = binomial)Note that rownames/colnames of
myMatrixhave to be values ofmyIDvariable, so matching between relationship matrix and grouping variable is possible. The order doesn’t matter.Installation
You can install the development version from GitHub with:
The official release on CRAN is pending.
Citation
To cite the
lme4qtlpackage in publications use:Contact
You are welcome to submit suggestions and bug-reports at https://github.com/variani/lme4qtl/issues.
Example
Load simulated data, phenotypes
dat40and the kinship matrixkin2.Fit a model for continuous trait with two random effects, family-grouping
(1|FAM)and additive genetic(1|ID).Get a point estimate of heritability (h2), the proportion of variance explained by
(1|ID).Profile the variance components (h2) to get the 95% confidence intervals. The method functions
profileandconfintare implemented in lme4. Note that a different modelm2is used, because profiling is prone to errors/warnings if model fit is poor.Fit a model with genetic and residual variances that differ by gender (sex-specificity model). The formula syntax with
dummy(see?lme4::dummy) is applied to the residual variance(1|RID)to cancel the residual correlation.An example of parameter constraints that make the genetic variance between genders equal.
Another example of parameter constraint that implies the genetic correlation between genders equal to 1.
Fit a model for binary trait.