Description Usage Arguments Value Author(s) See Also Examples
View source: R/simulate_pheno.R
This function creates confounding factors based on genotypes. Those factors may be included in the simulation of phenotypes.
1 | create_factor(genotype, K)
|
genotype |
an n by p matrix of genotypes where n is the number of individuals (rows) and p is the number of SNPs (columns). |
K |
an integer for the number of confounders. |
A list
containing K factors, an estimate of residual error, and an estimate of
the order of effects.
factors a n by K matrix of confounders corresponding to the first K unscaled principal components of the genotype matrix.
sigma standard deviation for residual errors.
base order of magnitude for baseline effects.
Olivier François
1 2 3 4 5 6 7 8 | library(naturalgwas)
## Load A. thaliana example
data(A.thaliana)
confounder <- create_factor(A.thaliana$genotype, K = 20)
plot(confounder$factors)
cat("Residual error = ", confounder$sigma, "\n")
cat("Base effect = ", confounder$base, "\n")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.