Hi, 
  Please could someone explain how this element of predict.lm works?
>From the help file 
`
newdata   
An optional data frame in which to look for variables with which to
predict. If omitted, the fitted values are used.
' 
  Does this dataframe (newdata) need to have the same variable names as
was used in the original data frame used to fit the model? Or will R
just look across consecutive columns of newdata, and apply them to the
call as appropriate?
  For example, if I have fitted a model with four variables
(x1,x2,x3,x4) in my original dataframe, and then have a second dataframe
which I want to supply to the newdata argument in predict.lm with
variable names (x5, x6, x7, x8), do I need to change the variable names
in my newdata dataframe to match those of the original dataframe? Or
will R treat x5 as x1, x6 as x2, etc, when using predict.lm? 
  I would like to know so that I can design the structure of some
somewhat larger dataframes in a manner which will make using predict.lm
straight forward and quick.
Hope this makes sense.
Many thanks for any help. 
   Robin Williams
Met Office summer intern - Health Forecasting
[EMAIL PROTECTED] 
 

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to