[R] Linear Model Prediction

R. Michael Weylandt michael.weylandt at gmail.com
Tue Jul 24 22:11:24 CEST 2012


On Tue, Jul 24, 2012 at 2:06 PM,  <bunnylover23 at optonline.net> wrote:
> Yes, why wouldn't I? It's a linear model between two sets of data: x and y.

Conventionally, one predicts y based on x -- which is specified y ~ x,
not x ~ y. (Predictors on the RHS, predicted on the LHS)

>
> Also, what would the new data be if i want to predict into the future? So,
> for example, the data goes from a month ago to today. I want to predict what
> tomorrow's data would be. So what is "newdata"?

Well, it sounds like you really need a time series model, not a linear
regression. Linear regressions are more or less unordered in x: that
is, there's no unique "next" value for "x" -- there's just what
happens next. For instance, if I were doing a gas law experiment and I
saw the pressure of some fixed amount  and volume of helium at temps
30, 40 25, 50, 75, and 20 C -- what would I expect from my next
experiment? Who knows -- you haven't told me the independent variable
yet.

Time series models on the other hand have a well defined "next
observation". It is sometimes possible (though not advisable) to fake
a time series model by regressing on the date (after conversion to a
number) but you'll still have to say what the next input is by
converting the date of the future obs to a number again. This is
probably not statistically advisable.

Incidentally, please keep posts on the list archives and cc R-help
unless there's good reason to keep the discussion private.

Michael



More information about the R-help mailing list