Description Usage Arguments Examples
Retrieve simulated phenotypes
| 1 | getSimulatedPhenotype(data, snp.name, trait.name, covars = "")
 | 
| data | |
| snp.name | |
| trait.name | |
| covars | 
| 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 26 27 | ##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
## The function is currently defined as
function (data, snp.name, trait.name, covars = "") 
{
    variances <- c(1, 1, 1)
    snp.num <- which(snpnames(data) == snp.name)
    gtypes <- as.numeric(data@gtdata[, snp.num])
    means <- getMeans(data, snp.name, trait.name)
    if (sum(is.na(gtypes)) > 0) {
        warning("Missing genotypes found. Filling with the most frequent allele.")
        gtypes[is.na(gtypes)] <- 0
    }
    freqs <- as.vector(table(gtypes)/length(gtypes))
    phtypes <- rep(0, length(gtypes))
    phtypes[gtypes == 0] <- rnorm(length(gtypes[gtypes == 0]), 
        mean = means[1], sd = sqrt(variances[1]))
    phtypes[gtypes == 1] <- rnorm(length(gtypes[gtypes == 1]), 
        mean = means[2], sd = sqrt(variances[2]))
    phtypes[gtypes == 2] <- rnorm(length(gtypes[gtypes == 2]), 
        mean = means[3], sd = sqrt(variances[3]))
    H2 <- getH2(data, snp.name, trait.name, covars)
    phtypes <- phtypes + getError(H2, freqs, means, length(phtypes))
    phtypes
  }
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.