sliding.meansd {Ringo} | R Documentation

## Compute mean and standard deviation of scores in a sliding window

### Description

This functions is used to slide a window of specified size over scores at given positions. Computed is the mean and standard deviation over the scores in the window.

### Usage

    sliding.meansd(positions, scores, half.width)

### Arguments

`positions` | numeric; sorted vector of (genomic) positions of scores
`scores` | numeric; scores to be smoothed associated to the `positions`
`half.width` | numeric, half the window size of the sliding window

### Value

Matrix with three columns:

`mean` | means over scores in running window centered at the positions that were specified in argument `positions`.
`sd` | standard deviations over scores in running window centered at the positions that were specified in argument `positions`.
`count` | number of points that were considered for computing the mean and standard deviation at each position

### Author(s)

Joern Toedling and Oleg Sklyar

### See Also

`sliding.quantile`

### Examples

       set.seed(123)
       sampleSize <- 10
       ap <- cumsum(1+round(runif(sampleSize)*10))
       as <- c(rnorm(floor(sampleSize/3)),
               rnorm(ceiling(sampleSize/3),mean=1.5),
               rnorm(floor(sampleSize/3)))
       sliding.meansd(ap, as, 20)
       ap
       mean(as[1:3])
       sd(as[1:3])

[Package Ringo version 1.48.0 Index]