data.simu.null: Data simulation (null model & multiple SNPs)

Description Usage Arguments Value Examples

View source: R/data-simu.R

Description

Simulate a dataset which includes genotypes, covariates and phenotypes.

Usage

1
2
data.simu.null(N, nSNP, nCov, maf, prev, TypeOfCov = NULL,
  CoefOfCov = NULL)

Arguments

N

a numeric value: number of samples

nSNP

a numeric value: number of SNPs

nCov

a numeric value: number of covariates

maf

a numeric value or a numeric vector of length nSNP: minor allele frequencies to simulate genotypes. It should be between 0 and 0.5.

prev

a numeric value: the expected proportion of cases among all samples. It should be between 0 and 1.

TypeOfCov

a character vector of length nCOV to specify the covariates types: "binary" ~ Bernoulli(0.5), "continuous" ~ Normal(0,1). Default value is NULL, that is, 'rep(c("binary","continous"), length.out=nCov)'.

CoefOfCov

a numeric vector of length nCOV to specify the covariates coefficients. Default value is NULL, that is, 'rep(0.5, length.out=nCov)'.

Value

an R list including the following elements

Phen.mtx

an R matrix (N * nCov+1) of phenotype and covariates

Geno.mtx

an R matrix (N * nSNP) of genotypes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Specify all arguments
N = 10000;
nSNP = 100
nCov = 2
maf = 0.05;  # OR maf = runif(nSNP, 0, 0.5)
prev = 0.01;
# Data simulation process
Data.ls = data.simu.null(N, nSNP, nCov, maf, prev)
Data.ls$Phen.mtx[1:10,]
Data.ls$Geno.mtx[1:10,1:10]

WenjianBI/SPAGE documentation built on Nov. 13, 2020, 12:15 p.m.