hello,

I'm trying to predict some values based on a linear regression model.
I've created the model using one dataframe, and have the prediction
values in a second data frame (call it newdata). There are 56 rows in
the dataframe used to create the model and 15 in newdata.

I ran predict(model1, newdata) and get the warning: 'newdata' had 15
rows but variable(s) found have 56 rows

When i checked help(predict.lm) I found this:

"Variables are first looked for in newdata and then searched for in
the usual way (which will include the environment of the formula used
in the fit). A warning will be given if the variables found are not of
the same length as those in newdata if it was supplied. "

My questions are - how can I just get predicted values for the 15 rows
in the newdata data frame, and if that's not possible, how can I tell
which of the 56 predicted values are derived from newdata only, if
any.

Thanks in advance for your help.

Larry

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to