Learn R Programming

tabula (version 1.6.0)

test_fit: Frequency Increment Test

Description

Frequency Increment Test

Usage

test_fit(object, ...)

# S4 method for IncrementTest,missing plot_time(object, level = 0.95, roll = FALSE, window = 3)

# S4 method for CountMatrix test_fit(object, dates, ...)

Arguments

object

A \(m \times p\) matrix of count data.

...

Currently not used.

level

A length-one numeric vector giving the confidence level.

roll

A logical scalar: should each time series be subsetted to look for episodes of selection? Only used if highlight is "FIT" (see details).

window

An odd integer giving the size of the rolling window. Only used if roll is TRUE.

dates

A numeric vector of dates.

Value

If simplify is FALSE, returns a list (default), else returns a matrix.

Details

The Frequency Increment Test (FIT) rejects neutrality if the distribution of normalized variant frequency increments exhibits a mean that deviates significantly from zero.

References

Feder, A. F., Kryazhimskiy, S. & Plotkin, J. B. (2014). Identifying Signatures of Selection in Genetic Time Series. Genetics, 196(2), 509-522. 10.1534/genetics.113.158220.

See Also

Other statistics: independance, test_diversity()

Examples

Run this code
# NOT RUN {
data("merzbach", package = "folio")

## Coerce the merzbach dataset to a count matrix
## Keep only decoration types that have a maximum frequency of at least 50
keep <- apply(X = merzbach, MARGIN = 2, FUN = function(x) max(x) >= 50)
counts <- as_count(merzbach[, keep])

## Group by phase
## We use the row names as time coordinates (roman numerals)
dates <- as.numeric(utils::as.roman(rownames(counts)))

## Frequency Increment Test
freq <- test_fit(counts, dates)

## Plot time vs abundance and highlight selection
plot_time(freq)
plot_time(freq, roll = TRUE, window = 5)
# }

Run the code above in your browser using DataLab