extrmadj: adjuste extreme values

Description Usage Arguments Examples

View source: R/extrmadj.R

Description

Adjusting extreme values of series.

Usage

1
extrmadj(x, limit = 3.5, subs_method = c("spencer", "nearest"))

Arguments

x

numeric vector.

limit

threshold for recognizing extreme value.

subs_method

indicate method for substituting extreme values, spencer or nearest, the former means substituted by spencer value, latter means substituted by mean of nearest none extreme values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
##
usad1 = USAccDeaths
usad1[2:5] = mean(USAccDeaths) * 3  # first obs will become a extreme since the trend has been changed by 2:5
(ext1 = extrmadj(usad1))
plot(ext1$extr_infr$x, type = "l") # original
lines(ext1$x.nextr, type = "l", col = "red") # substituted
## 
usad2 = USAccDeaths
usad2[15] = - mean(USAccDeaths) * 3
(ext2 = extrmadj(usad2))
plot(ext2$extr_infr$x, type = "l") # original
lines(ext2$x.nextr, type = "l", col = "red") # substituted

## substituted by mean of nearest non-extrmadj
(ext3 = extrmadj(usad2, subs_method = "near"))
plot(ext3$extr_infr$x, type = "l") # original
lines(ext3$x.nextr, type = "l", col = "red") # substituted

Nisus-Liu/bbturns documentation built on May 7, 2019, 6:18 p.m.