rhoToPValue {scran} | R Documentation

## Spearman's rho to a p-value

### Description

Compute an approximate p-value against the null hypothesis that Spearman's rho is zero. This vectorizes the approximate p-value calculation in `cor.test` with `method="spearman"`.

### Usage

    rhoToPValue(rho, n, positive = NULL)

### Arguments

`rho` | Numeric vector of rho values.
`n` | Integer scalar specifying the number of observations used to compute `rho`.
`positive` | Logical scalar indicating whether to perform a one-sided test for the alternative of a positive (`TRUE`) or negative rho (`FALSE`). Default is to return statistics for both directions.

### Value

If `positive=NULL`, a list of two numeric vectors is returned, containing p-values for the test against the alternative hypothesis in each direction.

Otherwise, a numeric vector is returned containing the p-values for the test in the specified direction.

### Author(s)

Aaron Lun

### Examples

    rhoToPValue(seq(-1, 1, 21), 50)

[Package scran version 1.20.1 Index]