# smooth.average: A weighted mean smooth of a time series In landmarkacoustics/SoundPoints-R: an R version of the SoundPoints algorithm

## Description

the weight of previous elements is determined by the resolution of the time series and the half-life of the weighting function

## Usage

 `1` ```smooth.average(amplitude, time.res, half.life, initial.value = 1) ```

## Arguments

 `amplitude` a vector of real-valued numbers `time.res` the time interval separating the elements of `amplitude` `half.life` the time it takes for half of an element's impact to disappear. `initial.value` the starting value of the smooth. it's usually good to start with something other than `amplitude[0]`, like an estimate of `mean(amplitude)`

## Value

a numeric vector the same length as `amplitude`

## Author(s)

Benjamin N. Taft [email protected]

`make.peaks`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. ## The function is currently defined as function (amplitude, time.res, half.life, initial.value = 1) { N <- length(amplitude) smooth.amplitude <- rep(initial.value, N) k <- time.res/half.life for (i in 2:N) { smooth.amplitude[i] <- (1 - k) * smooth.amplitude[i - 1] + k * amplitude[i] } return(invisible(smooth.amplitude)) } ```