Learn R Programming

agricolae (version 1.3-7)

correlation: Correlation analysis. Methods of Pearson, Spearman, Kendall and Lin

Description

It obtains the coefficients of correlation and p-value between all the variables of a data table. The methods to apply are Pearson, Spearman , Kendall and lin's concordance index. In case of not specifying the method, the Pearson method will be used. The results are similar to SAS.

Usage

correlation(x,y=NULL, method = c("pearson", "kendall", "spearman", "lin")
,alternative="two.sided")

Value

The correlation matrix with its probability

Arguments

x

table, matrix or vector

y

table, matrix or vector

method

"pearson", "kendall", "spearman", "lin"

alternative

"two.sided", "less", "greater"

Author

Felipe de Mendiburu

Details

Parameters equal to function cor()

References

Lin LI. A concordance correlation coefficient to evaluate reproducibility. Biometrics. 1989; 45, 255-268.

See Also

correl

Examples

Run this code
library(agricolae)
data(soil)
# example 1
analysis<-correlation(soil[,2:8],method="pearson")
analysis
# Example 2: correlation between pH, variable 2 and other elements from soil.
analysis<-with(soil,correlation(pH,soil[,3:8],method="pearson",alternative="less"))
analysis
# Example 3: correlation between pH and clay method kendall.
with(soil,correlation(pH,clay,method="kendall", alternative="two.sided"))

Run the code above in your browser using DataLab