rxgboostxgbclassifier

how to create a confusion matrix for xgboost in R


I have already created my XGBoost classifier in R as in below code

#importing the dataset
XGBoostDataSet_Hr_Admin_8 <- read.csv("CompletedDataImputed_HR_Admin.csv")

#Use factor function to convert categorical data to numerical data
XGBoostDataSet_Hr_Admin_8$Salary = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Salary, levels =c('L','M', 'H', 'V'), labels =c(1,2,3,4)))
XGBoostDataSet_Hr_Admin_8$Rude_Behavior = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Rude_Behavior, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
XGBoostDataSet_Hr_Admin_8$Feeling_undervalued =as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Feeling_undervalued, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
XGBoostDataSet_Hr_Admin_8$Overall_satisfaction = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Overall_satisfaction, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
XGBoostDataSet_Hr_Admin_8$Raises_frozen = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Raises_frozen, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
XGBoostDataSet_Hr_Admin_8$Poor_Conditions = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Poor_Conditions, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
XGBoostDataSet_Hr_Admin_8$Growth_not_available = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Growth_not_available, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
XGBoostDataSet_Hr_Admin_8$Workplace_Conflict = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Workplace_Conflict, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
XGBoostDataSet_Hr_Admin_8$Employee_Turnover = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Employee_Turnover, levels=c('Y', 'N'), labels =c(1,0)))

#split the data in train dataset and test dataset
library(caTools)
split = sample.split(XGBoostDataSet_Hr_Admin_8$Employee_Turnover,SplitRatio = 0.7)
training_set8 = subset(XGBoostDataSet_Hr_Admin_8, split==TRUE)
test_set8 = subset(XGBoostDataSet_Hr_Admin_8, split==FALSE)

#fitting XGBoost to the Training Test
library(xgboost)
classifier9 = xgboost(data = as.matrix(training_set8[-10]), label = training_set8$Employee_Turnover, nrounds = 10)

Now, I need to create a confusion matrix for the XGBoost.

I have searched on the net and unfortunately can't find the solution.

Can anyone please help me out.

Thanks in advance


