Description Usage Arguments Value See Also Examples
This is the main function of the waffect package. Given a vector (matrix) of probabilities and the desired total number of cases and controls (resp.: individuals in each class) waffect
outputs a simulated phenotypic dataset.
1 | waffect(prob, count, label, method, burnin)
|
prob |
a vector of probabilities corresponding to the disease model H1: the i-th entry is the probability that the i-th individual is a case. Alternatively, a matrix with k rows and n columns where K = number of classes and n = total number of individuals. In this case, the entry in the k-th row and j-th column is the probability that the phenotype of the j-th individual is in the k-th class. If |
count |
either an integer (the total number of cases), or a vector of length two (number of cases and number of controls), or, in the multiclass case, a vector of length greater or equal than 3 (number of individuals in each class). |
label |
a list with either the labels for cases and controls or, in the multiclass case, the codes for each class. In the binary case the first entry must be the label for cases. By default |
method |
the method to be implemented for the simulation. Three methods are available: |
burnin |
the burn-in step if method is |
|
A list of phenotypes coded by the entries in |
Package documentation: waffect-package
. Useful information can be also found in the vignette: vignette("waffect-tutorial")
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## Not run: Typical usage to simulate case/control phenotypes under H1 (in this example: 12 individuals, 7 cases, 5 controls, the probability that individual 1 is a case is 0.2...):
waffect(prob = c(0.2, 0.4, 0.9, 0.6, 0.9, 0.1, 0.4, 0.6, 0.6, 0.3, 0.8, 0.1), count=c(7,5), label=c(1,0))
## Not run: By rerunning the command we obtain another simulation:
waffect(prob = c(0.2, 0.4, 0.9, 0.6, 0.9, 0.1, 0.4, 0.6, 0.6, 0.3, 0.8, 0.1), count=c(7,5), label=c(1,0))
## Not run: We can just specify the number of cases:
waffect(prob = c(0.2, 0.4, 0.9, 0.6, 0.9, 0.1, 0.4, 0.6, 0.6, 0.3, 0.8, 0.1), count=7, label=c(1,0))
## Not run: It is possible to change the default code for cases and controls:
pi <- runif(100)
waffect(prob = pi, c(50,50), label = c("case","control"))
## Not run: If prob is not specified then a constant vector of probabilities is assumed by default. This is equivalent to simulate phenotypes under the null hypothesis H0:
waffect(count = c(20,30), label=c(1,0))
## Not run: Example with 6 individuals and 3 classes:
pi1 = c(0.3,0.4,0.3)
pi2 = c(0.3,0.5,0.2)
pi3 = c(0.1,0.2,0.7)
pi4 = c(0.1,0.6,0.3)
pi5 = c(0.1,0.7,0.2)
pi6 = c(0.4,0.1,0.5)
pi = cbind(pi1,pi2,pi3,pi4,pi5,pi6)
waffect(prob = pi, count = c(1,2,3))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.