Description Usage Arguments Details Value Author(s) References See Also Examples
Simulates SNP data with genotypes coded by 0, 1 and 2 as well as a binary and a continuous covariate, together with case-control status specified by logistic regression.
1 2 | generateSNPs(n, gene.no, block.no, block.size, p.same,
p.different = NULL, p.minor, n.sample, SNPtoBETA)
|
n |
an integer specifying the number of observations (cases and controls with 1:1 match) that should be generated. |
gene.no |
an integer specifying the number of genes that should be generated. |
block.no |
an integer specifying the number of blocks per gene. |
block.size |
an integer specifying the number of SNPs per block. |
p.same |
either a numeric value specifying the probability for neighborhood SNPs within a block or a numeric vector of length |
p.different |
a numeric value specifying the probability for neighborhood blocks within a gene which is used if |
p.minor |
a vector of length |
n.sample |
an integer specifying the number of simulated subjects from which the observations (case-control status) |
SNPtoBETA |
a matrix of non-negative numeric values of dimension |
generateSNPs
generates a matrix consisting of n
observations,
snp.no=gene.no*block.no*block.size
SNPs with genotypes coded by 0, 1 and 2, two automatically generated covariates for adjustment or matching and the matchset numbers. The neighborhood probabilities for SNPs is given by p.different
and/or p.same
and the allele frequencies for SNPs is given by p.minor
. The allele frequencies (p.minor
) and the probabilities for neighborhood blocks (p.different
) and/or p.same
, respectively, can differ between the blocks on a gene but are repeated similar over all genes gene.no
. The simulated SNP data structure is similar as in Schwender et al. (2011).
The response is determined by a logistic regression model given the SNPs, the binary covariate and the continuous covariate in the sim.cov matrix:
P(Y=1|sim.cov)=exp(sim.cov*beta)/(1+exp(sim.cov*beta))
Using the the model P(Y=1|sim.cov)
is computed for each subject in n.sample
, then the case and one control status for each of the n.sample
subjects are determined by drawn randomly from a Bernoulli distribution using the probability P(Y=1|sim.cov)
. From these n.sample
subjects one case and one control observation is randomly drawn. This algorithm is repeated n/2
times for each randomly sampled value from the continuous covariate, i.e. one case and one control is randomly drawn from each of n/2
times to generate the complete response vector of length(n)
.
As output generateSNPs
provides a response vector y
, a SNP matrix x
, a covariate matrix cov
and a matchset vector matchset
which can directly be used as input for the minPtest
, see the example of the minPtest
function.
An object of class 'generateSNPs', which is a list containing the following components:
sim.data |
a matrix with |
y |
a numeric response vector coded with 0 (coding for controls) and 1 (coding for cases) of length |
x |
a numeric |
cov |
a |
matchset |
a numeric vector of length |
snp.no |
number of SNPs in the simulated data set. |
SNPtoGene |
the mapping matrix of dimension |
call |
call. |
Stefanie Hieke hieke@imbi.uni-freiburg.de
Schwender, H. et al. (2011). Testing SNPs and sets of SNPs for importance in association studies. Biostatistics, 12, 18-32.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Generate a data set consisting of 100 subjects and 200 SNPs on 5 genes,
# with 4 blocks per gene with block size of 10, i.e. 10 SNPs per block
# yielding 40 SNPs per gene:
# specifying the matrix for 6 SNPs and corresponding parameters (effect size)
# for the generation of case-control status
SNP <- c(6,26,54,135,156,186)
BETA <- c(0.9,0.7,1.5,0.5,0.6,0.8)
SNPtoBETA <- matrix(c(SNP,BETA),ncol=2,nrow=6)
colnames(SNPtoBETA) <- c("SNP.item","SNP.beta")
set.seed(191)
sim1 <- generateSNPs(n=100,gene.no=5,block.no=4,block.size=10,p.same=0.9,
p.different=0.75,p.minor=c(0.1,0.4,0.1,0.4),n.sample=80,SNPtoBETA=SNPtoBETA)
# to reconstruct how to adopt the output from generateSNPs,
# see the example of the minPtest function.
|
Loading required package: scrime
Loading required package: Epi
Attaching package: 'Epi'
The following object is masked from 'package:base':
merge.data.frame
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.