Re: [R] Linear Modeling and Predictions

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Tue 28 Jun 2005 - 06:09:36 EST

          Have you considered "predict" (including the examples with "?predict.lm")?

          spencer graves

Tony Young wrote:

> 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!
>
> ty
>
> ______________________________________________
> 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

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

spencer.graves@pdf.com
www.pdf.com <http://www.pdf.com>
Tel:  408-938-4420
Fax: 408-280-7915

______________________________________________
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 06:15:16 2005

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