edge.glr: Calculate Test Statistics and P values

Description Usage Arguments Author(s) Examples

Description

Calculates test statistics and P values from obs.fit, which is returned from edge.fit.

Usage

1
edge.glr(obs.fit, df1, df0, norm.pval = FALSE)

Arguments

obs.fit

Object returned from edge.fit

df1

Degrees of freedom of full model

df0

Degrees of freedom of reduced model

norm.pval

Flage determining whether or not P value should be normalized.

Author(s)

John D. Storey <jstorey@princeton.edu>

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
##---- 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 (obs.fit, df1, df0, norm.pval = FALSE) 
{
    err.func = "edge.glr"
    res1 = obs.fit$res1
    res0 = obs.fit$res0
    n = ncol(res1)
    rss1 = apply(res1, 1, function(x) {
        sum(x^2)
    })
    rss0 = apply(res0, 1, function(x) {
        sum(x^2)
    })
    stat = ((rss0 - rss1)/(df1 - df0))/(rss1/(n - df1))
    if (norm.pval) {
        pval = 1 - pf(stat, df1 = (df1 - df0), df2 = (n - df1))
        return(list(stat = stat, pval = pval))
    }
    else {
        return(list(stat = stat, pval = NULL))
    }
  }

Sage-Bionetworks/snm documentation built on May 9, 2019, 12:14 p.m.