Learn R Programming

ForwardSearch (version 1.0)

ForwardSearch.plot: Plots forward residuals with simultaneous confidence bands

Description

Plots forward residuals with simultaneous confidence bands based on Johansen and Nielsen (2013, 2014).

Usage

ForwardSearch.plot(FS, ref.dist = "normal", bias.correct = FALSE, return = FALSE, plot.legend = TRUE, col = NULL, legend = NULL, lty = NULL, lwd = NULL, main = NULL, type = NULL, xlab = NULL, ylab = NULL)

Arguments

FS
List. Value of the function ForwardSearch.fit.
ref.dist
Character. Reference distribution.
"normal"
standard normal distribution.

bias.correct
Logical. If FALSE do not bias correct variance, so plots have appearance similar to Atkinson and Riani (2000). If TRUE do bias correct variance, so plots start at origin. Default is FALSE.
return
Logical. Default is FALSE: do not return values.
plot.legend
Logical. Default is TRUE: include legend in plot.
col
plot parameter. Vector of 6 colours.
legend
plot parameter. Vector of 6 characters.
lty
plot parameter. Vector of 6 line types.
lwd
plot parameter. Vector of 6 line widths.
main
plot parameter. Character.
type
plot parameter. Charcater for plot type.
xlab
plot parameter. Charcater for x label.
ylab
plot parameter. Charcater for y label.

Value

ref.dist
Character. From argument.
bias.correct
Logical. From argument.
forward.residual.scaled
Vector. Forward residuals scaled by estimated variance. The estimated variance is or is not bias corrected depending on the choice of bias.correct.
forward.asymp.median
Vector. Asymptotic median.
forward.asymp.sdv
Vector. Asymptotic standard deviation. Not divided by squareroot of sample size.
cut.off
Matrix. Cut-offs taken from Table 3 of Johansen and Nielsen (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.

Examples

Run this code
#####################
#	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)

ForwardSearch.plot(FS95)

Run the code above in your browser using DataLab