Hey, I am running a Multiple regression model. And my aim is to get the confusion Matrix for the below model but, it gives me an error.
Here is the code:
Loading the data
Train_data = DATA_Pressure_Depletion
Test_data = Test1
# Checking the summary of the data
summary(Train_data)
summary(Test_data)
# Plotting the Missmap of the data.
missmap(Train_data)
missmap(Test1)
# Multiple regression Model
model_reg <- lm(`Experimental AOP`~., data = Train_data)
summary(model_reg)
# Prediction
predict_1 <- predict(model_reg, newdata = Test_data)
confusionMatrix(predict_1, Test_data$`Experimental AOP`)
Error:
Error:
dataand
reference should be factors with the same levels.
Data for Train:
Temp | Pb | Experimental AOP |
---|---|---|
210.2 | 3221 | 6854 |
219.2 | 3283 | 6587 |
230 | 3276 | 6419 |
240 | 3289 | 6225 |
212 | 4259 | 5299 |
289 | 4283 | 7300 |
240 | 4150 | 7550 |
289 | 4843 | 6900 |
248 | 4617 | 8500 |
208 | 2420 | 4600 |
150 | 2128 | 5050 |
100 | 1850 | 6700 |
208 | 3617 | 5200 |
150 | 3460 | 6300 |
100 | 3565 | 8500 |
271 | 2902 | 4500 |
182 | 2568 | 4200 |
94 | 1922 | 3700 |
284 | 2692 | 5005 |
248 | 2480 | 5228 |
194 | 2377 | 5511 |
167 | 2027 | 5600 |
284 | 2940 | 5398 |
248 | 2850 | 6607 |
178 | 2620 | 6874 |
144 | 2435 | 8705 |
275 | 3720 | 4967 |
235 | 3583 | 5143 |
194 | 3413 | 5555 |
Test data:
Temp | Pb | Experimental AOP |
---|---|---|
254.93 | 2300 | 3755.5 |
244.13 | 1900 | 3552.5 |
230 | 2400 | 3799 |
236 | 2500 | 3944 |
190.13 | 4263 | 5800 |
190 | 2500 | 5400 |
230 | 2700 | 4050 |
260 | 2900 | 3650 |
240 | 3059 | 4513 |
230 | 3060 | 4600 |
240 | 3064 | 4405 |
230 | 3150 | 4640 |