local.winsorization: Relocation of "locally outlying" data points

Description Usage Arguments Details Value Examples

View source: R/all.R

Description

For use with LMS quantile regression

Usage

1
2
local.winsorization(x, y, ncut=5, k=20)
~move the above line to just above the first optional argument

Arguments

x

independent variable

y

dependent variable, same length as x

ncut

number of equal-sized groups formed on values of x within which outliers are sought (relative to group mean, using GESD (Rosner, Technometrics 1983)

k

upper bound on number of outliers suspected in any group

Details

local winsorization is preferable to outlier deletion for quantile regression procedures; LMS is particularly sensitive to aberrant values and can fail to converge or even to iterate in the presence of outliers.

Value

a list with components x, y and bad – where bad gives the indices of any outliers, y[bad] are winsorized values, x and y[-bad] are the original data values in original order

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
     set.seed(123)
      nnn <- runif(300, 10, 20)
      jjj <- 8 + 2 * sin(nnn) + rnorm(100, 0, nnn/11)
      jjj[1] <- jjj[1]+100
      tfff <- try(fff <- lmsqreg.fit(jjj, nnn))
      if (!inherits(tfff,"try-error")) print(fff)
      LW <- local.winsorization(nnn,jjj)
      fxjjj <- LW$y
      fffx <- lmsqreg.fit(fxjjj, nnn)
      fffx

lmsqreg documentation built on May 2, 2019, 6:47 p.m.