Displaying 1 result from an estimated 1 matches for "trainingclass".
2006 Jan 29
2
SoS! How to predict new values using linear regression models?
Hi all,
After trial and error by myself for a few hours, I decide to ask for your
help.
I have a training set which is a matrix of size 200 x 2, where the two
columns denote each independent variable. I have 200 observations.
-----------------
ss=data.frame(trainingSet);
result=lm(trainingClass~ss$X1+ss$X2);
-----------------
where trainingClass denotes the true classes of the training data.
Now I want to apply the model to predict new data:
-----------------
> gg=predict(result, data.frame(X1=1, X2=2))
Warning message:
'newdata' had 1 rows but variable(s) found have 200 row...