runningratio: Running ratio

Description Usage Arguments Value Author(s) See Also Examples

Description

Calculates a running ratio; a ratio sum(top)/sum(bottom) in a sliding window.

Usage

1
runningratio(pos, numerator, denominator, at, window = 1000)

Arguments

pos

Positions for the values.

numerator

Values for numerator in ratio.

denominator

Values for denominator in ratio.

at

Positions at which running ratio is calculated. If missing, pos is used.

window

Window width.

Value

A vector with the same length as the input at (or pos, if at is missing), containing the running ratio.

Author(s)

Karl W Broman kbroman@biostat.wisc.edu

See Also

runningmean

Examples

1
2
3
4
5
6
x <- 1:1000
y <- runif(1000, 1, 5)
z <- runif(1000, 1, 5)
plot(x, runningratio(x, y, z, window=5), type="l", lwd=2)
lines(x, runningratio(x, y, z, window=50), lwd=2, col="blue")
lines(x, runningratio(x, y, z, window=100), lwd=2, col="red")

patr1ckm/patr1ckm documentation built on May 24, 2019, 8:21 p.m.