Nonparametric regression with autocorrelated errors
Usage
sm.regression.autocor(x=1:n, y, h.first, minh, maxh, method="direct",
ngrid=15, display="plot", ...)
Arguments
y
|
vector of the reponse values
|
h.first
|
the smoothing parameter used for the initial smoothing stage.
|
x
|
vector of the covariate values; if unset, it is assumed to be 1:length(y) .
|
minh
|
the minimum value of the interval where the optimal smoothing parameter
is searched for (default is 0.5).
|
maxh
|
the maximum value of the interval where the optimal smoothing parameter
is searched for (default is 10).
|
method
|
character value which specifies the optimality criterium adopted;
possible values are "no.cor" , "direct" (default), and "indirect" .
|
ngrid
|
the number of points to be considered in (minh,maxh) .
|
display
|
if this is equal to "plot" , graphical output is produced on the
current graphical device.
|
...
|
additional graphical parameters.
|
Description
This function estimates nonparametrically the regression function
of y
on x
when the error terms are serially correlated.Details
see Section 7.5 of the reference below.Value
a list as returned from sm.regression called with the new value of
smoothing parameter, with an additional term $aux
added which contains
the initial value h.first
, the estimated curve using h.first
,
the autocorrelation function of the residuals from the initial fit,
and the residuals.Side Effects
a new suggested value for h is printed, and, if the parameter display
is equal to "plot"
, graphical output is produced on the current graphical
device.References
Bowman, A.W. and Azzalini, A. (1997). Applied Smoothing Techniques for
Data Analysis: the Kernel Approach with S-Plus Illustrations.
Oxford University Press, Oxford.See Also
sm.regression
, sm.autoregression
Examples
type("Suggested value of h: ", h1)
sm1 <- sm.regression.eval.1d(x, y, h = h1, hmult = 1, model = "none")
if(missing(x))
x.name <- "time"
else x.name <- deparse(substitute(x))
if(display == "plot") {
plot(x, y, xlab = x.name, ylab = deparse(substitute(y)), ...)
lines(sm1$eval.points, sm1$estimate, col = 2)
}
sm1$aux <- list(h.first = h.first, first.sm = ym, acf = autocorr,
raw.residuals = r)
invisible(sm1)