interact: Test marginal interactions for a model with binary response

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/interact.R

Description

Tests all potential marginal interactions, and estimates false discovery rates at each potential cutoff

Usage

1
interact(x, y, z = NULL, numPerm = 100, numFDR = 1000, method = "Pearson", verbose = TRUE)

Arguments

x

An n-by-p matrix of covariates - observations in rows, features in columns.

y

An n-vector of class labels taking on two values (eg 0,1 or A,B)

z

An optional secondary n-by-q matrix of covariates - observations in rows, features in columns.

numPerm

The number of permutations to run

numFDR

The number of marginal interactions you would like to estimate FDR for — default is 1000 (more interactions can increase runtime).

method

A string, either "Pearson" or "Spearman", indicating which type of correlation is to be used.

verbose

A boolean flag indicating whether current permutation number should be output.

Details

A correlation matrix is constructed for each class (according to method). The function then apply a fisher transformation to these values and takes their difference. These values are ordered, and permutations are used to assess false discovery rate estimates. If no Z matrix is included then all pairwise correlations are considered for variables in X. If a Z matrix is included then only correlations between X and Z variables are considered.

Value

interaction.ordered

A dataframe of the numFDR most significant marginal interactions (ordered from most significant to least significant). The first two columns indication the interaction and the third column gives an estimated q-value (False Discovery Rate).

internals

Variables used interally for methods relating to interact

Author(s)

Noah Simon, and Robert Tibshirani

References

Simon, N. and Tibshirani, R. (2012) A Permutation Approach to Testing Marginal Interactions in Many Dimensions, http://www-stat.stanford.edu/~nsimon/TMIcor.pdf

See Also

plot, print

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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
set.seed(5)

n <- 100
p <- 10
s <- 5

X1 <- cbind(matrix(rnorm(n*s), ncol = s) + rnorm(n), matrix(rnorm(n*(p-s)), ncol = (p-s)))
X2 <- matrix(rnorm(n * p), ncol = p)

X <- rbind(X1, X2)

colnames(X) <- c("a","b","c","d","e","f","g","h","i","j")
y <- c(rep("y",n),rep("n",n))

fit <- interact(X,y)
print(fit)
plot(fit)

## Bigger Example (restricting the number of top interactions to consider)
## Not run:
## Not run: 
n <- 300
p <- 500
s <- 10

X1 <- cbind(matrix(rnorm(n*s), ncol = s) + rnorm(n), matrix(rnorm(n*(p-s)), ncol = (p-s)))
X2 <- matrix(rnorm(n * p), ncol = p)
X <- rbind(X1, X2)

y <- c(rep("y",n),rep("n",n))

fit <- interact(X,y, numFDR = 50)  
## Restricts the number of most significant interactions to consider to 50
print(fit)
plot(fit)

## End(Not run)

## Example Comparing (simulated) Genes and Enviromental Variables

## Not run: 
n <- 100
p1 <- 100
p2 <- 10


Genes <- matrix(rnorm(n * p1), ncol = p1)
Environment <- matrix(rnorm(n * p2), ncol = p2)

y <- c(rep("y",n/2),rep("n",n/2))

fit <- interact(X = Genes,y, Z = Environment, numFDR = 50)  
## Restricts the number of most significant interactions to consider to 50
print(fit)
plot(fit)

## End(Not run)
## End(**Not run**)

Interact documentation built on May 2, 2019, 8:20 a.m.