This makes no statistical sense. If you are going to perform a regression
on a time series (and if it has any point so there is a significant
regression) then if the regressor is autocorrelated the response will be
too even with independent errors. You need to do the regression and the
modelling of the autocorrelation simultaneously (function arima in package
ts for linear regression) or at least alternately (the Corchane-Orcutt
procedure, DIY).
As is often the case, please tell us what you want really to do (in your
substantive application) rather than for a vague statistical procedure,
and we may be able to point you to appropriate tools.
On Mon, 6 Jan 2003, Dr Andrew Wilson wrote:
> Could anyone tell me whether there is an R function for removing
> autocorrelations from a series of observations before performing a linear
> or nonlinear regression analysis on them?
(This would seem to suggest fitting an AR process and looking at the
residuals, a procedure sometimes known as `pre-whitening'. But it needs
to be applied to residuals from a regression, not the original series.)
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595