create_factor: Generates confounders.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/simulate_pheno.R

Description

This function creates confounding factors based on genotypes. Those factors may be included in the simulation of phenotypes.

Usage

1
create_factor(genotype, K)

Arguments

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.

Value

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.

Author(s)

Olivier François

See Also

simu_pheno

Examples

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")

bcm-uga/NaturalGWAS documentation built on Dec. 18, 2019, 12:36 a.m.