stat.cor: Correlation test on permuted data.

View source: R/stat.cor.R

stat.corR Documentation

Correlation test on permuted data.

Description

This function is the first step in the process to create a correlation test in permuted data. For more details about correlation tests, see R documentation.

Usage

stat.cor(ant, var1, var2, method = "pearson", progress = TRUE)

Arguments

ant

an ant data object originating from permutations

var1

an integer or string indicating the column in the data frames that corresponds to the first variable to correlate. This variable must be numerical.

var2

an integer or string indicating the column in the data frames that corresponds to the second variable to correlate.This variable must be numerical.

method

a string vector indicating which type of correlation to perform:

  • 'pearson' for pearson correlation

  • 'kendall' for kendall correlation

  • 'spearman' for spearman correlation

progress

a boolean indicating the visualization of the permutation process.

Details

Performs correlations tests in a data frame and extracts the t statistic.

Value

a vector of 3 elements: the t statistic, the degree of freedom, and the estimate.

Author(s)

Sebastian Sosa, Ivan Puga-Gonzalez.

References

D. J. Best & D. E. Roberts (1975), Algorithm AS 89: The Upper Tail Probabilities of Spearman's rho. Applied Statistics, 24, 377-379.

Myles Hollander & Douglas A. Wolfe (1973), Nonparametric Statistical Methods. New York: John Wiley & Sons. Pages 185-194 (Kendall and Spearman tests).

Examples

t=met.strength(sim.m,sim.df,1) # Computing network metric
t=perm.net.nl(t,labels='age',rf=NULL,nperm=10,progress=FALSE) # Node label permutations
r.c=stat.cor(t,'age','strength',progress=FALSE) # Permuted correlation test

SebastianSosa/ANTs documentation built on Sept. 25, 2023, 11:06 p.m.