remove_outliers_hector {gmwmx}R Documentation

Remove outliers from a gnssts object using Hector

Description

Remove outliers from a gnssts object using Hector

Usage

remove_outliers_hector(x, n_seasonal, IQ_factor = 3, cleanup = TRUE)

Arguments

x

A gnssts object

n_seasonal

An integer specifying the number of seasonal component in the time series.

IQ_factor

A double specifying the number used to scale the interquartile range and corresponding to the argument IQ_factor in Hector removeoutliers.ctl

cleanup

An boolean specifying if temporary files should be cleaned.

Value

A gnssts object.

Examples

phase =     0.45
amplitude = 2.5
sigma2_wn =       15
bias =            0
trend =           5/365.25
cosU =            amplitude*cos(phase)
sinU =            amplitude*sin(phase)
n= 2*365
# define time at which there are jumps
jump_vec =  c(100, 200)
jump_height = c(10, 20)
# generate residuals
eps = rnorm(n = n, sd = sqrt(sigma2_wn))
# add trend, gaps and sin
A = create_A_matrix(1:length(eps), jump_vec, n_seasonal =  1)
# define beta
x_0 = c(bias, trend, jump_height,  cosU,  sinU)
# create time series
yy = A %*% x_0 + eps
plot(yy, type="l")
n_outliers = 30
set.seed(123)
id_outliers=sample(150:350, size = n_outliers)
val_outliers = rnorm(n = n_outliers, mean = max(yy)+10, sd = 5)
yy[id_outliers] = val_outliers
plot(yy, type="l")
# save signal in temp
gnssts_obj = create.gnssts(t = 1:length(yy), y = yy, jumps = jump_vec)
## Not run: 
clean_yy = remove_outliers_hector(x=gnssts_obj, n_seasonal = 1)
plot(clean_yy$t, clean_yy$y, type="l")

## End(Not run)

[Package gmwmx version 1.0.3 Index]