Rfast (version 1.7.3)

Correlations: Correlation between a vector and a set of variables

Description

Correlation between a vector and a set of variables

Usage

correls(y, x, type = "pearson", a = 0.05, rho = 0)

Arguments

y
A numerical vector.
x
A matrix with the data.
type
The type of correlation you want. "pearson" and "spearman" are the two supported types.
a
The significance level used for the confidence intervals.
rho
The value of the hypothesised correlation to be used in the hypothesis testing.

Value

A matrix with 5 column; the correlation, the p-value for the hypothesis test that each of them is eaqual to "rho", the test statistic and the $a/2%$ lower and upper confidence limits.

Details

The functions uses the built-in function "cor" which is very fast and then includes confidence intervals and produces a p-value for the hypothesis test.

See Also

allbetas, univglms

Examples

Run this code
x <- matrix( rnorm(100 * 1000), ncol = 1000 )
y <- rnorm(100)
r <- cor(y, x)  ## correlation of y with each of the xs
a <- allbetas(y, x)  ## the coefficients of each simple linear regression of y with x
b <- correls(y, x)
w <- runif(1000)

Run the code above in your browser using DataLab