correlation {agricolae} | R Documentation |

## 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")
```

### Arguments

`x` |
table, matrix or vector |

`y` |
table, matrix or vector |

`method` |
"pearson", "kendall", "spearman", "lin" |

`alternative` |
"two.sided", "less", "greater" |

### Details

Parameters equal to function cor()

### Value

The correlation matrix with its probability

### Author(s)

Felipe de Mendiburu

### References

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

### See Also

### Examples

```
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"))
```

[Package

*agricolae*version 1.3-7 Index]