Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

snp_simuPheno

Simulate phenotypes


Description

Simulate phenotypes using a linear model. When a prevalence is given, the liability threshold is used to convert liabilities to a binary outcome. The genetic and environmental liabilities are scaled such that the variance of the genetic liability is exactly equal to the requested heritability, and the variance of the total liability is equal to 1.

Usage

snp_simuPheno(
  G,
  h2,
  M,
  K = NULL,
  ind.row = rows_along(G),
  ind.possible = cols_along(G),
  effects.dist = c("gaussian", "laplace"),
  ncores = 1
)

Arguments

G

A FBM.code256 (typically <bigSNP>$genotypes).
You shouldn't have missing values. Also, remember to do quality control, e.g. some algorithms in this package won't work if you use SNPs with 0 MAF.

h2

Heritability.

M

Number of causal variants.

K

Prevalence. Default is NULL, giving a continuous trait.

ind.row

An optional vector of the row indices (individuals) that are used. If not specified, all rows are used.
Don't use negative indices.

ind.possible

Indices of possible causal variants.

effects.dist

Distribution of effects. Either "gaussian" (the default) or "laplace".

ncores

Number of cores used. Default doesn't use parallelism. You may use nb_cores.

Value

A list with 3 elements:

  • $pheno: vector of phenotypes,

  • $set: indices of causal variants,

  • $effects: effect sizes (of scaled genotypes) corresponding to set.


bigsnpr

Analysis of Massive SNP Arrays

v1.10.8
GPL-3
Authors
Florian Privé [aut, cre], Michael Blum [ths], Hugues Aschard [ths], Bjarni Jóhann Vilhjálmsson [ths]
Initial release
2022-07-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.