Skip to contents

This function estimates the genetic liability for a subject given the configuration of each familiy members phenotype. The the phenotype is given by either a 0 or 1 indicating if the family member has the trait/sickness. The function uses Monte Carlo integration to estimate the conditional distribution.

Usage

gibbs_sampl(
  covmat,
  phenos,
  K = 0.05,
  s_val = 0,
  start_run = 500,
  all_est = FALSE
)

Arguments

covmat

The covariance matrix.

phenos

A binary vector containing the phenotype for each family member of the form c(p_subject, p_parent1, p_parent2, p_sibling1, ... ,p_siblingN) where p_familymember is a binary value (1 or 2).

K

The prevalance of trait. If False no truncation is applied.

s_val

The starting value of liabilities.

start_run

Number of iterations before convergence is expected.

all_est

If TRUE return the value for each iteration after burn in, else return mean of values.

Value

A vector containing LTFH estimate of liabilities of the form c(genetic_liability_subject, liability_subject, liability_parent1, liability_parent2, liability_sibling1, ..., liability_siblingN).

Examples

gibbs_sampl(get_cov(0.5, n_sib = 1), c(1, 1, 0, 0))
#> [1] 1.2026603 2.0987129 2.1080438 0.1757779 0.4865048