# distance.randtest: Randtest distance In dispRity: Measuring Disparity

 distance.randtest R Documentation

## Randtest distance

### Description

Measures the distance between the observed statistic from a `"randtest"` object and some specific quantile of the simulated data.

### Usage

``````distance.randtest(xtest, quantile = c(0.025, 0.975), abs = FALSE)
``````

### Arguments

 `xtest` an object of class `"randtest"` `quantile` a `numeric` value for the quantile edges to compare the observed data to on either sides (by default `quantile = c(0.025. 0.975)`). `abs` `logical`, whether to calculate the distance as an absolute value (`TRUE`) or not (`FALSE` - default).

### Details

To compare the observed value to the simulated median value, you can use `quantile = 0.5`. Also note that when using `abs = FALSE` (default), a negative value means that the observed statistic is within the request quantiles.

### Author(s)

Thomas Guillerme

`randtest` `randtest.dispRity`

### Examples

``````## Simple example
dummy_matrix <- matrix(rnorm(500), 100, 5)

## Testing whether the mean of a random subset
## is different than the means of 100 subsets
dummy_test <- randtest.dispRity(dummy_matrix,
subset = sample(1:100, 20),
metric = mean)
dummy_test ; plot(dummy_test)

## The distance between the observed data and the 95% quantile
distance.randtest(dummy_test)

## The absolute distance from the median
distance.randtest(dummy_test, quantile = 0.5, abs = TRUE)

``````

dispRity documentation built on May 29, 2024, 9:40 a.m.