SmoothIrregular: Regularise and smooth an irregular timeseries.

View source: R/additional-functions.R

SmoothIrregularR Documentation

Regularise and smooth an irregular timeseries.

Description

Regularise and smooth an irregular timeseries.

Usage

SmoothIrregular(df, time.var, value.var, tau_smooth, d_t = NULL)

Arguments

df

A dataframe with columns of ages and values

time.var

A quoted string giving the name of the age column

value.var

A quoted string giving the name of the value column

tau_smooth

Width of the boxcar / uniform smoothing window

d_t

Difference between time steps of new regular time series

Examples

set.seed(20191205)
n <- 100
dat <- data.frame(time = sort(runif(n, 1, 1e04)),
 value = arima.sim(list(ar = 0.9), n = n)
 )
plot(dat, type = "b")
dat.smoothed <- SmoothIrregular(dat, "time", "value", tau_smooth = 500)
dat.smoothed.2 <- SmoothIrregular(dat, "time", "value", tau_smooth = 500,
 d_t = 500)
lines(mean.value~age, data = dat.smoothed, col = "Red")
lines(mean.value~age, data = dat.smoothed.2, col = "Blue")
head(dat.smoothed)

EarthSystemDiagnostics/psem documentation built on March 3, 2024, 10:24 p.m.