NOIS_fit: Fitting NOIS to data

Description Usage Arguments Value See Also Examples

Description

Fit NOIS to data and return a NOIS_fit object

Usage

1
2
3
NOIS_fit(data, x = "x", y = "y", CV_method = "LOOCV", first_h = NULL,
  pool_h = NULL, local_q = 0.1, pool_q = 0.1, tol = 1e-07,
  maxit = 200, ...)

Arguments

data

A data.frame.

x

The name of the column in data containing the 'x' values.

y

The name of the column in data containing the 'y' values.

CV_method

The type of cross-validation to use. Possible types are c('MCV', 'LOOCV', 'PCV', 'none').

first_h

Bandwidth for first model fit. Only used when CV_method = 'none'. Default value is the theoretically optimal bandwidth of n^{-1/5}.

pool_h

Bandwidth for pooled model fit. Only used when CV_method = 'none'. Default value is the theoretically optimal bandwidth of n^{-1/5}.

local_q

Fraction of points detected as outliers for each unpooled fit.

pool_q

Pooled outlier detection. For numerics \in (0, 1), this is the fraction of points detected as outliers. For integers ≥ 1 this is the number of points detected as outliers.

tol

Tolerance for each unpooled fit.

maxit

Maximum number of iterations for each individual kernel smoothing fit.

...

Additional arguments passed to the CV_method.

Value

An object of class 'NOIS_fit' that is a list with the following components.

fit_df

A data_frame with columns specifying the original 'x' and 'y' values, the pooled adjusted 'y' values, a logical indicating whether the observation is an outlier, the pooled non-bias corrected and bias corrected fits, and the non-robust non-bias corrected and bias corrected fits.

local_fit

Unpooled NOIS fits.

local_gamma

The unpooled γ estimates.

pool_gamma

The pooled γ estimate.

local_q

Fraction of points detected as outliers for each unpooled fit.

pool_q

Pooled outlier detection. For numerics \in (0, 1), this is the fraction of points detected as outliers. For integers ≥ 1 this is the number of points detected as outliers.

pool_nonout

The positions of the clean observations.

codeCV

A list with cross-validation information.

codeconv

A list with convergence information.

See Also

Other NOIS CV functions: LOOCV_grid, MCV_grid, PCV_grid

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
###generate some random data and introduce outliers
set.seed(123)
npts <- 100
nout <- floor(.1*npts)
xt <- seq(from=0, to=2*pi, length.out=npts)
gaussnoise <- rnorm(npts)
outliers <- sample(floor(npts/2):npts, size=nout)
randpts <- runif(nout, min=5, max=7)
yt <- sin(xt) + gaussnoise
yt[outliers] <- yt[outliers] + randpts
sine_data <- data.frame(x = xt, y = yt)
###fit NOIS to this data
sine_fit <- NOIS_fit(sine_data, 'x', 'y', pool_q = .1, CV_method = 'LOOCV')

hoangtt1989/NOIS documentation built on May 20, 2019, 2:08 p.m.