My model was chosen using a dataset with 180 observations and then 4 outliers were taken away so there are 176. We have to use it on a test set of data with 82 observations but it keeps displaying
warning: newdata has 82 rows but variables found has 176 rows".
How do I fix this?
Here is some of the code but I didn't post it all as most isn't relevant to the question. Thanks in advance!
OUTLIERS(XDATA=cbind(X3,X4,X5,X6,X9,X10),YDATA=Y)
#greatest outliers are 138, 161, 37, 116
#37 and 138 are very influential
#create dummy variables associated with factors
X2.=double(length(X2))
X2.[X2==2]=1
detach(diabetes)
data.=cbind(X2.,X3,X4,X5,X6,X9)
head(data.)
dim(data.)
lm(Y~data.)
fit9=lm(Y[c(-138,-161,-37,-116)]~data.[c(-138,-161,-37,-116),])
summary(fit9)
predictionA=predict(fit9,dataset$D.test)
predictionA