corr_test {CNPS} | R Documentation |

## Correlation test

### Description

Test the correlation coefficient of the sample.

### Usage

```
corr_test(x, y, alternative = "greater", measure = "pearson",
method_p = "sampling", samplenum = 1000, conf.level.sample = 0.95)
```

### Arguments

`x` |
numeric vectors of data values and should have the same length |

`y` |
numeric vectors of data values and should have the same length |

`alternative` |
a character string specifying the alternative hypothesis, must be one of "two.sided", "greater"(default) or "less" |

`measure` |
the way to measure the correlation coefficient and must be one of "pearson", "spearman" or "kendall" |

`method_p` |
a string indicating what method to use for p-value. "sampling" represents sampling; "asymptotic" represents using large sample approximations |

`samplenum` |
the number of SRS samples |

`conf.level.sample` |
p-value confidence level for SRS sampling |

### Details

All procedures and methods of the correlation coefficient test based on the Spearman Correlation Coefficient are the same as for the Pearson Correlation Coefficient. But pay attention to that the correlation coefficient test based on Kendall Correlation Coefficient is a little different from the above two due to its definition.

### Value

A list with following components

`method` |
the test uesd |

`score` |
the score which is used |

`stat` |
the statistic of the data under the given scoring system |

`conf.int` |
the confidence interval for p-value(only if method_p = "sampling") |

`pval` |
p-value for the test |

`null.value` |
a character string describing the alternative hypothesis |

### Author(s)

Jiasheng Zhang, Feng Yu, Yangyang Zhang, Siwei Deng. Tutored by YuKun Liu and Dongdong Xiang.

### References

Higgins, J. J. (2004). An introduction to modern nonparametric statistics. Pacific Grove, CA: Brooks/Cole.

### Examples

```
x=c(68,70,71,72)
y=c(153,155,140,180)
corr_test(x , y , measure = "kendall" , method = "asymptotic")
corr_test(x , y , measure = "kendall" , method = "sampling")
```

*CNPS*version 1.0.0 Index]