Skip to contents

Simulate Genotype and Phenotype Data

Usage

gsim(Glist = NULL, chr = 1, nt = 1, W = NULL, n = 1000, m = 1000, rsids = NULL)

Arguments

Glist

A list of information about the genotype matrix. Default is `NULL`.

chr

The chromosome(s) being used in the simulation. Default is 1.

nt

Number of traits. Default is 1.

W

Matrix of centered and scaled genotypes. Default is `NULL`.

n

Number of individuals. Default is 1000.

m

Number of markers. Default is 1000.

rsids

A character vector of rsids. Default is `NULL`.

Value

A list containing:

  • y: Phenotypes.

  • W: Matrix of centered and scaled genotypes.

  • e: Errors.

  • g: Genotype effect.

  • b0, b1: Coefficients.

  • set0, set1: Selected markers.

  • causal: Causal markers.

Details

This function simulates genotype and phenotype data based on the `Glist`, which is information about the genotype matrix.

Author

Peter Soerensen

Examples

## Plink bed/bim/fam files
bedfiles <- system.file("extdata", paste0("sample_chr",1:2,".bed"), package = "qgg")
bimfiles <- system.file("extdata", paste0("sample_chr",1:2,".bim"), package = "qgg")
famfiles <- system.file("extdata", paste0("sample_chr",1:2,".fam"), package = "qgg")

# Summarize bed/bim/fam files
Glist <- gprep(study="Example", bedfiles=bedfiles, bimfiles=bimfiles, famfiles=famfiles)

# Simulate phenotype
sim <- gsim(Glist=Glist, chr=1, nt=1)
head(sim$y)
head(sim$e)
head(sim$causal)