calculateLODScore {MPR}R Documentation

~~function to do ... ~~

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

calculateLODScore(geno.data, pheno.data, mapInfo)

Arguments

geno.data ~~Describe geno.data here~~
pheno.data ~~Describe pheno.data here~~
mapInfo ~~Describe mapInfo here~~

Details

~~ If necessary, more details than the description above ~~

Value

~Describe the value returned If it is a LIST, use

comp1 Description of 'comp1'
comp2 Description of 'comp2'

...

Warning

....

Note

~~further notes~~

~Make other sections like Warning with section{Warning }{....} ~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

##---- 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 (geno.data, pheno.data, mapInfo) 
{
    geno.data.tmp <- geno.data > 0.5
    geno.data.tmp[geno.data.tmp == FALSE] <- NA
    ph1 <- matrix(t(matrix(pheno.data, nrow = length(pheno.data), 
        ncol = nrow(geno.data)))[geno.data.tmp], ncol = ncol(geno.data))
    geno.data.tmp <- geno.data < 0.5
    geno.data.tmp[geno.data.tmp == FALSE] <- NA
    ph0 <- matrix(t(matrix(pheno.data, nrow = length(pheno.data), 
        ncol = nrow(geno.data)))[geno.data.tmp], ncol = ncol(geno.data))
    g1 <- rowMeans(ph1, na.rm = T)
    n1 <- rowSums(!is.na(ph1))
    s1 <- rowVars(ph1, na.rm = T)
    g0 <- rowMeans(ph0, na.rm = T)
    n0 <- rowSums(!is.na(ph0))
    s0 <- rowVars(ph0, na.rm = T)
    n <- rowSums(!is.na(geno.data))
    ss <- (s1 * (n1 - 1) + s0 * (n0 - 1))/(n1 + n0 - 2)
    t <- (g1 - g0)/sqrt(ss/n1 + ss/n0)
    res <- data.frame(mapInfo, "-log10 P" = -log10(pt(abs(t), 
        df = pmax(1, n1 + n0 - 2), lower.tail = F, log.p = FALSE) * 
        2), t = t, d = g1 - g0, n0 = n0, n1 = n1, check.names = FALSE)
    class(res) <- c("scanone", "data.frame")
    res
  }

[Package MPR version 0.1 Index]