Learn R Programming

waffect (version 1.2)

waffect-package: A package to simulate constrained phenotypes under a disease model H1

Description

waffect (pronounced 'double-u affect' for 'weighted affectation') is a package to simulate phenotypic (case or control) datasets under a disease model H1 such that the total number of cases is constant across all the simulations (the constrain in the title). The package also makes it possible to generate phenotypes in the case of more than two classes, so that the number of phenotypes belonging to each class is constant across all the simulations. waffect is used to assess empirically the statistical power of Genome Wide Association studies without generating genotypes for each simulation. The vignette includes a tutorial for performing such power studies.

Arguments

Installing and Using

To install this package, make sure you are connected to the Internet and issue the following command in the R prompt: install.packages("waffect") To load the package in R: library(waffect) To open the .pdf file of the vignette: vignette("waffect-tutorial")

Citation

If you use waffect in published research, please cite the companion article: Perduca V, Sinoquet C, Mourad R, Nuel G: Alternative Methods for H1 Simulations in Genome-Wide Association Studies. Hum Hered 2012;73:95-104. Type citation("waffect") for a BibTeX entry. The authors would be glad to hear how waffect is employed. You are kindly encouraged to notify Gregory Nuel gregory.nuel@parisdescartes.fr and Vittorio Perduca vittorio.perduca@parisdescartes.fr about any work you publish that makes use of waffect.

Functions

waffect
high level function for simulating phenotypes in the binary (case/control) and mulitclass cases
waffectbin
low level function for simulating phenotypes in the binary case (not documented)

Datasets

This package comes with two datasets to be used for the fictive GWAs power analysis outlined in the vignette:
ped
genotypic dataset in .ped format
map
file in .map format describing the SNPs in the ped file
The signals of association to be used in the fictive GWAs power analysis are also included:
p1_H0
Signal of association of the statistic S1 under H0
p1_H1
Signal of association of the statistic S1 under H1
p2_H0
Signal of association of the statistic S2 under H0
p2_H1
Signal of association of the statistic S2 under H1

Details

waffect implements three alternative methods to simulate phenotypes with a fixed number of cases and controls and under a given disease model: i) an exact and efficient backward sampling algorithm; ii) a numerical Markov Chain Monte-Carlo (MCMC) approach; iii) a simple rejection algorithm. The backward algorithm is the default method. The rejection algorithm is deprecated. More details can be found in the companion article [1].

References

[1] Perduca V, Sinoquet C, Mourad R, Nuel G: Alternative Methods for H1 Simulations in Genome-Wide Association Studies. Hum Hered 2012;73:95-104

See Also

Documentation for the function waffect. Useful information can be also found in the vignette: vignette("waffect-tutorial").

Examples

Run this code
## Not run: Typical usage to simulate case/control phenotypes under H1 (in this example: 5 individuals, 2 cases, 3 controls, the probability that individual 1 is a case is 0.5...):
waffect(prob =  c(0.5, 0.2, 0.9, 0.7, 0.1), count = c(2,3), label = c(1,0))

## Not run: We can just specify the number of cases:
waffect(prob =  c(0.5, 0.2, 0.9, 0.7, 0.1), count = 2, label = c(1,0))

## Not run: We can change the labels:
waffect(prob =  c(0.5, 0.2, 0.9, 0.7, 0.1), count = 2, label = c("case", "control"))

## Not run: We can also simulate under H0 just entering the number of cases and controls:
waffect(count=c(2,3), label = c(1,0))

## Not run: Simulation of phenotypes in the multiclass case (in this example: 4 individuals and  3 classes, 1 individual in class 1, 2 individuals in class 2, 1 individual in class 3):
pi = cbind(c(0.5,0.3,0.2), c(0.2,0.2,0.6), c(0.1,0.7,0.2), c(0.4,0.3,0.3))
waffect(prob =  pi, count = c(1,2,1), label = 1:3)

Run the code above in your browser using DataLab