In the following, we will evaluate the brand preferences of Blackwell´s customers using Random Forest Analysis. We will start by training and testing the model with the complete data set and then move on to predicting brand preferences.

Therefore, the following preparatory steps have been undertaken in advance.

*Loading data sets and libraries

*Renaming attributes

*Selecting subset of arrtributes, pre-processing

*Data splitting

Training the Random Forest Model with the training data

## Random Forest 
## 
## 7500 samples
##    3 predictor
##    2 classes: 'Belkin', 'Elago' 
## 
## Pre-processing: centered (3), scaled (3) 
## Resampling results across tuning parameters:
## 
##   mtry  Accuracy   Kappa    
##   2     0.7644000  0.5275373
##   3     0.7581333  0.5147988
## 
## Accuracy was used to select the optimal model using the largest value.
## The final value used for the model was mtry = 2.

Checking RF Model performance by predicting on the test data set

## rfPred
## Belkin  Elago 
##   1202   1298

Checking prediction performance with Confusion Metrix

## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Belkin Elago
##     Belkin    890   312
##     Elago     273  1025
##                                           
##                Accuracy : 0.766           
##                  95% CI : (0.7489, 0.7825)
##     No Information Rate : 0.5348          
##     P-Value [Acc > NIR] : <2e-16          
##                                           
##                   Kappa : 0.5307          
##                                           
##  Mcnemar's Test P-Value : 0.1162          
##                                           
##             Sensitivity : 0.7653          
##             Specificity : 0.7666          
##          Pos Pred Value : 0.7404          
##          Neg Pred Value : 0.7897          
##              Prevalence : 0.4652          
##          Detection Rate : 0.3560          
##    Detection Prevalence : 0.4808          
##       Balanced Accuracy : 0.7660          
##                                           
##        'Positive' Class : Belkin          
## 

Final Brand Predictions

## Random Forest 
## 
## 10000 samples
##     3 predictor
##     2 classes: 'Belkin', 'Elago' 
## 
## Pre-processing: centered (3), scaled (3) 
## Resampling results across tuning parameters:
## 
##   mtry  Accuracy  Kappa    
##   2     0.7658    0.5304365
##   3     0.7607    0.5200840
## 
## Accuracy was used to select the optimal model using the largest value.
## The final value used for the model was mtry = 2.
## 
## Belkin  Elago 
##   2468   2532