[R] predict.lm How to introduce new data?
agent dunham
crosspide at hotmail.com
Wed Mar 23 15:05:34 CET 2011
Dear all,
I've fitted a lm using 61 data (training data), and I'left 10 as test data.
Training data and test data are stored in an excell.
training <- read.xls("C:/...../training.xls") , the same for test. That is:
v1
v2
...
v15
When I type str(training) and str(test), both sets have the same names
The resulting model is lms <- lm(vd ~ log(v1) + fv2+ fv5+ fv7 ) -fvi means
they were turned into factors-
plms<- predict(lms, new=test ,interval="prediction")
Error at model.frame.default(Terms, newdata, na.action = na.action, xlev =
object$xlevels) :
length of the variables are different (found for 'fv2')
More: Warning messages lost
'newdata' had 10 rows but variable(s) found have 61 rows
q1: What does it mean?
q2: Do I have to change test data names, so they have the same as the
resulting lm?
q3: Do I have to do anything special because of the log transformation?
q4: Afterwards I'd like to plot it, is this way?: plot(plms)
Thanks in advance, user at host.com
--
View this message in context: http://r.789695.n4.nabble.com/predict-lm-How-to-introduce-new-data-tp3399582p3399582.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list