knitr::opts_chunk$set(
  comment = ""
)
devtools::load_all()
options(width = 100)

FamModel

R-CMD-check

This package implements regression models for family-based genetic studies, including mixed models. While such models can be fit with other existing software, this package tries to provide a unified solution that leverages the flexibility of the R environment. It also leverages modern automatic differentiation techniques to fit likelihood-based models quickly.

Installation

You can install the latest released version of FamModel from GitHub with:

# install.packages("devtools")
devtools::install_github("kinnamon-lab/FamModel", ref = "[tag]")

where [tag] is the tag of the most recent release.

Example

The following code fits a univariate version of the linear mixed model presented in Cowan et al. (2018) with an equivalent parameterization using the lmna_nonseg example data provided with the package. Note how the package permits flexible use of formula constructs and provides an appropriate likelihood ratio test for a null narrow-sense heritability on the boundary of the parameter space.

lmna_data <- copy(lmna_nonseg)[,
  `:=`(
    female = as.integer(sex == 2),
    # Use N rather than N-1 for SD divisor in standardization (like Mendel 16.0)
    age_echo_std = (age_echo_yrs - mean(age_echo_yrs, na.rm = TRUE)) /
      (
        sd(age_echo_yrs, na.rm = TRUE) *
          sqrt((sum(!is.na(age_echo_yrs)) - 1) / sum(!is.na(age_echo_yrs)))
      )
  )
]
lmna_fd <- FamData$new(
  lmna_data,
  family_id = "family_ID",
  indiv_id = "individual_ID",
  proband = "proband",
  sex = "sex",
  maternal_id = "maternal_ID",
  paternal_id = "paternal_ID",
  mzgrp = "mzpair",
  dzgrp = "dzpair"
)
lmna_lvef_model <- lmna_fd$lmm(
  lvef ~ female + age_echo_std + I(n_lmna_vars > 0) + I(n_oth_vars > 0)
)
lmna_lvef_model$print()

Acknowledgements

Development of this software was supported by the National Heart, Lung, and Blood Institute and National Human Genome Research Institute of the National Institutes of Health under award numbers R01HL128857 and R01HL149423. The content is solely the responsibility of the author and does not necessarily represent the official views of the National Institutes of Health.



kinnamon-lab/FamMix documentation built on April 23, 2021, 2:03 p.m.