BoutrosLab.plotting.general (version 5.9.2)

get.correlation.p.and.corr: Calculate a correlation and its statistical significance

Description

Returns the correlation and p-value for two variables using a user-specified correlation metric. P-values are estimated analytically, not via permutation-testing.

Usage

get.correlation.p.and.corr(x, y, alternative = 'two.sided', method = 'pearson');

Arguments

x

Vector of numbers to analyze

y

Vector of numbers to analyze

alternative

What is the null-hypothesis?

method

The correlation technique to use (passed directly to cor.test)

Value

Returns a two-element vector containing the correlation and its p-value.

Examples

Run this code
# NOT RUN {
get.correlation.p.and.corr(
	x = runif(100),
	y = runif(100),
	method = 'pearson'
	);

get.correlation.p.and.corr(
	x = sample(1:10, 100, replace = TRUE),
	y = runif(100),
	method = 'spearman'
	);
# }

Run the code above in your browser using DataLab