Vlad Skvortsov
2007-Aug-21 06:06 UTC
[R] prediction interval for multiple future observations
Hi! '?predict.lm' says that the prediction intervals returned by predict() are for single observation only. Is there a way to specify the desired number of observations to construct the interval for? R version 2.4.1 (2006-12-18) -- Vlad Skvortsov, vss at 73rus.com, http://vss.73rus.com
Vladimir Eremeev
2007-Aug-21 06:31 UTC
[R] prediction interval for multiple future observations
Vlad Skvortsov wrote:> > '?predict.lm' says that the prediction intervals returned by predict() > are for single observation only. Is there a way to specify the desired > number of observations to construct the interval for? >You can generate the desired sequence of new values using seq or sequence and submit them to predict.lm in the newdata argument. -- View this message in context: http://www.nabble.com/prediction-interval-for-multiple-future-observations-tf4303243.html#a12249044 Sent from the R help mailing list archive at Nabble.com.
Prof Brian Ripley
2007-Aug-21 07:16 UTC
[R] prediction interval for multiple future observations
On Mon, 20 Aug 2007, Vlad Skvortsov wrote:> Hi! > > '?predict.lm' says that the prediction intervals returned by predict() > are for single observation only. Is there a way to specify the desired > number of observations to construct the interval for?What it says in full is The prediction intervals are for a single observation at each case in 'newdata' (or by default, the data used for the fit) with error variance(s) 'pred.var'. I think you misunderstand: predict.lm returns a prediction interval for each row of 'newdata'. The comment in part means that those intervals are to be considered individually, and not as a joint prediction region for all the future observations. If you want, say, a prediction interval for the average of 10 indepedent observations at a case, use 'pred.var' to specify the error variance. -- 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