Dear R-helpers, I am doing a multiple linear regression of an ozone time-series on time and other explanatory variables. I have been using the "lm" model but I am recently experimenting with "gls". With the "lm" model I was able to look at the residuals by $res in the "summary (lm(...))" and then check with "acf" for autocorrelation in these residuals which had the same "length" with the original time-series. A similar action in "gls" would return only 5 values for residuals (Min,Q1,Med,Q3,Max). So I am estimating the residuals for the predicted time-series by subtracting $fitted from my original time-series. I would like to ask if this a correct thing to do. Thanks for reading, Panos ----------------------------------------------------- Dr Panos Hadjinicolaou Centre for Atmospheric Science, Dept. of Chemistry University of Cambridge Lensfield Road Cambridge CB2 1EW, UK Work: +44 1223 763815 Home: +44 1223 327417 Fax: +44 1223 763823
The `correct thing to do' even for lm is to use the generic accessor function residuals(). It may give a different answer even for lm (depending on na.action). Similarly, use fitted() for the fitted values. On Fri, 15 Apr 2005, Panos Hadjinicolaou wrote:> I am doing a multiple linear regression of an ozone time-series on time and > other explanatory variables. I have been using the "lm" model but I am recently > experimenting with "gls". > > With the "lm" model I was able to look at the residuals by $res in the "summary > (lm(...))" and then check with "acf" for autocorrelation in these residuals > which had the same "length" with the original time-series. > > A similar action in "gls" would return only 5 values for residuals > (Min,Q1,Med,Q3,Max). So I am estimating the residuals for the predicted > time-series by subtracting $fitted from my original time-series. I would like to > ask if this a correct thing to do.-- 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
Possibly Parallel Threads
- Concatenate a mix of numbers and letters to create a vector name
- filled.contour: colour key decoupled from main plot?
- one (small) sample wilcox.test confidence intervals
- Billing works but i do no get full calling cost...!
- correlated residuals in gls: Coefficient matrix not invertible