Score.Test.Overall: Implement the overall genetic effect test for H0:

Description Usage Arguments Value Examples

View source: R/Score.Test.Overall.R

Description

Score.Test.Overall returns results of overall genetic effect test, including score test statistic, estimated degree of freedom and scale parameter, and test p-value.

Usage

1
Score.Test.Overall(Y, K1, K2, K3)

Arguments

Y

numerical vector: quantitative phenotypes

K1

matrix: kernel matrix of the first gene.

K2

matrix: kernel matrix of the second gene.

K3

matrix: elementwise multiplication of K1 and K2

Value

Score

score statistic

df

estimated degree of freedom for the scaled chi-square

scale

estimated scale parameter for the scaled chi-square

p.value

test p-value

Examples

 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
## The function is currently defined as
  function (Y, K1, K2, K3) 
  {
    b <- mean(Y)
    sig2 <- var(Y)
    U <- t(Y - b) %*% (K1 + K2 + K3) %*% (Y - b)/(2 * sig2)
    M <- (K1 + K2 + K3)
    e <- TRACE(PROJECT(M))/2
    c11 <- TT(PROJECT(K1), PROJECT(K1))
    c12 <- TT(PROJECT(K1), PROJECT(K2))
    c13 <- TT(PROJECT(K1), PROJECT(K3))
    c22 <- TT(PROJECT(K2), PROJECT(K2))
    c23 <- TT(PROJECT(K2), PROJECT(K3))
    c33 <- TT(PROJECT(K3), PROJECT(K3))
    COV <- matrix(c(c11, c12, c13, c12, c22, c23, c13, c23, c33), 
        3, 3)
    Its <- c(TRACE(PROJECT(K1)), TRACE(PROJECT(K2)), TRACE(PROJECT(K3)))
    correct_COV <- (COV - Its %*% t(Its)/(n - 1))/2
    Itt <- sum(correct_COV)
    k <- Itt/(2 * e)
    v <- 2 * e^2/Itt
    pvalue <- pchisq(U/k, df = v, lower.tail = FALSE)
    object <- list(Score = U, p.value = pvalue, df = v, scale = k)
    class(object) <- "Score Test: tau1=tau2=tau3=0"
    return(object)
  }

SPA3G documentation built on May 2, 2019, 11:12 a.m.