Learn R Programming

AMIAS (version 1.0.1)

my.rollmean: Specil Rolling Means

Description

Generic functions for computing rolling means of ordered observations.

Usage

my.rollmean(y,h=5,...)

Arguments

y

Observe sequence, with length n.

h

integer width of the rolling window, rollmean would be used with k = h*2+1.

Other arguments, see rollmean for details.

Value

vector

Vector: smooth observe sequence, with length n.

Examples

Run this code
# NOT RUN {
  library(AMIAS)

  set.seed(12580)
  n <- 100
  sigma <- 0.3
  y0 <- rep(0,n)
  y0[10:15] <- 2
  y0[40:60] <- -1
  y0[80:82] <- 4
  y <- y0 + sigma*rnorm(n)
  y[80:82] <- y0[80:82] + sigma*rnorm(3)
  my.rollmean(y,1)
# }

Run the code above in your browser using DataLab