moving_wt_filter: Moving weighted average filter

View source: R/moving_wt_filter.R

moving_wt_filterR Documentation

Moving weighted average filter

Description

Filters data using moving weighted averages of diferent window sizes.

Usage

moving_wt_filter(x, y, k)

Arguments

x

A numeric vector with the position values of the data to filter (a sequence)

y

A numeric vector with the data to filter

k

A numeric vector with the widths of the windows to use for the filter (must be an odd number)

Details

The weigths for the window lengths are calculated in a way that farther observations from the central (estimated) value are given a lesser weight than observations near de central value

Value

A list with two tibbles: one with the filtered results plus the original data, and one with the residuals

References

Swan, A. R. H. & Sandilands, M. (1995). Introduction to Geological Data Analysis. Blackwell Science.

Examples

data(nautilus)
head(nautilus)
k = c(5, 7, 9)
moving_wt_filter(nautilus$x, nautilus$y, k)


maxgav13/GMisc documentation built on June 12, 2022, 3:48 a.m.