FRtest: Friedman-Rafsky (FR) test

View source: R/FRtest.R

FRtestR Documentation

Friedman-Rafsky (FR) test

Description

FR test is a multivariate generalization of nonparametric two-sample test. This function is an implementation with customized options, including a visualization of the minimum spanning tree (MST).

Usage

FRtest(
  samp1,
  samp2,
  use.cosine = FALSE,
  binary = FALSE,
  binary.cutoff = 2,
  plot.MST = FALSE,
  col = c("#F0E442", "#56B4E9"),
  label.names = c("Sample 1", "Sample 2"),
  vertex.size = 5,
  edge.width = 1,
  ...
)

Arguments

samp1

Numeric matrix or data frame for Sample 1. Rows are multivariate dimensions, and columns are samples. E.g. gene by cell.

samp2

Numeric matrix or data frame for Sample 2.

use.cosine

An option if to use cosine distance. Logical variable. By default (FALSE), Euclidean distance is used.

binary

An option if to use binary values. Logical variable. Default: FALSE. If TRUE, use binary.cutoff to dichotomize samp1 and samp2.

binary.cutoff

Numeric value for binary cutoff. Binary value = 1 if greater than binary.cutoff, 0 otherwise. Default: 2.

plot.MST

Boolean variable indicating if to plot the minimum spanning tree (MST). Default: FALSE.

col

Character vector of length two for customized colors of the nodes in MST. Default: c("#F0E442", "#56B4E9").

label.names

Character vector of length two for customized names of the two samples. Default: c("Sample 1","Sample 2").

vertex.size, edge.width, ...

Additional plotting parammeters passed to plot.igraph. Default: vertex.size=5, edge.width=1.

Value

Test statistics and p-values.

runs

Total number of subtrees.

runs.samp1

Number of subtrees of Sample 1.

runs.samp2

Number of subtrees of Sample 2.

stat

The standardized FR statistic.

p.value

P-value of the FR test.

Examples

## Not run: 
samp1 <- matrix(rnorm(100),nrow=5)
samp2 <- matrix(rnorm(100),nrow=5)
FRtest(samp1, samp2)
FRtest(samp1, samp2, use.cosine=TRUE)
FRtest(samp1, samp2, plot.MST=TRUE, main="Minimum spanning tree plot")
FRtest(samp1, samp2, binary=TRUE, binary.cutoff=1)

## End(Not run)

JCVenterInstitute/FRmatch documentation built on Dec. 15, 2022, 2:30 p.m.