Solution

  • Things to note, you need to convert your training_set8$Employee_Turnover to 0s and 1s. Hopefully you have done that, if not see my example below.

    Second, you need to specify, objective = "binary:logistic" when doing xgboost, this does classification.

    So starting with what you have:

    library(caTools)
    library(xgboost)
    library(caret)
    set.seed(12345)
    # reproducible results
    
    XGBoostDataSet_Hr_Admin_8 <- read.csv("CompletedDataImputed_HR_Admin.csv")
    
    #Use factor function to convert categorical data to numerical data
    XGBoostDataSet_Hr_Admin_8$Salary = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Salary, levels =c('L','M', 'H', 'V'), labels =c(1,2,3,4)))
    XGBoostDataSet_Hr_Admin_8$Rude_Behavior = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Rude_Behavior, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
    XGBoostDataSet_Hr_Admin_8$Feeling_undervalued =as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Feeling_undervalued, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
    XGBoostDataSet_Hr_Admin_8$Overall_satisfaction = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Overall_satisfaction, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
    XGBoostDataSet_Hr_Admin_8$Raises_frozen = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Raises_frozen, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
    XGBoostDataSet_Hr_Admin_8$Poor_Conditions = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Poor_Conditions, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
    XGBoostDataSet_Hr_Admin_8$Growth_not_available = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Growth_not_available, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
    XGBoostDataSet_Hr_Admin_8$Workplace_Conflict = as.numeric(factor(XGBoostDataSet_Hr_Admin_8$Workplace_Conflict, levels=c('Y', 'M', 'N'), labels =c(1,2,3)))
    

    For this part, we set the labels correctly as 0 and 1

    #set levels
    lvl = c('N', 'Y')
    # sorry I have to do it like this, it's too long for me to read
    lb = as.character(XGBoostDataSet_Hr_Admin_8$Employee_Turnover)
    lb = as.numeric(factor(lb,levels=lvl))-1
    XGBoostDataSet_Hr_Admin_8$Employee_Turnover = lb
    

    And we do the split into train + test as you have:

    #split the data in train dataset and test dataset
    split = sample.split(XGBoostDataSet_Hr_Admin_8$Employee_Turnover,SplitRatio = 0.7)
    training_set8 = subset(XGBoostDataSet_Hr_Admin_8, split==TRUE)
    test_set8 = subset(XGBoostDataSet_Hr_Admin_8, split==FALSE)
    

    Do the fit:

    #fitting XGBoost to the Training Test
    classifier9 = xgboost(data = as.matrix(training_set8[-10]), 
    label = training_set8$Employee_Turnover, nrounds = 10)
    

    Now we get the prediction in terms of probability and convert

    pred <- predict(classifier9, as.matrix(training_set8[-10]))
    # we convert to predicted labels
    pred_label <- lvl[as.numeric(pred>0.5)+1]
    # we get the observed label, or iris$Species
    actual_label <- lvl[as.numeric(training_set8$Employee_Turnover)+1]
    

    Last confusion matrix:

    # confusion matrix
    table(pred_label,actual_label)
              actual_label
    pred_label   N   Y
             N  41   0
             Y   0 158
    

    Or using caret:

    confusionMatrix(factor(pred_label,levels=lvl),
    factor(actual_label,levels=lvl))
        Confusion Matrix and Statistics
    
                  Reference
        Prediction   N   Y
                 N  41   0
                 Y   0 158
    

    This is the actual data (kindly provided by OP):

    structure(list(Salary = structure(c(2L, 3L, 2L, 3L, 2L, 3L, 2L, 
    2L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 2L, 3L, 3L, 2L, 2L, 2L, 
    3L, 2L, 3L, 2L, 2L, 3L, 1L, 2L, 2L, 3L, 3L, 2L, 3L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 2L, 2L, 2L, 2L, 2L, 
    3L, 1L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 2L, 
    2L, 3L, 2L, 3L, 2L, 2L, 3L, 2L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 
    2L, 2L, 3L, 3L, 2L, 3L, 2L, 3L, 2L, 2L, 3L, 3L, 2L, 3L, 2L, 3L, 
    3L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 2L, 3L, 2L, 3L, 2L, 3L, 3L, 2L, 
    2L, 3L, 2L, 2L, 2L, 3L, 3L, 2L, 3L, 2L, 3L, 2L, 2L, 3L, 3L, 3L, 
    2L, 3L, 2L, 2L, 2L, 3L, 2L, 2L, 3L, 3L, 3L, 2L, 2L, 3L, 2L, 2L, 
    2L, 2L, 3L, 2L, 3L, 2L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 
    2L, 2L, 3L, 2L, 3L, 2L, 3L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 
    2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 3L, 2L, 3L, 3L, 2L, 2L, 2L, 3L, 
    3L, 2L, 2L, 3L, 2L, 3L, 2L, 3L, 3L, 3L, 1L, 2L, 2L, 2L, 3L, 3L, 
    3L, 3L, 1L, 3L, 2L, 1L, 3L, 3L, 2L, 1L, 3L, 3L, 1L, 3L, 3L, 2L, 
    3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 
    3L, 3L, 4L, 3L, 3L, 3L, 3L, 2L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 
    3L, 2L, 2L, 3L, 2L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
    2L, 3L, 3L, 2L, 3L), .Label = c("H", "L", "M", "V"), class = "factor"), 
        Percentage_Increment = c(5, 10, 7, 7, 5, 7, 5, 5, 10, 5, 
        5, 5, 5, 5, 5, 10, 5, 5, 10, 10, 5, 5, 5, 5, 5, 5, 5, 5, 
        5, 10, 5, 5, 5, 5, 5, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 
        5, 5, 10, 7, 5, 5, 5, 5, 10, 10, 10, 5, 5, 5, 7, 10, 5, 5, 
        5, 7, 10, 5, 7, 5, 5, 10, 10, 10, 5, 5, 10, 5, 5, 5, 5, 5, 
        5, 5, 5, 10, 5, 5, 7, 7, 5, 10, 5, 5, 5, 5, 5, 7, 5, 10, 
        5, 5, 5, 5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5, 5, 5, 10, 5, 5, 
        5, 5, 5, 5, 5, 7, 5, 5, 5, 5, 5, 5, 5, 5, 10, 5, 10, 5, 5, 
        5, 7, 5, 7, 10, 7, 10, 5, 10, 10, 5, 7, 5, 5, 10, 5, 5, 5, 
        10, 5, 7, 5, 5, 5, 5, 10, 3, 5, 5, 10, 10, 5, 5, 7, 10, 5, 
        5, 5, 5, 5, 5, 5, 10, 5, 7, 5, 5, 5, 5, 5, 7, 5, 7, 5, 5, 
        5, 5, 5, 5, 5, 5, 5, 5, 7, 5, 7, 5, 5, 5, 10, 10, 5, 5, 5, 
        10, 5, 10, 10, 10, 10, 7, 5, 7, 5, 5, 10, 1, 10, 30, 1, 0.02, 
        5, 1, 11, 1, 3, 10, 1, 11, 1, 5, 10, 2.2, 18, 4, 10, 8, 1, 
        5, 9, 5, 4, 15, 15, 4, 10, 12, 1, 9, 3, 2.5, 5, 20, 30, 10, 
        5, 100, 10, 1, 1, 8, 1, 1, 2, 1, 5, 10, 1, 50, 50, 2, 3, 
        25, 1, 1), Rude_Behavior = structure(c(3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 3L, 
        3L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 2L, 3L, 3L, 3L, 
        3L, 1L, 3L, 3L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 1L, 3L, 2L, 1L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 2L, 
        3L, 2L, 3L, 2L, 3L, 3L, 3L, 3L, 1L, 2L, 3L, 3L, 3L, 2L, 3L, 
        3L, 1L, 2L, 3L, 3L, 1L, 3L, 3L, 3L, 1L, 2L, 3L, 2L, 1L, 1L, 
        2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 
        1L, 2L, 1L, 2L, 2L, 2L, 1L, 3L, 2L, 3L, 3L, 3L, 2L, 2L, 3L, 
        3L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 3L, 2L, 2L, 3L, 2L, 3L, 
        2L, 2L, 2L, 3L, 3L, 2L, 2L, 3L, 1L), .Label = c("M", "N", 
        "Y"), class = "factor"), Feeling_undervalued = structure(c(1L, 
        2L, 3L, 1L, 3L, 3L, 1L, 3L, 3L, 1L, 3L, 1L, 3L, 3L, 1L, 3L, 
        3L, 2L, 3L, 2L, 3L, 3L, 2L, 3L, 3L, 2L, 3L, 3L, 3L, 2L, 3L, 
        3L, 1L, 3L, 3L, 2L, 3L, 3L, 1L, 3L, 3L, 2L, 3L, 3L, 1L, 2L, 
        3L, 3L, 3L, 2L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 1L, 3L, 3L, 3L, 
        2L, 3L, 1L, 3L, 3L, 3L, 2L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 
        3L, 3L, 3L, 1L, 3L, 3L, 2L, 3L, 3L, 2L, 3L, 3L, 1L, 3L, 3L, 
        3L, 2L, 3L, 3L, 1L, 3L, 3L, 2L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 2L, 3L, 2L, 3L, 3L, 2L, 1L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 
        3L, 3L, 3L, 3L, 2L, 3L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        2L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 1L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 
        2L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 3L, 2L, 3L, 1L, 
        3L, 3L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 
        3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 1L, 3L, 3L, 2L, 1L, 2L, 1L, 
        3L, 2L, 2L, 2L, 1L, 3L, 2L, 2L, 3L, 2L, 2L, 2L, 2L, 2L, 1L, 
        2L, 2L, 1L, 3L, 1L, 2L, 3L, 1L, 3L, 1L, 1L, 2L, 3L, 3L, 1L, 
        2L, 1L, 3L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 3L, 2L, 1L, 3L, 
        2L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 3L, 1L, 2L, 3L, 2L), .Label = c("M", 
        "N", "Y"), class = "factor"), Overall_satisfaction = structure(c(2L, 
        3L, 3L, 3L, 2L, 3L, 3L, 3L, 1L, 3L, 2L, 3L, 3L, 2L, 3L, 2L, 
        3L, 3L, 3L, 1L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 
        3L, 2L, 1L, 3L, 3L, 3L, 2L, 3L, 3L, 1L, 2L, 3L, 3L, 3L, 3L, 
        2L, 3L, 2L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 3L, 1L, 1L, 2L, 3L, 
        3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 
        3L, 3L, 1L, 2L, 3L, 3L, 2L, 3L, 1L, 1L, 3L, 3L, 3L, 3L, 2L, 
        1L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 1L, 3L, 3L, 3L, 2L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 
        3L, 1L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 
        2L, 3L, 3L, 2L, 3L, 3L, 1L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 
        3L, 3L, 3L, 3L, 1L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 
        3L, 3L, 3L, 2L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 1L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 
        1L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 
        3L, 2L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 3L, 1L, 2L, 3L, 3L, 3L, 2L, 
        2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 3L, 2L, 1L, 1L, 
        2L, 3L, 1L, 2L, 1L, 2L, 2L, 2L, 3L, 1L, 2L, 3L, 1L), .Label = c("M", 
        "N", "Y"), class = "factor"), Poor_Conditions = structure(c(3L, 
        1L, 3L, 2L, 3L, 3L, 3L, 1L, 2L, 3L, 1L, 3L, 3L, 1L, 2L, 3L, 
        3L, 3L, 3L, 1L, 3L, 2L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 2L, 
        3L, 1L, 3L, 3L, 2L, 3L, 1L, 3L, 3L, 3L, 1L, 3L, 2L, 3L, 1L, 
        3L, 2L, 3L, 3L, 2L, 3L, 3L, 1L, 3L, 1L, 3L, 3L, 2L, 3L, 3L, 
        3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 2L, 3L, 3L, 
        3L, 2L, 3L, 1L, 3L, 3L, 1L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 
        1L, 1L, 3L, 1L, 3L, 3L, 2L, 3L, 3L, 1L, 3L, 3L, 3L, 3L, 2L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 1L, 2L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 1L, 3L, 3L, 1L, 
        3L, 2L, 3L, 3L, 3L, 3L, 3L, 1L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 
        3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 1L, 3L, 
        3L, 1L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 
        3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 2L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 1L, 3L, 
        2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 1L, 3L, 
        3L, 1L, 3L, 1L, 2L, 3L, 3L, 2L, 2L, 1L, 2L, 2L, 1L, 2L, 1L, 
        2L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L, 3L, 1L, 3L, 3L, 
        1L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 3L, 1L, 2L, 3L, 
        3L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 2L), .Label = c("M", 
        "N", "Y"), class = "factor"), Raises_frozen = structure(c(2L, 
        3L, 3L, 2L, 2L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 2L, 3L, 3L, 2L, 3L, 2L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 
        3L, 2L, 2L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 2L, 
        3L, 3L, 3L, 3L, 2L, 3L, 2L, 2L, 3L, 3L, 3L, 2L, 3L, 3L, 2L, 
        2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 2L, 2L, 2L, 3L, 
        2L, 2L, 3L, 3L, 2L, 2L, 3L, 2L, 3L, 2L, 2L, 2L, 2L, 3L, 3L, 
        2L, 3L, 2L, 3L, 3L, 3L, 2L, 2L, 3L, 2L, 2L, 3L, 2L, 3L, 2L, 
        3L, 2L, 3L, 2L, 3L, 3L, 3L, 2L, 3L, 3L, 2L, 2L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 2L, 3L, 
        2L, 3L, 3L, 2L, 2L, 3L, 2L, 3L, 2L, 3L, 3L, 2L, 3L, 3L, 3L, 
        3L, 3L, 2L, 3L, 2L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 2L, 3L, 3L, 2L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 
        2L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        2L, 3L, 3L, 3L, 1L, 2L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 2L, 3L, 
        3L, 3L, 3L, 1L, 1L, 3L, 3L, 3L, 3L, 1L, 2L, 3L, 3L, 1L, 3L, 
        1L, 1L, 1L, 3L, 3L, 1L, 3L, 1L, 3L, 3L, 1L, 2L, 3L, 2L, 1L, 
        3L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 1L, 2L, 1L), .Label = c("M", 
        "N", "Y"), class = "factor"), Growth_not_available = structure(c(1L, 
        3L, 1L, 3L, 2L, 2L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 1L, 3L, 3L, 
        2L, 3L, 1L, 3L, 3L, 3L, 3L, 1L, 3L, 2L, 3L, 2L, 3L, 2L, 3L, 
        2L, 3L, 2L, 3L, 3L, 2L, 3L, 3L, 2L, 3L, 3L, 3L, 2L, 3L, 3L, 
        3L, 3L, 1L, 3L, 3L, 2L, 3L, 3L, 3L, 2L, 3L, 1L, 3L, 2L, 1L, 
        3L, 3L, 3L, 1L, 3L, 2L, 3L, 3L, 2L, 3L, 3L, 1L, 3L, 3L, 3L, 
        1L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 2L, 1L, 3L, 3L, 
        3L, 2L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 1L, 3L, 2L, 3L, 3L, 1L, 
        3L, 3L, 1L, 2L, 3L, 1L, 3L, 3L, 3L, 3L, 2L, 1L, 3L, 2L, 3L, 
        3L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 2L, 1L, 3L, 3L, 2L, 3L, 3L, 
        3L, 3L, 3L, 3L, 1L, 3L, 2L, 3L, 1L, 3L, 2L, 3L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 1L, 2L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 1L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 
        3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 1L, 3L, 3L, 3L, 3L, 2L, 3L, 
        3L, 1L, 3L, 3L, 3L, 2L, 3L, 3L, 1L, 3L, 2L, 3L, 3L, 3L, 2L, 
        2L, 3L, 2L, 3L, 3L, 1L, 3L, 3L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 
        1L, 3L, 2L, 2L, 1L, 1L, 2L, 3L, 3L, 1L, 3L, 2L, 1L, 2L, 2L, 
        1L, 2L, 1L, 3L, 1L, 3L, 3L, 2L, 3L, 3L, 3L, 2L, 3L, 2L, 2L, 
        3L, 2L, 1L, 3L, 1L, 3L, 3L, 3L, 3L, 1L, 1L, 2L, 3L), .Label = c("M", 
        "N", "Y"), class = "factor"), Workplace_Conflict = structure(c(3L, 
        3L, 3L, 3L, 3L, 3L, 1L, 3L, 2L, 3L, 1L, 3L, 3L, 3L, 2L, 3L, 
        3L, 2L, 3L, 1L, 3L, 3L, 2L, 3L, 1L, 3L, 3L, 1L, 3L, 2L, 3L, 
        3L, 3L, 3L, 2L, 3L, 3L, 2L, 1L, 3L, 3L, 2L, 1L, 3L, 3L, 3L, 
        2L, 3L, 1L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 2L, 3L, 1L, 
        3L, 3L, 3L, 2L, 3L, 3L, 3L, 1L, 2L, 3L, 3L, 3L, 2L, 3L, 3L, 
        2L, 3L, 3L, 1L, 3L, 2L, 3L, 3L, 1L, 3L, 2L, 3L, 3L, 2L, 3L, 
        3L, 1L, 3L, 3L, 1L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 1L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 1L, 
        3L, 3L, 3L, 3L, 2L, 1L, 1L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 
        3L, 1L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 2L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 
        3L, 3L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 
        3L, 2L, 3L, 3L, 1L, 2L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 
        3L, 2L, 3L, 3L, 3L, 1L, 3L, 2L, 3L, 1L, 3L, 3L, 2L, 3L, 1L, 
        3L, 2L, 2L, 3L, 2L, 1L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 3L, 2L, 
        2L, 2L, 1L, 1L, 1L, 2L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 
        3L, 1L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 1L, 
        1L, 3L, 3L, 3L, 1L, 2L, 2L, 1L, 3L, 2L, 3L, 3L, 2L), .Label = c("M", 
        "N", "Y"), class = "factor"), Employee_Turnover = structure(c(2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
        2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 
        1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
        1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
        1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
        1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("N", 
        "Y"), class = "factor")), class = "data.frame", row.names = c(NA, 
    -284L))