[R] Linear Modeling and Predictions

From: Tony Young <wayoung_at_softbase.math.uwaterloo.ca>
Date: Tue 28 Jun 2005 - 03:27:42 EST

Hello all,

I need some help with linear modeling and making predictions using my model. What I have done is the following:

-Read my variable data into R using read.table
-Assigned the values to variable names so that each variable is a
vector from the table
-Generated my model using the lm command and each of my variables
-Read some new data with which to make predictions into a new data
frame (the variables have the same names as the ones used to build the model, but the new variables are in a frame called "new")

Now, what I want to do is use the model that R constructed and feed it new values for the variables, then get back the estimated response variable value. I can't seem to figure out how to do this using predict or predict.lm. I get a warning that the new data contained 36 values (there are 36 new sets of values that I want predictions for using the model) when the original data set contains 5136 values. Then, the fitted values are the ones that were from the model creation

Any help would be appreciated!


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jun 28 03:34:53 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:03 EST