Last data update: 2014.03.03

R: Execute the Forward Search Algorithm.
ForwardSearch.fitR Documentation

Execute the Forward Search Algorithm.

Description

Execute the Forward Search Algorithm. Based on Johansen & Nielsen (2013).

Usage

ForwardSearch.fit(x.1, y, psi.0 = 0.5, m.0 = NULL, beta.0 = NULL)

Arguments

x.1

Matrix of dimension n x (dim.x -1). Design matrix for regressors apart from constant.

y

Vector of dimension n. Dependent variable.

psi.0

proportion of observations in initial set of set of selected observations. Default is 0.5. Initial set has round(n*psi.0) observations.

m.0

Number of observations in initial set of selected observations. Default is NULL. If value is given this overrides psi.0.

beta.0

Vector of dimension dim.x. Initial estimator for regression coefficient. Default is NULL, which results in Least Trimmed Squares estimator through beta.0 <- ltsReg(y~x.1,alpha=psi.0)$coefficients.

Details

Dimensions: n is the number of observations. dim.x is the number of regressors (including intercept).

Default is initial estimator is the Least Trimmed Squares estimator of Rousseeuw (1984) implemented as ltsReg in package robustbase.

The breakdown point of the initial Least Trimmed Squares estimator and the size of the initial sub-sample are both given by psi.0. Alternatively, a Least Trimmed Squares estimator with a particular breakdown point can be entered through the argument beta.0.

Value

forward.beta

Matrix of dimension n x p. Forward Search estimates of beta.

forward.sigma2.biased

Matrix of dimension n x 1. Forward Search estimates of sigma. Values are *not* bias corrected.

forward.residual

Matrix of dimension n x 1. Forward Search estimates of forward residuals. Values are *not* bias corrected.

m.0

Number of observations in initial set of selected observations.

y

Vector of dimension n. Dependent variable from argument.

x

Matrix of dimension n x dim.x. Design matrix for regressors. Dependent variable from argument augmented with constant. First column is constant.

Author(s)

Bent Nielsen <bent.nielsen@nuffield.ox.ac.uk> 9 Sep 2014

References

Johansen, S. and Nielsen, B. (2013) Asymptotic analysis of the Forward Search. Download: Nuffield DP.

Johansen, S. and Nielsen, B. (2014) Outlier detection algorithms for least squares time series. Download: Nuffield DP.

Rousseeuw, P.J. (1984) Least median of squares regression. Journal of the American Statistical Association 79, 871-880.

Examples

#####################
#	EXAMPLE 1
#	using Fulton Fish data,
#	see Johansen and Nielsen (2014).

#	Call package
library(ForwardSearch)

#	Call data
data(Fulton)
mdata	<- as.matrix(Fulton)
n		<- nrow(mdata)

#	Identify variable to reproduce Johansen and Nielsen (2014)
q		<- mdata[2:n		,9]
q_1		<- mdata[1:(n-1) ,9]
s		<- mdata[2:n		,6]
x.q.s	<- cbind(q_1,s)
colnames(x.q.s	)	<- c("q_1","stormy")

#	Fit Forward Search
FS95	<- ForwardSearch.fit(x.q.s,q,psi.0=0.95)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ForwardSearch)
Loading required package: robustbase
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ForwardSearch/ForwardSearch.fit.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ForwardSearch.fit
> ### Title: Execute the Forward Search Algorithm.
> ### Aliases: ForwardSearch.fit
> 
> ### ** Examples
> 
> #####################
> #	EXAMPLE 1
> #	using Fulton Fish data,
> #	see Johansen and Nielsen (2014).
> 
> #	Call package
> library(ForwardSearch)
> 
> #	Call data
> data(Fulton)
> mdata	<- as.matrix(Fulton)
> n		<- nrow(mdata)
> 
> #	Identify variable to reproduce Johansen and Nielsen (2014)
> q		<- mdata[2:n		,9]
> q_1		<- mdata[1:(n-1) ,9]
> s		<- mdata[2:n		,6]
> x.q.s	<- cbind(q_1,s)
> colnames(x.q.s	)	<- c("q_1","stormy")
> 
> #	Fit Forward Search
> FS95	<- ForwardSearch.fit(x.q.s,q,psi.0=0.95)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>