knitr::opts_chunk$set(echo = TRUE)
library(LTFHPlus) library(dplyr) library(stringr) library(future.apply)
With version 2.0, updates have been made to the input and the functions available to estimate the (genetic) liability. Previously, a list entry format with a set order was expected, where the proband was first, then followed by father, mother, and any siblings. This limited analysis to only the immediate family, but if information on, e.g. half-siblings, grandparents etc, was available, it could not be readily used. Now the input does not require a set ordering, but instead the user is expected to provide information on the familial relation to the proband, e.g. mother, paternal half-sibling, etc. This allows for far more flexibility for the user to include the familial information that is available.
The function used to estimate the genetic (or full liability) of an individual is estimate_liability
. The family input is input through .tbl
, which is a long format where each row is an individual. A role must accompany each individual. The family relationship to the proband has its own column.
From simulate_under_LTM
an example of the full input data can be seen. It returns a list, first entry is sim_obs
, and contains all the underlying liabilities, status, and age of onset or age for controls. The second entry is called thresholds
and it contains a family ID, individual ID, family relationship to the proband, and a lower and upper threshold for each individual. The following example simulates a family with the index person, a mother, a father, and a single sibling. Other family members can also be used. See the documentation for simulate_under_LTM()
for more information.
sims <- simulate_under_LTM(fam_vec = c("m","f","s1"), n_fam = NULL, add_ind = TRUE, h2 = 0.5, n_sim = 10, pop_prev = .05) sims$sim_obs sims$thresholds
We construct the covariance matrix for each family being analysed during run-time. The covariance function that is used internally in estimate_liability
has been updated to allow for a higher degree of flexibility. This means it is up to the user to provide the familial relationship, and construct_covmat
creates the corresponding covariance matrix based on the heritability and expected genetic overlap between two individuals.
construct_covmat
defaults to a family structure with both parents, one sibling, and the paternal and maternal grandparents. The input format for construct_covmat
can be specified in two different ways, either fam_vec
(the method used internally in estimate_liability
) or with n_fam
. For fam_vec
a vector of strings from the list of possible familial relationships must be provided For the full list, please see documentation for construct_covmat
. Family members will then appear in the covariance matrix in the same order as they appear in fam_vec
. For n_fam
a named vector is provided, where the names of the named vector corresponding to the familial relationship and the values of the vector corresponds to how often that particular familial role appears.
In order to illustrate the different possible families, we will provide some examples. If no family information is available, but the age of onset information is still available, we can use the simplest covariance, which only contains the genetic and full liability of the index person:
# no family members construct_covmat(fam_vec = NULL, n_fam = NULL, h2 = .5)
The default family contains the index person as well as a father, mother, one sibling, both maternal and paternal grandparents.
construct_covmat()
With only a mother and a father
construct_covmat(fam_vec = c("m", "f"), h2 = .5)
In this example, we illustrate the covariance accounting for family members on either the mother's or father's side. Assuming there is no genetic overlap between the two sides of the family.
construct_covmat(fam_vec = c("f", "m", "mgm", "pgm", "mhs1", "phs1", "mau", "pau"), h2 = .5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.