DAta Dwonloading and importation

# Define the URLs
#urls <- c(
#  "https://excelbianalytics.com/wp/wp-content/uploads/2017/07/1000000%20Sales%20Records.zip",
#  "https://excelbianalytics.com/wp/wp-content/uploads/2017/07/1500000%20Sales%20Records.zip"
#)
#
## Define the filenames to save the zip files locally
#file_names <- c("1000000_Sales_Records.zip", "1500000_Sales_Records.zip")
#
## Download, extract, and import CSV files individually
#for (i in 1:length(urls)) {
#  # Download the zip file
#  download.file(urls[i], destfile = file_names[i], mode = "wb")
#  cat("Downloaded:", file_names[i], "\n")
#  
#  # Extract the downloaded zip file
#  unzip_dir <- paste0("extracted_", i)
#  unzip(file_names[i], exdir = unzip_dir)
#  cat("Extracted to folder:", unzip_dir, "\n")
#  
#  # Get the CSV file path (assuming only one CSV file per ZIP)
#  csv_file <- list.files(unzip_dir, pattern = "\\.csv$", full.names = TRUE)
#  
#  # Import the CSV file into R with a unique data frame name
#  if (length(csv_file) > 0) {
#    df_name <- paste0("sales_data_", i)  # e.g., "sales_data_1", "sales_data_2"
#    assign(df_name, read.csv(csv_file[1], stringsAsFactors = FALSE))
#    cat("Imported CSV file as data frame:", df_name, "\n")
#  } else {
#    cat("No CSV file found in", unzip_dir, "\n")
#  }
#}
## incase above code is not working due to slow internet
library(readr)
sales_data_1 <- read_csv("~/GIT/Data/1000000 Sales Records.csv")
## Rows: 1000000 Columns: 14
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (7): Region, Country, Item Type, Sales Channel, Order Priority, Order Da...
## dbl (7): Order ID, Units Sold, Unit Price, Unit Cost, Total Revenue, Total C...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
sales_data_2 <- read_csv("~/GIT/Data/1500000 Sales Records.csv")
## Rows: 1500000 Columns: 14
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (7): Region, Country, Item Type, Sales Channel, Order Priority, Order Da...
## dbl (7): Order ID, Units Sold, Unit Price, Unit Cost, Total Revenue, Total C...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Dataframe view data1million

head(sales_data_1)
## # A tibble: 6 × 14
##   Region       Country `Item Type` `Sales Channel` `Order Priority` `Order Date`
##   <chr>        <chr>   <chr>       <chr>           <chr>            <chr>       
## 1 Sub-Saharan… South … Fruits      Offline         M                7/27/2012   
## 2 Middle East… Morocco Clothes     Online          M                9/14/2013   
## 3 Australia a… Papua … Meat        Offline         M                5/15/2015   
## 4 Sub-Saharan… Djibou… Clothes     Offline         H                5/17/2017   
## 5 Europe       Slovak… Beverages   Offline         L                10/26/2016  
## 6 Asia         Sri La… Fruits      Online          L                11/7/2011   
## # ℹ 8 more variables: `Order ID` <dbl>, `Ship Date` <chr>, `Units Sold` <dbl>,
## #   `Unit Price` <dbl>, `Unit Cost` <dbl>, `Total Revenue` <dbl>,
## #   `Total Cost` <dbl>, `Total Profit` <dbl>

Dataframe view Data1.5million

head(sales_data_2)
## # A tibble: 6 × 14
##   Region       Country `Item Type` `Sales Channel` `Order Priority` `Order Date`
##   <chr>        <chr>   <chr>       <chr>           <chr>            <chr>       
## 1 Sub-Saharan… South … Fruits      Offline         M                7/27/2012   
## 2 Middle East… Morocco Clothes     Online          M                9/14/2013   
## 3 Australia a… Papua … Meat        Offline         M                5/15/2015   
## 4 Sub-Saharan… Djibou… Clothes     Offline         H                5/17/2017   
## 5 Europe       Slovak… Beverages   Offline         L                10/26/2016  
## 6 Asia         Sri La… Fruits      Online          L                11/7/2011   
## # ℹ 8 more variables: `Order ID` <dbl>, `Ship Date` <chr>, `Units Sold` <dbl>,
## #   `Unit Price` <dbl>, `Unit Cost` <dbl>, `Total Revenue` <dbl>,
## #   `Total Cost` <dbl>, `Total Profit` <dbl>

Getting column Names and structure and summary

colnames(sales_data_1)
##  [1] "Region"         "Country"        "Item Type"      "Sales Channel" 
##  [5] "Order Priority" "Order Date"     "Order ID"       "Ship Date"     
##  [9] "Units Sold"     "Unit Price"     "Unit Cost"      "Total Revenue" 
## [13] "Total Cost"     "Total Profit"
str(sales_data_1)
## spc_tbl_ [1,000,000 × 14] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
##  $ Region        : chr [1:1000000] "Sub-Saharan Africa" "Middle East and North Africa" "Australia and Oceania" "Sub-Saharan Africa" ...
##  $ Country       : chr [1:1000000] "South Africa" "Morocco" "Papua New Guinea" "Djibouti" ...
##  $ Item Type     : chr [1:1000000] "Fruits" "Clothes" "Meat" "Clothes" ...
##  $ Sales Channel : chr [1:1000000] "Offline" "Online" "Offline" "Offline" ...
##  $ Order Priority: chr [1:1000000] "M" "M" "M" "H" ...
##  $ Order Date    : chr [1:1000000] "7/27/2012" "9/14/2013" "5/15/2015" "5/17/2017" ...
##  $ Order ID      : num [1:1000000] 4.43e+08 6.68e+08 9.41e+08 8.81e+08 1.75e+08 ...
##  $ Ship Date     : chr [1:1000000] "7/28/2012" "10/19/2013" "6/4/2015" "7/2/2017" ...
##  $ Units Sold    : num [1:1000000] 1593 4611 360 562 3973 ...
##  $ Unit Price    : num [1:1000000] 9.33 109.28 421.89 109.28 47.45 ...
##  $ Unit Cost     : num [1:1000000] 6.92 35.84 364.69 35.84 31.79 ...
##  $ Total Revenue : num [1:1000000] 14863 503890 151880 61415 188519 ...
##  $ Total Cost    : num [1:1000000] 11024 165258 131288 20142 126302 ...
##  $ Total Profit  : num [1:1000000] 3839 338632 20592 41273 62217 ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   Region = col_character(),
##   ..   Country = col_character(),
##   ..   `Item Type` = col_character(),
##   ..   `Sales Channel` = col_character(),
##   ..   `Order Priority` = col_character(),
##   ..   `Order Date` = col_character(),
##   ..   `Order ID` = col_double(),
##   ..   `Ship Date` = col_character(),
##   ..   `Units Sold` = col_double(),
##   ..   `Unit Price` = col_double(),
##   ..   `Unit Cost` = col_double(),
##   ..   `Total Revenue` = col_double(),
##   ..   `Total Cost` = col_double(),
##   ..   `Total Profit` = col_double()
##   .. )
##  - attr(*, "problems")=<externalptr>
str(sales_data_2)
## spc_tbl_ [1,500,000 × 14] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
##  $ Region        : chr [1:1500000] "Sub-Saharan Africa" "Middle East and North Africa" "Australia and Oceania" "Sub-Saharan Africa" ...
##  $ Country       : chr [1:1500000] "South Africa" "Morocco" "Papua New Guinea" "Djibouti" ...
##  $ Item Type     : chr [1:1500000] "Fruits" "Clothes" "Meat" "Clothes" ...
##  $ Sales Channel : chr [1:1500000] "Offline" "Online" "Offline" "Offline" ...
##  $ Order Priority: chr [1:1500000] "M" "M" "M" "H" ...
##  $ Order Date    : chr [1:1500000] "7/27/2012" "9/14/2013" "5/15/2015" "5/17/2017" ...
##  $ Order ID      : num [1:1500000] 4.43e+08 6.68e+08 9.41e+08 8.81e+08 1.75e+08 ...
##  $ Ship Date     : chr [1:1500000] "7/28/2012" "10/19/2013" "6/4/2015" "7/2/2017" ...
##  $ Units Sold    : num [1:1500000] 1593 4611 360 562 3973 ...
##  $ Unit Price    : num [1:1500000] 9.33 109.28 421.89 109.28 47.45 ...
##  $ Unit Cost     : num [1:1500000] 6.92 35.84 364.69 35.84 31.79 ...
##  $ Total Revenue : num [1:1500000] 14863 503890 151880 61415 188519 ...
##  $ Total Cost    : num [1:1500000] 11024 165258 131288 20142 126302 ...
##  $ Total Profit  : num [1:1500000] 3839 338632 20592 41273 62217 ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   Region = col_character(),
##   ..   Country = col_character(),
##   ..   `Item Type` = col_character(),
##   ..   `Sales Channel` = col_character(),
##   ..   `Order Priority` = col_character(),
##   ..   `Order Date` = col_character(),
##   ..   `Order ID` = col_double(),
##   ..   `Ship Date` = col_character(),
##   ..   `Units Sold` = col_double(),
##   ..   `Unit Price` = col_double(),
##   ..   `Unit Cost` = col_double(),
##   ..   `Total Revenue` = col_double(),
##   ..   `Total Cost` = col_double(),
##   ..   `Total Profit` = col_double()
##   .. )
##  - attr(*, "problems")=<externalptr>

1million data Structure

summary(sales_data_1)
##     Region            Country           Item Type         Sales Channel     
##  Length:1000000     Length:1000000     Length:1000000     Length:1000000    
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##  Order Priority      Order Date           Order ID          Ship Date        
##  Length:1000000     Length:1000000     Min.   :100001180   Length:1000000    
##  Class :character   Class :character   1st Qu.:323962950   Class :character  
##  Mode  :character   Mode  :character   Median :548652350   Mode  :character  
##                                        Mean   :549352019                     
##                                        3rd Qu.:774598097                     
##                                        Max.   :999999892                     
##    Units Sold      Unit Price       Unit Cost      Total Revenue    
##  Min.   :    1   Min.   :  9.33   Min.   :  6.92   Min.   :      9  
##  1st Qu.: 2502   1st Qu.: 81.73   1st Qu.: 35.84   1st Qu.: 277867  
##  Median : 4998   Median :154.06   Median : 97.44   Median : 784445  
##  Mean   : 4999   Mean   :266.03   Mean   :187.52   Mean   :1329563  
##  3rd Qu.: 7496   3rd Qu.:421.89   3rd Qu.:263.33   3rd Qu.:1822444  
##  Max.   :10000   Max.   :668.27   Max.   :524.96   Max.   :6682700  
##    Total Cost       Total Profit      
##  Min.   :      7   Min.   :      2.4  
##  1st Qu.: 161729   1st Qu.:  95104.8  
##  Median : 466782   Median : 281054.9  
##  Mean   : 937267   Mean   : 392295.6  
##  3rd Qu.:1196327   3rd Qu.: 565307.6  
##  Max.   :5249600   Max.   :1738700.0

1.5 million data Structure

summary(sales_data_2)
##     Region            Country           Item Type         Sales Channel     
##  Length:1500000     Length:1500000     Length:1500000     Length:1500000    
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##  Order Priority      Order Date           Order ID          Ship Date        
##  Length:1500000     Length:1500000     Min.   :100001180   Length:1500000    
##  Class :character   Class :character   1st Qu.:324686288   Class :character  
##  Mode  :character   Mode  :character   Median :549792182   Mode  :character  
##                                        Mean   :550068060                     
##                                        3rd Qu.:775627851                     
##                                        Max.   :999999892                     
##    Units Sold      Unit Price       Unit Cost      Total Revenue    
##  Min.   :    1   Min.   :  9.33   Min.   :  6.92   Min.   :      9  
##  1st Qu.: 2501   1st Qu.: 81.73   1st Qu.: 35.84   1st Qu.: 277719  
##  Median : 4998   Median :154.06   Median : 97.44   Median : 785329  
##  Mean   : 4999   Mean   :266.05   Mean   :187.55   Mean   :1329888  
##  3rd Qu.: 7498   3rd Qu.:421.89   3rd Qu.:263.33   3rd Qu.:1821933  
##  Max.   :10000   Max.   :668.27   Max.   :524.96   Max.   :6682700  
##    Total Cost       Total Profit      
##  Min.   :      7   Min.   :      2.4  
##  1st Qu.: 161818   1st Qu.:  95066.4  
##  Median : 467357   Median : 281370.4  
##  Mean   : 937488   Mean   : 392399.9  
##  3rd Qu.:1196572   3rd Qu.: 565425.2  
##  Max.   :5249600   Max.   :1738700.0

Data shape

# Get the shape of sales_data_1
shape_sales_data_1 <- dim(sales_data_1)

# Get the shape of sales_data_2
shape_sales_data_2 <- dim(sales_data_2)

# Print the shapes
print(paste("Shape of sales_data_1:", shape_sales_data_1[1], "rows and", shape_sales_data_1[2], "columns"))
## [1] "Shape of sales_data_1: 1000000 rows and 14 columns"
print(paste("Shape of sales_data_2:", shape_sales_data_2[1], "rows and", shape_sales_data_2[2], "columns"))
## [1] "Shape of sales_data_2: 1500000 rows and 14 columns"

Vizualization

sales_data_1
## # A tibble: 1,000,000 × 14
##    Region      Country `Item Type` `Sales Channel` `Order Priority` `Order Date`
##    <chr>       <chr>   <chr>       <chr>           <chr>            <chr>       
##  1 Sub-Sahara… South … Fruits      Offline         M                7/27/2012   
##  2 Middle Eas… Morocco Clothes     Online          M                9/14/2013   
##  3 Australia … Papua … Meat        Offline         M                5/15/2015   
##  4 Sub-Sahara… Djibou… Clothes     Offline         H                5/17/2017   
##  5 Europe      Slovak… Beverages   Offline         L                10/26/2016  
##  6 Asia        Sri La… Fruits      Online          L                11/7/2011   
##  7 Sub-Sahara… Seyche… Beverages   Online          M                1/18/2013   
##  8 Sub-Sahara… Tanzan… Beverages   Online          L                11/30/2016  
##  9 Sub-Sahara… Ghana   Office Sup… Online          L                3/23/2017   
## 10 Sub-Sahara… Tanzan… Cosmetics   Offline         L                5/23/2016   
## # ℹ 999,990 more rows
## # ℹ 8 more variables: `Order ID` <dbl>, `Ship Date` <chr>, `Units Sold` <dbl>,
## #   `Unit Price` <dbl>, `Unit Cost` <dbl>, `Total Revenue` <dbl>,
## #   `Total Cost` <dbl>, `Total Profit` <dbl>

1. Boxplots

library(ggplot2)

# Boxplot for Total Revenue in sales_data_1
ggplot(sales_data_1, aes(x = `Item Type`, y = `Total Revenue`)) +
  geom_boxplot() +
  ggtitle("Boxplot of Total Revenue by Item Type (1M Records)") +
  xlab("Item Type") +
  ylab("Total Revenue") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

# Boxplot for Total Revenue in sales_data_2
ggplot(sales_data_2, aes(x = `Item Type`, y = `Total Revenue`)) +
  geom_boxplot() +
  ggtitle("Boxplot of Total Revenue by Item Type (1.5M Records)") +
  xlab("Item Type") +
  ylab("Total Revenue") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

2. Histograms

# Histogram for Total Revenue in sales_data_1
ggplot(sales_data_1, aes(x = `Total Revenue`)) +
  geom_histogram(bins = 50, fill = "blue", alpha = 0.7) +
  ggtitle("Histogram of Total Revenue (1M Records)") +
  xlab("Total Revenue") +
  ylab("Frequency")

# Histogram for Total Revenue in sales_data_2
ggplot(sales_data_2, aes(x = `Total Revenue`)) +
  geom_histogram(bins = 50, fill = "red", alpha = 0.7) +
  ggtitle("Histogram of Total Revenue (1.5M Records)") +
  xlab("Total Revenue") +
  ylab("Frequency")

3. Heatmaps

library(reshape2)


# Calculate the correlation matrix for sales_data_1
cor_matrix_1 <- cor(sales_data_1[, sapply(sales_data_1, is.numeric)], use = "complete.obs")

# Reshape the correlation matrix for heatmap
cor_melted_1 <- melt(cor_matrix_1)

# Heatmap for sales_data_1
ggplot(cor_melted_1, aes(Var1, Var2, fill = value)) +
  geom_tile() +
  scale_fill_gradient2(low = "red", high = "green", mid = "white", 
                       midpoint = 0, limit = c(-1,1), space = "Lab", 
                       name="Correlation") +
  theme_minimal() +
  ggtitle("Correlation Heatmap (1M Records)")

# Calculate the correlation matrix for sales_data_2
cor_matrix_2 <- cor(sales_data_2[, sapply(sales_data_2, is.numeric)], use = "complete.obs")

# Reshape the correlation matrix for heatmap
cor_melted_2 <- melt(cor_matrix_2)

# Heatmap for sales_data_2
ggplot(cor_melted_2, aes(Var1, Var2, fill = value)) +
  geom_tile() +
  scale_fill_gradient2(low = "blue", high = "red", mid = "green", 
                       midpoint = 0, limit = c(-1,1), space = "Lab", 
                       name="Correlation") +
  theme_minimal() +
  ggtitle("Correlation Heatmap (1.5M Records)")

4. Scatterplots

Scatterplots can help visualize relationships between two numeric variables.

# Scatterplot for Total Revenue vs. Units Sold in sales_data_1
ggplot(sales_data_1, aes(x = `Units Sold`, y = `Total Revenue`)) +
  geom_point(alpha = 0.5) +
  ggtitle("Total Revenue vs. Units Sold (1M Records)") +
  xlab("Units Sold") +
  ylab("Total Revenue")

# Scatterplot for Total Revenue vs. Units Sold in sales_data_2
ggplot(sales_data_2, aes(x = `Units Sold`, y = `Total Revenue`)) +
  geom_point(alpha = 0.5) +
  ggtitle("Total Revenue vs. Units Sold (1.5M Records)") +
  xlab("Units Sold") +
  ylab("Total Revenue")

5. Correlation Plots

You can also visualize the correlation matrix using the corrplot package.

library(corrplot)
## corrplot 0.94 loaded
# Correlation plot for sales_data_1
corrplot(cor_matrix_1, method = "circle", type = "upper", tl.col = "black", tl.srt = 45, 
         title = "Correlation Plot (1M Records)")

# Correlation plot for sales_data_2
corrplot(cor_matrix_2, method = "circle", type = "upper", tl.col = "black", tl.srt = 45, 
         title = "Correlation Plot (1.5M Records)")

Models

Data preparation

# Load necessary packages
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
# Convert Order.Date and Ship.Date to Date type
sales_data_1 <- sales_data_1 %>%
  mutate(Order.Date = as.Date(`Order Date`, format="%m/%d/%Y"),
         Ship.Date = as.Date(`Ship Date`, format="%m/%d/%Y"))

sales_data_2 <- sales_data_2 %>%
  mutate(Order.Date = as.Date(`Order Date`, format="%m/%d/%Y"  ),
         Ship.Date = as.Date(`Ship Date`, format="%m/%d/%Y"))

Linear REgresison

# Linear regression for sales_data_1
linear_model_1 <- lm(`Total Revenue` ~ `Units Sold`, data = sales_data_1)
summary(linear_model_1)
## 
## Call:
## lm(formula = `Total Revenue` ~ `Units Sold`, data = sales_data_1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2565044  -789981  -183891   576713  4024356 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1383.0580  2505.5845   0.552    0.581    
## `Units Sold`  265.6961     0.4341 612.052   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1253000 on 999998 degrees of freedom
## Multiple R-squared:  0.2725, Adjusted R-squared:  0.2725 
## F-statistic: 3.746e+05 on 1 and 999998 DF,  p-value: < 2.2e-16
# Linear regression for sales_data_2
linear_model_2 <- lm(`Total Revenue` ~ `Units Sold`, data = sales_data_2)
summary(linear_model_2)
## 
## Call:
## lm(formula = `Total Revenue` ~ `Units Sold`, data = sales_data_2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2565492  -790049  -184307   576454  4023908 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1353.5169  2046.1659   0.661    0.508    
## `Units Sold`  265.7438     0.3545 749.672   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1253000 on 1499998 degrees of freedom
## Multiple R-squared:  0.2726, Adjusted R-squared:  0.2726 
## F-statistic: 5.62e+05 on 1 and 1499998 DF,  p-value: < 2.2e-16

Perform Multiple linear regression

# Multiple regression for sales_data_1
multiple_model_1 <- lm(`Total Revenue` ~ `Units Sold` + `Unit Price` + `Order Priority`, data = sales_data_1)
summary(multiple_model_1)
## 
## Call:
## lm(formula = `Total Revenue` ~ `Units Sold` + `Unit Price` + 
##     `Order Priority`, data = sales_data_1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2012853  -360893      400   360634  2013941 
## 
## Coefficients:
##                     Estimate Std. Error  t value Pr(>|t|)    
## (Intercept)       -1.329e+06  1.824e+03 -728.739   <2e-16 ***
## `Units Sold`       2.659e+02  2.169e-01 1225.943   <2e-16 ***
## `Unit Price`       5.001e+03  2.884e+00 1734.140   <2e-16 ***
## `Order Priority`H  1.018e+02  1.769e+03    0.058    0.954    
## `Order Priority`L -2.086e+03  1.769e+03   -1.179    0.238    
## `Order Priority`M  9.552e+02  1.770e+03    0.540    0.589    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 625700 on 999994 degrees of freedom
## Multiple R-squared:  0.8185, Adjusted R-squared:  0.8185 
## F-statistic: 9.017e+05 on 5 and 999994 DF,  p-value: < 2.2e-16
# Multiple regression for sales_data_2
multiple_model_2 <- lm(`Total Revenue` ~ `Units Sold` + `Unit Price` + `Order Priority`, data = sales_data_2)
summary(multiple_model_2)
## 
## Call:
## lm(formula = `Total Revenue` ~ `Units Sold` + `Unit Price` + 
##     `Order Priority`, data = sales_data_2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2012679  -361133      119   360734  2013047 
## 
## Coefficients:
##                     Estimate Std. Error  t value Pr(>|t|)    
## (Intercept)       -1.329e+06  1.490e+03 -891.977   <2e-16 ***
## `Units Sold`       2.659e+02  1.771e-01 1501.407   <2e-16 ***
## `Unit Price`       5.001e+03  2.355e+00 2123.977   <2e-16 ***
## `Order Priority`H -4.836e+02  1.445e+03   -0.335    0.738    
## `Order Priority`L -2.026e+03  1.445e+03   -1.402    0.161    
## `Order Priority`M -3.162e+02  1.445e+03   -0.219    0.827    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 625800 on 1499994 degrees of freedom
## Multiple R-squared:  0.8185, Adjusted R-squared:  0.8185 
## F-statistic: 1.353e+06 on 5 and 1499994 DF,  p-value: < 2.2e-16

Compare Results

# Compare the results
cat("Linear Model Summary for Sales Data 1:\n")
## Linear Model Summary for Sales Data 1:
print(summary(linear_model_1))
## 
## Call:
## lm(formula = `Total Revenue` ~ `Units Sold`, data = sales_data_1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2565044  -789981  -183891   576713  4024356 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1383.0580  2505.5845   0.552    0.581    
## `Units Sold`  265.6961     0.4341 612.052   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1253000 on 999998 degrees of freedom
## Multiple R-squared:  0.2725, Adjusted R-squared:  0.2725 
## F-statistic: 3.746e+05 on 1 and 999998 DF,  p-value: < 2.2e-16
cat("\nLinear Model Summary for Sales Data 2:\n")
## 
## Linear Model Summary for Sales Data 2:
print(summary(linear_model_2))
## 
## Call:
## lm(formula = `Total Revenue` ~ `Units Sold`, data = sales_data_2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2565492  -790049  -184307   576454  4023908 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1353.5169  2046.1659   0.661    0.508    
## `Units Sold`  265.7438     0.3545 749.672   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1253000 on 1499998 degrees of freedom
## Multiple R-squared:  0.2726, Adjusted R-squared:  0.2726 
## F-statistic: 5.62e+05 on 1 and 1499998 DF,  p-value: < 2.2e-16
cat("\nMultiple Model Summary for Sales Data 1:\n")
## 
## Multiple Model Summary for Sales Data 1:
print(summary(multiple_model_1))
## 
## Call:
## lm(formula = `Total Revenue` ~ `Units Sold` + `Unit Price` + 
##     `Order Priority`, data = sales_data_1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2012853  -360893      400   360634  2013941 
## 
## Coefficients:
##                     Estimate Std. Error  t value Pr(>|t|)    
## (Intercept)       -1.329e+06  1.824e+03 -728.739   <2e-16 ***
## `Units Sold`       2.659e+02  2.169e-01 1225.943   <2e-16 ***
## `Unit Price`       5.001e+03  2.884e+00 1734.140   <2e-16 ***
## `Order Priority`H  1.018e+02  1.769e+03    0.058    0.954    
## `Order Priority`L -2.086e+03  1.769e+03   -1.179    0.238    
## `Order Priority`M  9.552e+02  1.770e+03    0.540    0.589    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 625700 on 999994 degrees of freedom
## Multiple R-squared:  0.8185, Adjusted R-squared:  0.8185 
## F-statistic: 9.017e+05 on 5 and 999994 DF,  p-value: < 2.2e-16
cat("\nMultiple Model Summary for Sales Data 2:\n")
## 
## Multiple Model Summary for Sales Data 2:
print(summary(multiple_model_2))
## 
## Call:
## lm(formula = `Total Revenue` ~ `Units Sold` + `Unit Price` + 
##     `Order Priority`, data = sales_data_2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2012679  -361133      119   360734  2013047 
## 
## Coefficients:
##                     Estimate Std. Error  t value Pr(>|t|)    
## (Intercept)       -1.329e+06  1.490e+03 -891.977   <2e-16 ***
## `Units Sold`       2.659e+02  1.771e-01 1501.407   <2e-16 ***
## `Unit Price`       5.001e+03  2.355e+00 2123.977   <2e-16 ***
## `Order Priority`H -4.836e+02  1.445e+03   -0.335    0.738    
## `Order Priority`L -2.026e+03  1.445e+03   -1.402    0.161    
## `Order Priority`M -3.162e+02  1.445e+03   -0.219    0.827    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 625800 on 1499994 degrees of freedom
## Multiple R-squared:  0.8185, Adjusted R-squared:  0.8185 
## F-statistic: 1.353e+06 on 5 and 1499994 DF,  p-value: < 2.2e-16

Logistics Regresison

Creating binary outputs

# Create a binary outcome variable for sales_data_1
sales_data_1 <- sales_data_1 %>%
  mutate(Is_Profitable = ifelse(`Total Revenue` > mean(`Total Revenue`), 1, 0))

# Create a binary outcome variable for sales_data_2
sales_data_2 <- sales_data_2 %>%
  mutate(Is_Profitable = ifelse(`Total Revenue` > mean(`Total Revenue`), 1, 0))
# Load necessary packages for logistic regression
library(dplyr)
library(caret)  # For confusionMatrix
## Loading required package: lattice

Model

# Logistic regression for sales_data_1
logistic_model_1 <- glm(Is_Profitable ~ `Units Sold` + `Unit Price` + `Order Priority`, 
                         data = sales_data_1, 
                         family = binomial)

# Logistic regression for sales_data_2
logistic_model_2 <- glm(Is_Profitable ~ `Units Sold` + `Unit Price` + `Order Priority`, 
                         data = sales_data_2, 
                         family = binomial)
summary
## function (object, ...) 
## UseMethod("summary")
## <bytecode: 0x5555f84bff60>
## <environment: namespace:base>

Models Accuracy

# Predictions for sales_data_1
predictions_1 <- ifelse(predict(logistic_model_1, type = "response") > 0.5, 1, 0)

# Predictions for sales_data_2
predictions_2 <- ifelse(predict(logistic_model_2, type = "response") > 0.5, 1, 0)

# Create confusion matrices to assess accuracy
confusion_matrix_1 <- confusionMatrix(as.factor(predictions_1), as.factor(sales_data_1$Is_Profitable))
confusion_matrix_2 <- confusionMatrix(as.factor(predictions_2), as.factor(sales_data_2$Is_Profitable))

# Display accuracy
accuracy_1 <- confusion_matrix_1$overall['Accuracy']
accuracy_2 <- confusion_matrix_2$overall['Accuracy']

cat("Accuracy for Logistic Regression Model 1:", accuracy_1, "\n")
## Accuracy for Logistic Regression Model 1: 0.920284
cat("Accuracy for Logistic Regression Model 2:", accuracy_2, "\n")
## Accuracy for Logistic Regression Model 2: 0.9203953

KNN

mol <- colnames(sales_data_1)
mol
##  [1] "Region"         "Country"        "Item Type"      "Sales Channel" 
##  [5] "Order Priority" "Order Date"     "Order ID"       "Ship Date"     
##  [9] "Units Sold"     "Unit Price"     "Unit Cost"      "Total Revenue" 
## [13] "Total Cost"     "Total Profit"   "Order.Date"     "Ship.Date"     
## [17] "Is_Profitable"
# Load necessary libraries
library(class)
library(caret)  # For confusionMatrix and other functions


# Preprocess the data for KNN
preprocess_knn <- function(data) {
  # Convert categorical variables to factors if needed
  data$Order.Priority <- as.factor(data$`Order Priority`)
  
  # Create a binary response variable (e.g., profitable or not)
  data$Is_Profitable <- ifelse(data$`Total Profit` > mean(data$`Total Profit`), 1, 0)  # Define profitable
  
  # Select only numeric columns for KNN (including response variable)
  knn_data <- data[, c("Units Sold" , "Unit Price", "Unit Cost" , "Total Revenue", "Total Cost" , "Total Profit" , "Is_Profitable")]
  
  # Scale the data (except for the response variable)
  knn_data_scaled <- scale(knn_data[, -ncol(knn_data)])  # Scale features only
  
  # Bind the scaled features with the response variable
  knn_data_final <- data.frame(knn_data_scaled, Is_Profitable = knn_data$Is_Profitable)
  return(knn_data_final)
}

# Preprocess both datasets
knn_data_1 <- preprocess_knn(sales_data_1)
knn_data_2 <- preprocess_knn(sales_data_2)

# Split the data into training and testing sets (80% train, 20% test)
set.seed(123)  # For reproducibility
train_index_1 <- sample(1:nrow(knn_data_1), 0.8 * nrow(knn_data_1))
train_index_2 <- sample(1:nrow(knn_data_2), 0.8 * nrow(knn_data_2))

train_data_1 <- knn_data_1[train_index_1, ]
test_data_1 <- knn_data_1[-train_index_1, ]

train_data_2 <- knn_data_2[train_index_2, ]
test_data_2 <- knn_data_2[-train_index_2, ]

# Fit KNN Model
k_value <- 5  # You can adjust the value of K

# Predictions for sales_data_1
predictions_1 <- knn(train = train_data_1[, -ncol(train_data_1)], 
                     test = test_data_1[, -ncol(test_data_1)], 
                     cl = train_data_1$Is_Profitable, 
                     k = k_value)

# Predictions for sales_data_2
predictions_2 <- knn(train = train_data_2[, -ncol(train_data_2)], 
                     test = test_data_2[, -ncol(test_data_2)], 
                     cl = train_data_2$Is_Profitable, 
                     k = k_value)

# Evaluate the results
confusion_matrix_1 <- confusionMatrix(as.factor(predictions_1), as.factor(test_data_1$Is_Profitable))
confusion_matrix_2 <- confusionMatrix(as.factor(predictions_2), as.factor(test_data_2$Is_Profitable))

# Print the accuracy
cat("Accuracy for Sales Data 1:", confusion_matrix_1$overall['Accuracy'], "\n")
## Accuracy for Sales Data 1: 1
cat("Accuracy for Sales Data 2:", confusion_matrix_2$overall['Accuracy'], "\n")
## Accuracy for Sales Data 2: 0.99999

Naive Bayes

# Install necessary packages if you haven't already
install.packages("e1071")
## Installing package into '/home/dragon/R/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
install.packages("caret")
## Installing package into '/home/dragon/R/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
install.packages("ggplot2")
## Installing package into '/home/dragon/R/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
# Load the libraries
library(e1071)
library(caret)
library(ggplot2)
# Add Is_Profitable column based on Total.Profit being greater than 0
sales_data_1$Is_Profitable <- ifelse(sales_data_1$`Total Profit` > mean(sales_data_1$`Total Profit`), 1, 0)
sales_data_2$Is_Profitable <- ifelse(sales_data_2$`Total Profit` > mean(sales_data_2$`Total Profit`), 1, 0)

# Convert target variable to factor for both datasets
sales_data_1$Is_Profitable <- as.factor(sales_data_1$Is_Profitable)
sales_data_2$Is_Profitable <- as.factor(sales_data_2$Is_Profitable)

# Split data into train and test sets for both datasets
set.seed(123)  # For reproducibility
trainIndex_1 <- createDataPartition(sales_data_1$Is_Profitable, p = 0.8, list = FALSE)
train_data_1 <- sales_data_1[trainIndex_1, ]
test_data_1 <- sales_data_1[-trainIndex_1, ]

trainIndex_2 <- createDataPartition(sales_data_2$Is_Profitable, p = 0.8, list = FALSE)
train_data_2 <- sales_data_2[trainIndex_2, ]
test_data_2 <- sales_data_2[-trainIndex_2, ]

Model TRaining

# Train Naive Bayes model on both datasets
naive_model_1 <- naiveBayes(Is_Profitable ~ ., data = train_data_1)
naive_model_2 <- naiveBayes(Is_Profitable ~ ., data = train_data_2)

# Make predictions on test sets
predictions_1 <- predict(naive_model_1, test_data_1)
predictions_2 <- predict(naive_model_2, test_data_2)

Model Evaluation

# Confusion matrix and accuracy for sales_data_1
conf_matrix_1 <- confusionMatrix(predictions_1, test_data_1$Is_Profitable)
accuracy_1 <- conf_matrix_1$overall['Accuracy']
print(paste("Accuracy for Dataset 1: ", round(accuracy_1, 4)))
## [1] "Accuracy for Dataset 1:  0.9114"
print(conf_matrix_1)
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction      0      1
##          0 111580   9619
##          1   8103  70697
##                                           
##                Accuracy : 0.9114          
##                  95% CI : (0.9101, 0.9126)
##     No Information Rate : 0.5984          
##     P-Value [Acc > NIR] : < 2.2e-16       
##                                           
##                   Kappa : 0.8151          
##                                           
##  Mcnemar's Test P-Value : < 2.2e-16       
##                                           
##             Sensitivity : 0.9323          
##             Specificity : 0.8802          
##          Pos Pred Value : 0.9206          
##          Neg Pred Value : 0.8972          
##              Prevalence : 0.5984          
##          Detection Rate : 0.5579          
##    Detection Prevalence : 0.6060          
##       Balanced Accuracy : 0.9063          
##                                           
##        'Positive' Class : 0               
## 
# Confusion matrix and accuracy for sales_data_2
conf_matrix_2 <- confusionMatrix(predictions_2, test_data_2$Is_Profitable)
accuracy_2 <- conf_matrix_2$overall['Accuracy']
print(paste("Accuracy for Dataset 2: ", round(accuracy_2, 4)))
## [1] "Accuracy for Dataset 2:  0.9106"
print(conf_matrix_2)
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction      0      1
##          0 167350  14639
##          1  12170 105840
##                                           
##                Accuracy : 0.9106          
##                  95% CI : (0.9096, 0.9117)
##     No Information Rate : 0.5984          
##     P-Value [Acc > NIR] : < 2.2e-16       
##                                           
##                   Kappa : 0.8134          
##                                           
##  Mcnemar's Test P-Value : < 2.2e-16       
##                                           
##             Sensitivity : 0.9322          
##             Specificity : 0.8785          
##          Pos Pred Value : 0.9196          
##          Neg Pred Value : 0.8969          
##              Prevalence : 0.5984          
##          Detection Rate : 0.5578          
##    Detection Prevalence : 0.6066          
##       Balanced Accuracy : 0.9054          
##                                           
##        'Positive' Class : 0               
## 
# Function to plot confusion matrix
plot_confusion_matrix <- function(conf_matrix, title) {
  cm_df <- as.data.frame(conf_matrix$table)
  
  ggplot(cm_df, aes(x = Reference, y = Prediction, fill = Freq)) +
    geom_tile() +
    geom_text(aes(label = Freq), color = "white") +
    labs(title = title, x = "Actual", y = "Predicted") +
    scale_fill_gradient(low = "white", high = "blue") +
    theme_minimal()
}

# Plot confusion matrices for both datasets
plot_confusion_matrix(conf_matrix_1, "Confusion Matrix for Sales Data 1")

plot_confusion_matrix(conf_matrix_2, "Confusion Matrix for Sales Data 2")

Regression Tree

library(rpart)
library(rpart.plot)
# Fit regression tree for the first dataset
reg_tree_1 <- rpart(`Total Profit` ~ ., data = sales_data_1, method = "anova")

# Fit regression tree for the second dataset
reg_tree_2 <- rpart(`Total Profit` ~ ., data = sales_data_2, method = "anova")

Plotting Regression

# Plot regression tree for sales_data_1
rpart.plot(reg_tree_1, type = 2, extra = 1, main = "Regression Tree for Sales Data 1")

# Plot regression tree for sales_data_2
rpart.plot(reg_tree_2, type = 2, extra = 1, main = "Regression Tree for Sales Data 2")

Summary of the models

# Summary of the first regression tree model
summary(reg_tree_1)
## Call:
## rpart(formula = `Total Profit` ~ ., data = sales_data_1, method = "anova")
##   n= 1000000 
## 
##           CP nsplit  rel error     xerror         xstd
## 1 0.63951099      0 1.00000000 1.00000277 0.0018072122
## 2 0.12513982      1 0.36048901 0.36049190 0.0008060948
## 3 0.04489665      2 0.23534919 0.23547971 0.0005011016
## 4 0.03514567      3 0.19045255 0.19067830 0.0003891094
## 5 0.02928676      4 0.15530687 0.15554000 0.0003936206
## 6 0.02228934      5 0.12602011 0.12608169 0.0002488589
## 7 0.01683394      6 0.10373077 0.10369276 0.0001906571
## 8 0.01544967      7 0.08689683 0.08690546 0.0001544073
## 9 0.01000000      8 0.07144716 0.07149608 0.0001113936
## 
## Variable importance
## Total Revenue Is_Profitable    Total Cost     Item Type    Units Sold 
##            23            21            20            12            10 
##    Unit Price     Unit Cost 
##            10             3 
## 
## Node number 1: 1000000 observations,    complexity param=0.639511
##   mean=392295.6, MSE=1.435044e+11 
##   left son=2 (598416 obs) right son=3 (401584 obs)
##   Primary splits:
##       Is_Profitable splits as  LR, improve=0.6395110, (0 missing)
##       Total Revenue < 1413792   to the left,  improve=0.5538571, (0 missing)
##       Total Cost    < 779086.9  to the left,  improve=0.5136881, (0 missing)
##       Unit Price    < 429.545   to the left,  improve=0.3421216, (0 missing)
##       Item Type     splits as  LLLLRLRLRLLL, improve=0.3421216, (0 missing)
##   Surrogate splits:
##       Total Revenue < 957289.9  to the left,  agree=0.900, adj=0.751, (0 split)
##       Total Cost    < 623819.8  to the left,  agree=0.872, adj=0.681, (0 split)
##       Units Sold    < 5376.5    to the left,  agree=0.761, adj=0.406, (0 split)
##       Item Type     splits as  RLRLRLRLRLLL, agree=0.744, adj=0.363, (0 split)
##       Unit Price    < 429.545   to the left,  agree=0.720, adj=0.302, (0 split)
## 
## Node number 2: 598416 observations,    complexity param=0.03514567
##   mean=144129, MSE=1.311986e+10 
##   left son=4 (323235 obs) right son=5 (275181 obs)
##   Primary splits:
##       Total Revenue < 399198.3  to the left,  improve=0.6423985, (0 missing)
##       Total Cost    < 310432.2  to the left,  improve=0.5194542, (0 missing)
##       Item Type     splits as  RLRRRLRRRRRR, improve=0.2881855, (0 missing)
##       Unit Cost     < 33.815    to the left,  improve=0.2881855, (0 missing)
##       Unit Price    < 64.59     to the left,  improve=0.2881855, (0 missing)
##   Surrogate splits:
##       Total Cost < 267461    to the left,  agree=0.954, adj=0.901, (0 split)
##       Item Type  splits as  RLRLRLRRRRRR, agree=0.722, adj=0.395, (0 split)
##       Unit Cost  < 46.255    to the left,  agree=0.722, adj=0.395, (0 split)
##       Unit Price < 130.93    to the left,  agree=0.718, adj=0.388, (0 split)
##       Units Sold < 2596.5    to the left,  agree=0.651, adj=0.240, (0 split)
## 
## Node number 3: 401584 observations,    complexity param=0.1251398
##   mean=762098.2, MSE=1.092688e+11 
##   left son=6 (296582 obs) right son=7 (105002 obs)
##   Primary splits:
##       Total Revenue < 3560905   to the left,  improve=0.4092493, (0 missing)
##       Unit Price    < 429.545   to the left,  improve=0.3630894, (0 missing)
##       Item Type     splits as  L-LLR-RLR-LL, improve=0.3630894, (0 missing)
##       Total Cost    < 1331272   to the left,  improve=0.3267937, (0 missing)
##       Unit Cost     < 211.375   to the left,  improve=0.2416675, (0 missing)
##   Surrogate splits:
##       Total Cost < 2870495   to the left,  agree=0.942, adj=0.777, (0 split)
##       Item Type  splits as  L-LLL-RLR-LL, agree=0.819, adj=0.306, (0 split)
##       Unit Price < 544.205   to the left,  agree=0.819, adj=0.306, (0 split)
##       Unit Cost  < 433.615   to the left,  agree=0.819, adj=0.306, (0 split)
##       Units Sold < 9999.5    to the left,  agree=0.739, adj=0.000, (0 split)
## 
## Node number 4: 323235 observations
##   mean=59422.51, MSE=2.845411e+09 
## 
## Node number 5: 275181 observations
##   mean=243627.6, MSE=6.860361e+09 
## 
## Node number 6: 296582 observations,    complexity param=0.02928676
##   mean=636272.7, MSE=4.511273e+10 
##   left son=12 (247437 obs) right son=13 (49145 obs)
##   Primary splits:
##       Item Type     splits as  L-LLR-LLL-LL, improve=0.3141179, (0 missing)
##       Total Revenue < 1662664   to the left,  improve=0.3091881, (0 missing)
##       Total Cost    < 974114.3  to the left,  improve=0.2906839, (0 missing)
##       Unit Price    < 429.545   to the left,  improve=0.1490113, (0 missing)
##       Unit Cost     < 107.275   to the left,  improve=0.1341467, (0 missing)
##   Surrogate splits:
##       Unit Price < 429.545   to the left,  agree=0.850, adj=0.095, (0 split)
##       Units Sold < 2736.5    to the right, agree=0.838, adj=0.021, (0 split)
##       Order ID   < 100023700 to the right, agree=0.834, adj=0.000, (0 split)
## 
## Node number 7: 105002 observations,    complexity param=0.04489665
##   mean=1117497, MSE=1.194537e+11 
##   left son=14 (50617 obs) right son=15 (54385 obs)
##   Primary splits:
##       Item Type     splits as  ----R-RLL---, improve=0.5136671, (0 missing)
##       Unit Price    < 429.545   to the left,  improve=0.4102918, (0 missing)
##       Unit Cost     < 314.01    to the right, improve=0.3034319, (0 missing)
##       Total Cost    < 2655668   to the right, improve=0.3034319, (0 missing)
##       Total Revenue < 5342013   to the left,  improve=0.1620376, (0 missing)
##   Surrogate splits:
##       Unit Cost  < 513.75    to the right, agree=0.877, adj=0.744, (0 split)
##       Unit Price < 659.74    to the left,  agree=0.853, adj=0.695, (0 split)
##       Total Cost < 3054590   to the right, agree=0.661, adj=0.297, (0 split)
##       Order Date splits as  RRRRLLLLRRRRRRRLLLRLLRLLLRLRRRLRRLRRLRRRLLLRRRLRRRLRRLRRRLRRLRLRLLRLRLRRLRRRRRLLRRLRRRRLLLRLRRRRLRRLRRRRRRRRLLLRRRLLRRRRRLRRLRRRRRLRLRRLRRRRRLRLRRRRRRLRLRLLRRRRRRRLRLLRRRRRRRRRLRRRLRLRRLLRRRRLRRLLRRLRRRLLRRRLRRRLLRRRRRRLRRRRLRRRRLLRRRRRLRRRRRRRRLLLLRLRRLRRRLLLRRRLRRLLRRRLLRRRRRLRRLLRRLRLRRLLRLLLLRLLRRRRLLRRRRLRRLRRLLRRRLLRRRLLRRRRLRRRRLRLRRRRRRLLRLRRRRLRRLLLRLLRLLRLLRLLRRRLRRLRRRLLRRRRRRRRRLLRLRRLRRRRRRRLLRLRRRRLRLLRRRLLRLRRRRLLLRLRRLLRRRLLRRRLRLRRRRRRRRRLLRLLRRLRRRRRRRRRLLRLLRRRRRRRRRLL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RRLRR, agree=0.563, adj=0.094, (0 split)
## 
## Node number 12: 247437 observations
##   mean=583220.5, MSE=1.982406e+10 
## 
## Node number 13: 49145 observations,    complexity param=0.02228934
##   mean=903381.7, MSE=8.691906e+10 
##   left son=26 (24602 obs) right son=27 (24543 obs)
##   Primary splits:
##       Units Sold    < 5197.5    to the left,  improve=0.74880380, (0 missing)
##       Total Revenue < 2272347   to the left,  improve=0.74880380, (0 missing)
##       Total Cost    < 1368658   to the left,  improve=0.74880380, (0 missing)
##       Ship Date     splits as  -RRLRRRR-LRRLRLL-RRLLLLL-RLLLLLRRLRRRRRLRRRLRLRLLRLRRLLLRLLRRRLRLRRRLRRLLLLRLLLRLRLRRRLL-RRRLRLLLRRRLLLLRLLRRRRLLLLLLLRLLRRRLRLRRRLRRRLLLLLRRRRRRRRLLLLLRLLLLRLLRLLRRLLRRRRLLLLL-LLLLLLRLLLLRRRRLLRRLLLL-LLLLRRL-RRLRRLL-LLLLRRR-LLLRLLL-RRLLRRR-RLRRRRRLLLLLRLRRLLRRLLLLRRLRRLRRRLLRRLRLRLLRLRLRRRRLLLRLRRLLLRLLLLRLLRRRLRLRLRRLLLLRLRLRRRRLLRLLLLRRRRLLRRRLLLRLLLRRRRRLLRRLRRRLRRRLLLRLRLRRRRRLLRRRRLLLLLRLRRRLRRRLLLRLRLLRLRRLRLRLLRRRRRLLRLLRLRRLLLRLLRRRLLRLRRLLRRRLRLRRLLRRLLRLLLRLLRRLRRLRLRLRRRRRLRRRLLRRLRLLLRLRLLRRRLLLRRLRRLRRRRLRRRRRRRLRRLLLRRRLLRRRRRRRRRRLLLRRRRRLRLRLRRRLRRLRRLLLRLRRLLLLRLRRLLLLRRRRRRLLLLRRLLRRLLRRRLRLRRRRRRRRLLRLRLLRLLLRRLRRRRLRRLRRLRLRLLLRRLLRLRRRLLLLRRRLRLRRRRRRRLLLRLLLLRRLLRLRRLLLLLLLLLLRLLRLRRLRRRRRLLLLLLLLLRRLLLLRLRRRLLRLLLRRRRR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RRLLLRRLLRLLLLLLRLRRRLLRRRLLRRLRRLRRRLRRLLRLLRLRLLLRRLLRLLRLRLRLRRLLLRLRLRRLRLRRRRLRLLLRRRRRLRRRRRRLLRLRRLRLRRLRRRRRLRRLRLLLRLRRRLRRLRLRLLLLRRLLRRRLRRRLLRRRRLRLLRRLRRRLRLRRLLLLLLLRRLRLRRRLRRRLRLLRLRRRRLRRRRRRRRRLLRLRRLRLRRRLRRRLRRRRRLLLRRLLRLRLLRLLLRRLRLRRLLRRRRRLRRLRRRLLLLLLRLRLLLLRRLLLRRRRRLRLRRRRLLLRLLRLRLLLLRRLRRLLLLRRLRLLRLLLRRLLLRLLRRLRRRRLLRRLRLRLRLRLLRRRRRRRRLLLRLRRRLLRLLRRLLLRLLRLRLRRRRLRLLRRLRRRRLLRRRLRRLLRLRRRRRRRRRLLLLLRLRLLRRRLLLLLRLLLRRRRRRRRRLLRLLRRLRLRLLLRRRLLLRLRRRLRLRLRLLLRRLLRLRLRLLLLRLLLLRRRRLRLLRLLRRLLRRLLLLLLLRRRLRLLLRLRRLRRLRLRRLRRRLRLRLLLLLLLLLLRRRLLRRRRLRLLRRRRRLRLRRRLLLLLLRLLLRRLLRRRLLLLRRLRLLRRLLLRLRRLLLRRLLLRRLRRRLLLLRRLRLLLLRRLLRRRLRRLLLRLLLRLLRRRRRRRRLRLLRLRLRLLLLLLRRLLRLRLRLRRRRLRRLRLRLLRLRRRLLLLLLRRLRRLLLLLRLRLLRRLRRLLRRRR, improve=0.02787308, (0 missing)
##   Surrogate splits:
##       Total Revenue < 2272347   to the left,  agree=1.000, adj=1.000, (0 split)
##       Total Cost    < 1368658   to the left,  agree=1.000, adj=1.000, (0 split)
##       Ship Date     splits as  -RRLRRRL-LRRLLLL-RRLLLLR-RLLRLLRLLRRRRRLRRRLRLRLLLLRLLLLLLLRLRLRLRRRLLRLRLLRLLRRLRLLRRLL-RRLLRLLRRRRLLLLRLLLLRRLLLLLRLRLLRRLLRLRRRLLRRLLLLLLRR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LRRRLRRLLRLRLRLRRRRRLRLLLLLRLRRRRLLLLLRLLLRRRRRRRLRLLRLLRRLRLRLLLRRRLLLLRRRRLLLRLRLLLLRLLLLLLRLLLLLLLLLLRRRLRLLRLLRRLLRRLLLLLLLLLRLRLLLRLRRLRRLLLRLLRLLLRLRRLLLLLLRLLRRRLLRRRRLRRLRRRRLLRLRLRLLLLLLRLLRRRLLRLRLLLLLRLRLLLRLLLRLRRLLLLRLLLLRLRRRLLLLRRLRLLLLRRLLRLRLRRLLLRLLLRRRRRRRLRRRLLLRRLRLRLLLLLLLRLLRLRLRLRLRRLRRLLLRLLRLRRRLRLLRLLRLRRLLLLLRLRLLLRLRRLLRRRL, agree=0.583, adj=0.166, (0 split)
##       Country       splits as  LRLLLRLLRRLLLLRLRRLRRRRRRLLLLLRLRLLLLRLLRRRRRRRLLLRRRLLRRLLLLRRLLLLLLLLLRLLRRRRLLRRRLLLRLRRLLRLRRLLRRRRRLLLLRRLLRRLRRLRLRRRRLRRLRLLLLRRLLRLRLLLRLRRRLRLRRLLRLRRLLRRRRRLLLRLLRRLRLRRLLLRRL, agree=0.522, adj=0.043, (0 split)
## 
## Node number 14: 50617 observations,    complexity param=0.01544967
##   mean=860734, MSE=5.87797e+10 
##   left son=28 (23160 obs) right son=29 (27457 obs)
##   Primary splits:
##       Total Revenue < 4347804   to the left,  improve=0.7451790, (0 missing)
##       Total Cost    < 3647161   to the left,  improve=0.7402085, (0 missing)
##       Item Type     splits as  -------LR---, improve=0.6499716, (0 missing)
##       Unit Cost     < 444.825   to the left,  improve=0.6499716, (0 missing)
##       Unit Price    < 536.55    to the left,  improve=0.6499716, (0 missing)
##   Surrogate splits:
##       Total Cost < 3647161   to the left,  agree=0.955, adj=0.902, (0 split)
##       Item Type  splits as  -------LR---, agree=0.799, adj=0.560, (0 split)
##       Unit Price < 536.55    to the left,  agree=0.799, adj=0.560, (0 split)
##       Unit Cost  < 444.825   to the left,  agree=0.799, adj=0.560, (0 split)
##       Units Sold < 6676.5    to the left,  agree=0.744, adj=0.440, (0 split)
## 
## Node number 15: 54385 observations,    complexity param=0.01683394
##   mean=1356470, MSE=5.745636e+10 
##   left son=30 (21734 obs) right son=31 (32651 obs)
##   Primary splits:
##       Units Sold < 7924.5    to the left,  improve=0.7730963, (0 missing)
##       Unit Price < 552.735   to the right, improve=0.3325343, (0 missing)
##       Unit Cost  < 382.935   to the right, improve=0.3325343, (0 missing)
##       Total Cost < 2655668   to the right, improve=0.3325343, (0 missing)
##       Item Type  splits as  ----R-L-----, improve=0.3325343, (0 missing)
##   Surrogate splits:
##       Total Revenue < 5295706   to the left,  agree=0.716, adj=0.289, (0 split)
##       Total Cost    < 3982378   to the left,  agree=0.716, adj=0.289, (0 split)
##       Item Type     splits as  ----R-L-----, agree=0.684, adj=0.208, (0 split)
##       Unit Price    < 552.735   to the right, agree=0.684, adj=0.208, (0 split)
##       Unit Cost     < 382.935   to the right, agree=0.684, adj=0.208, (0 split)
## 
## Node number 26: 24602 observations
##   mean=648569.6, MSE=2.18352e+10 
## 
## Node number 27: 24543 observations
##   mean=1158806, MSE=2.183228e+10 
## 
## Node number 28: 23160 observations
##   mean=632856.6, MSE=1.530951e+10 
## 
## Node number 29: 27457 observations
##   mean=1052949, MSE=1.469892e+10 
## 
## Node number 30: 21734 observations
##   mean=1098146, MSE=1.559367e+10 
## 
## Node number 31: 32651 observations
##   mean=1528422, MSE=1.133526e+10
# Summary of the second regression tree model
summary(reg_tree_2)
## Call:
## rpart(formula = `Total Profit` ~ ., data = sales_data_2, method = "anova")
##   n= 1500000 
## 
##           CP nsplit  rel error     xerror         xstd
## 1 0.63920977      0 1.00000000 1.00000124 1.476472e-03
## 2 0.12570714      1 0.36079023 0.36079172 6.589069e-04
## 3 0.04450517      2 0.23508309 0.23508483 4.091770e-04
## 4 0.03518954      3 0.19057792 0.19057940 3.183940e-04
## 5 0.02958268      4 0.15538838 0.15539202 3.220563e-04
## 6 0.02243535      5 0.12580570 0.12580985 2.029243e-04
## 7 0.01670105      6 0.10337035 0.10337400 1.550197e-04
## 8 0.01522044      7 0.08666930 0.08667278 1.257354e-04
## 9 0.01000000      8 0.07144886 0.07145263 9.095928e-05
## 
## Variable importance
## Total Revenue Is_Profitable    Total Cost     Item Type    Units Sold 
##            23            21            20            12            10 
##    Unit Price     Unit Cost 
##            10             3 
## 
## Node number 1: 1500000 observations,    complexity param=0.6392098
##   mean=392399.9, MSE=1.435788e+11 
##   left son=2 (897601 obs) right son=3 (602399 obs)
##   Primary splits:
##       Is_Profitable splits as  LR,           improve=0.6392098, (0 missing)
##       Total Revenue < 1414181  to the left,  improve=0.5532301, (0 missing)
##       Total Cost    < 782993.4 to the left,  improve=0.5132426, (0 missing)
##       Unit Price    < 429.545  to the left,  improve=0.3419590, (0 missing)
##       Item Type     splits as  LLLLRLRLRLLL, improve=0.3419590, (0 missing)
##   Surrogate splits:
##       Total Revenue < 958355.6 to the left,  agree=0.899, adj=0.750, (0 split)
##       Total Cost    < 603213.4 to the left,  agree=0.872, adj=0.681, (0 split)
##       Units Sold    < 5669.5   to the left,  agree=0.761, adj=0.406, (0 split)
##       Item Type     splits as  RLRLRLRLRLLL, agree=0.744, adj=0.363, (0 split)
##       Unit Price    < 429.545  to the left,  agree=0.720, adj=0.302, (0 split)
## 
## Node number 2: 897601 observations,    complexity param=0.03518954
##   mean=144219.6, MSE=1.314264e+10 
##   left son=4 (484508 obs) right son=5 (413093 obs)
##   Primary splits:
##       Total Revenue < 399198.3 to the left,  improve=0.6424350, (0 missing)
##       Total Cost    < 310432.2 to the left,  improve=0.5197164, (0 missing)
##       Item Type     splits as  RLRRRLRRRRRR, improve=0.2885250, (0 missing)
##       Unit Cost     < 33.815   to the left,  improve=0.2885250, (0 missing)
##       Unit Price    < 64.59    to the left,  improve=0.2885250, (0 missing)
##   Surrogate splits:
##       Total Cost < 267461   to the left,  agree=0.954, adj=0.901, (0 split)
##       Item Type  splits as  RLRLRLRRRRRR, agree=0.722, adj=0.396, (0 split)
##       Unit Cost  < 46.255   to the left,  agree=0.722, adj=0.396, (0 split)
##       Unit Price < 130.93   to the left,  agree=0.719, adj=0.389, (0 split)
##       Units Sold < 2594.5   to the left,  agree=0.651, adj=0.242, (0 split)
## 
## Node number 3: 602399 observations,    complexity param=0.1257071
##   mean=762199.5, MSE=1.094057e+11 
##   left son=6 (445801 obs) right son=7 (156598 obs)
##   Primary splits:
##       Total Revenue < 3570598  to the left,  improve=0.4107876, (0 missing)
##       Unit Price    < 429.545  to the left,  improve=0.3633362, (0 missing)
##       Item Type     splits as  L-LLR-RLR-LL, improve=0.3633362, (0 missing)
##       Total Cost    < 1331272  to the left,  improve=0.3267723, (0 missing)
##       Unit Cost     < 211.375  to the left,  improve=0.2418755, (0 missing)
##   Surrogate splits:
##       Total Cost < 2878872  to the left,  agree=0.942, adj=0.778, (0 split)
##       Item Type  splits as  L-LLL-RLR-LL, agree=0.819, adj=0.304, (0 split)
##       Unit Price < 544.205  to the left,  agree=0.819, adj=0.304, (0 split)
##       Unit Cost  < 433.615  to the left,  agree=0.819, adj=0.304, (0 split)
##       Units Sold < 9999.5   to the left,  agree=0.740, adj=0.000, (0 split)
## 
## Node number 4: 484508 observations
##   mean=59374, MSE=2.839479e+09 
## 
## Node number 5: 413093 observations
##   mean=243733.2, MSE=6.880752e+09 
## 
## Node number 6: 445801 observations,    complexity param=0.02958268
##   mean=636552.8, MSE=4.530087e+10 
##   left son=12 (372029 obs) right son=13 (73772 obs)
##   Primary splits:
##       Item Type     splits as  L-LLR-LLL-LL, improve=0.3154798, (0 missing)
##       Total Revenue < 1662664  to the left,  improve=0.3075029, (0 missing)
##       Total Cost    < 974436.2 to the left,  improve=0.2893031, (0 missing)
##       Unit Price    < 429.545  to the left,  improve=0.1500607, (0 missing)
##       Unit Cost     < 107.275  to the left,  improve=0.1332107, (0 missing)
##   Surrogate splits:
##       Unit Price < 429.545  to the left,  agree=0.850, adj=0.092, (0 split)
##       Units Sold < 2799.5   to the right, agree=0.838, adj=0.019, (0 split)
## 
## Node number 7: 156598 observations,    complexity param=0.04450517
##   mean=1119889, MSE=1.190143e+11 
##   left son=14 (75318 obs) right son=15 (81280 obs)
##   Primary splits:
##       Item Type     splits as  ----R-RLL---, improve=0.5142883, (0 missing)
##       Unit Price    < 429.545  to the left,  improve=0.4083765, (0 missing)
##       Unit Cost     < 314.01   to the right, improve=0.3032946, (0 missing)
##       Total Cost    < 2659437  to the right, improve=0.3032946, (0 missing)
##       Total Revenue < 5347951  to the left,  improve=0.1614648, (0 missing)
##   Surrogate splits:
##       Unit Cost  < 513.75   to the right, agree=0.878, adj=0.747, (0 split)
##       Unit Price < 659.74   to the left,  agree=0.854, adj=0.696, (0 split)
##       Total Cost < 3086668  to the right, agree=0.659, adj=0.291, (0 split)
##       Order Date splits as  RRRRLRLLRRRRRRRLRLRRLRLRLRLLRRLRRRRLLRLRLLLRRRLRRRRLRLRRRLRRLRLLLRRLRLRRRRRRRLLRRRLRLRRLLRRLRRRRLRRLRRRLRRRLLLLLLRLLRRRRRLRRLRRRLRRRLRRLRRRRRLRLRRRRLRLLLRLLLRRRRLRLLRRRRRRRRRRRRRRRLRLRRLLRRRRRRLRRRLLRRRLRRRRRRLRLLRRRRRRRRRLRLRRRRLRRRLRRRRRRRRLRRRLRLLLRRRRLLLRLRLRLRRLRLLRLLRRRRRLRRLLRRLRRRRLRLLLLLLLLRLRLLRRRRRLRRRRRLLRRRRLRRRRLRRRRLRRRRLRLRRRRRRRLRLRRRRLRRRLLRLLRLLRLLRLLRRRLRRRRRLLRRRRRRRRRLLLRLRRLRRRRRRRLLRRRRLRLRLRRRRRLLLRRRRLRRRRRRLLRRRLLRRRRRLRRRRRRRLRLLRLRRRRRRLRRRRRRLLLRLRRRRRRRRLRLLRLLRLLRLRRLLLLRRLRRLRLRLRRRLRRRRRLLRLLRLRRLLRLLLRRLRRLRLRLRLRRRRRLLRRRLRRRRRLRRLRLLRLRRRLRLRRLRLRLRRRRRRRLRRLRLLLRLRRRRLLRRRRLRRLRLRRRRR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RLRRLLRRRLLRLRRRRRLRRLRRRRLRRLRLRRRRRRLRRRRRRLRRRRLRRLLRRRLRLRLLLRRRRLRRLRRRRLLRRLRRLLRRRLRLRLRRRLLRRRRRRRRLLLLRLLRLLRRRRRLRRLRLLLLRRLRRLRRLLRRRRRRLLRRLRRLLRRRRLRRLRRLLLRRLRRRRLRLLRLRRRRLLLRRLRLRRLRRRRRRRRRLRLLLRLRLLRRLRRLRRRRRRRRRLRLRRRRLRLRLRLLLRRRLRRRRLRRLRRLRRRRLLRRLLRRRRRLLRLRLRRRRRRLLRRRLRRRRRRLRRRLRRRLRRLLRRRRLLRRRRLLRRRLRLRLLRLLRRRRRLLRLRLLRLRRRRLLLRRRRLRRRRLRRRLLRRLRLRRRLRRRRLLLRRRRRLRRRLRRRRLRRRLRRRLRLRRRLLLRRLRRLLRRRRRLRRRRRLRRRLRLRLLRLLRRLLRRRRRRLLLRRLRRRLLRRLRRLRLRLRRRLLRRLLRLLRRLRRLRRRLRRLLLLRRLRLRRLRRRLLRRRLLLLRRRLRRLRRRRLRLRLLRLRRRLRRRRLRRLLRRLLRRRRLRRRRRLRRLRRRRRRRLLRRRRRRLLLRRRRRLLLRRRRLRLLRRRRRRRRRLRLLRRRRRRRLLRRRLRLLRRLLRRRRLRRRRRRLRRRLRRRRLLRRRRRRRRLRLRRLRLLLLLLRLRRLLLRRRRLRLRRRLRLLLRLLRRLR-LLRRRRRLRRRRRRR-LRRLRLLRLLRRLRRRRRLRRLRRLRRLRRLRRLRRRRRRRLLRRLLLLLLLRLRRLRLRRLLRRRLRLLLLLLRRLLRLRRRRRRRRLLRLLRRRRRLLRLRLLRRRRRLRRRRRLLRLLRLLRRRRRRRLRLLLLRRRRLLRRLLRRRRRLRR, agree=0.551, adj=0.066, (0 split)
## 
## Node number 12: 372029 observations
##   mean=583317.9, MSE=1.981776e+10 
## 
## Node number 13: 73772 observations,    complexity param=0.02243535
##   mean=905014.1, MSE=8.744813e+10 
##   left son=26 (37000 obs) right son=27 (36772 obs)
##   Primary splits:
##       Units Sold    < 5209.5   to the left,  improve=0.74898370, (0 missing)
##       Total Revenue < 2277593  to the left,  improve=0.74898370, (0 missing)
##       Total Cost    < 1371818  to the left,  improve=0.74898370, (0 missing)
##       Ship Date     splits as  -LLLRRRR-LRRRRLL-RRLLLLL-RLRLRLRRLRLRRRRRRRLLLRLLRLRRRLLLLLRRRLRRRRLLRRRLLLRLRRRLLLRLRLL-RRRLLLLRRRRLLRLRLLRRRRLLLLRLLLRRRRLLRRLRRLRRRRLLLLLRRRRRRRLLLRLRLLLRRLLLLLRRLLRRRRLLRLL-LLLLRRRLLLLRRRLLLRLLLLR-LRLLRRR-RRLRRLL-LLLLLRL-RLLLLLR-RRLLLLR-LLRRRRLLLLLRRLRLLLRRRLLLRRLRRRLRRLRRLLRLRLLLRRLRRRRLLLLRRRLRLRLLLRRLLRRRLRLRRRRLRRRRLLRRRRRLLRLRLLRRRRLLRLRLLRRLLRRRRRRLRRRLRRRLLRRLLLRLRLRLRRRLLRRLRLLLLLRRRRRLRRRLLLLRRLLRLRRRRLRLRRRRLLLLLLLRLRRRLRRLLLRRLLLRRRLLRRRRRRRRLLLRLLRLRLRRRRRRRRLRLRLLRRRRLRRRLLRRLLLLRRLLLLRRLLLRLRLRRLLLRRLRRRRRRLLRRLLLRLRLLRRRRRRRRRRRLLRLRLLLRLLLRRRRRRLRLLLLRRRRRRLLLLRRLLRLLRLRRRLLRLRLRRRRRLLRRRLLRRRRRRRRLRRLLLLRLLRRRLRLRRLRLRRRLRRRLLLRRRRRLRRRLLRRRRLRRLRLRRRLRLLRRRRRLRLLLRLRRLRRRLLLLLRRLLRLRRLRRRRRLLLLLRLLRRRLLLLLLRRLLLRLLLRRRRRLRLLLRLLLRRRLRRRLLRRLLLRLRLLRRRRLLRRLRLLRLLLRRLLRLRRRLLRRRLLRRLRRRRRLRRLRLRLRRRRLRLLRRLRRRLLRRRLLRLRLRRLRLRRRLLRRRLLLRLLLLRRRLLRRRLLRRRLL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LLRRLLRRRRRRRRRLRRRLRLLLRLLRRLLRLRRLLLLLLRRLRRRRLRLRRLLRRLRLRRLRRRRRLRLRRLLLRRRLLRRLRRLRLLLLRRRRLLRRRLLRLLLLRLLLLRLRLRLLLRRRRLLRLLRLRRLLLLLRLRLLLLLRLRRRLRRRLRLLRRRLLRRRLLRRRLLLRRLRRRRRLRLLRRLLLLRRRRLLRLLRLLRRRLLLRRLRLLLRLRLLRLRRRRRRLRLRLLRRLLRLRRRRRLRRLRRRRLRLRLRLLRLLLRLRLLRRRLRLLLRLRRRLRRRRRLLRLLLLRLLRRLLRLRLRLRLRLRRRRLLRLLRLLRLRRLRRLLRRRLRLLLLLRLLLRLRLLLRRLLRLRLRLLRLLLLRLLRRRLRLLRLLRRRLRRLRLLRLLLLRLRLLLRLRRLRRLRLRLRRRLLRLRRLLRLRRLLLLRRLLRLRRLRLLRRLLLRRLRLLLLLRLLRLLLRLLRRRRRLLRRLLRLRLLLRLRLRRLLLRRRLLLRLLLRLLLLRRLRLRLLRRLRRRRLLRLLRRLLLRRRRRLRRLRRLLLLRLRLRLLLLLLRRLRLLRRLLRRRRLLRRRRRLLRLRRRRLRLRLLRLLRLLLLLRLRRLRRLRRLLRRRR, improve=0.01488431, (0 missing)
##   Surrogate splits:
##       Total Revenue < 2277593  to the left,  agree=1.000, adj=1.000, (0 split)
##       Total Cost    < 1371818  to the left,  agree=1.000, adj=1.000, (0 split)
##       Ship Date     splits as  -RLRRLLR-LRRLLRL-RRLLLLL-RLRLLLLLRRLRRLRRRRLRLLLLLLRRRLLLLLRLRLRRRRLLLRLLLLRLLRRLRLLLLLR-RRLLLLLRRRRLLRLRLLRLRRLLLLRRLLRLRRLLRRLRRLRRRRLLLLLRRRRRRRLLLLLRLLLLLLLLLLRRLLRRRRLLRLL-LLLLRRRLLLLRRRLLLRLLLLR-LLLLRRL-RRLRRLL-LLLLLRL-LLLLLLR-RRLLLLR-LLRRRRLLLLLRRLRLLLRRRLLLRRLRRRLRLLLRLL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RRLRRLLLRLRRRLLRLRRLLRLLRLLLLRRLLRLRRLRRLRRRLLLRLRLLLLLLLLRRLLRLRLRLRRLLLRLLLLLLLLRLRLRRLLLLRLLLLRLLRRLLLLRRLRLLLLRRLRLRRLLRLLRRLLLRRRLRLRRRRRLLLRRLRLRLLLLLLRRLRLLRLLLRLRRLRRLLRLLLRLRRRRRLLRLLRLLRLLLLLRLLRLLRLRRLRLRRR, agree=0.561, adj=0.120, (0 split)
##       Country       splits as  LRLLLRLRRRRLLLRLRRLRLRLLLLLLLLLLRLLRLRLRLRLRRRRLRLRRRLLRLLLLLRRLLRLLLLRLRLLRLLRLLRLRLLRRLLLLLRRRLLLRRLLLRLLLRRLLRLLRRLRLRRRLLRRLRLLLLRRLLLLRRLLRLRLRLRLRRRLLLRRLLRLRLRLLLRLLRRRRLLRLLRRRL, agree=0.514, adj=0.026, (0 split)
## 
## Node number 14: 75318 observations,    complexity param=0.01522044
##   mean=862881.7, MSE=5.849142e+10 
##   left son=28 (34115 obs) right son=29 (41203 obs)
##   Primary splits:
##       Total Revenue < 4349106  to the left,  improve=0.7440772, (0 missing)
##       Total Cost    < 3647161  to the left,  improve=0.7392278, (0 missing)
##       Unit Price    < 536.55   to the left,  improve=0.6503606, (0 missing)
##       Item Type     splits as  -------LR---, improve=0.6503606, (0 missing)
##       Unit Cost     < 444.825  to the left,  improve=0.6503606, (0 missing)
##   Surrogate splits:
##       Total Cost < 3645827  to the left,  agree=0.955, adj=0.901, (0 split)
##       Item Type  splits as  -------LR---, agree=0.800, adj=0.559, (0 split)
##       Unit Price < 536.55   to the left,  agree=0.800, adj=0.559, (0 split)
##       Unit Cost  < 444.825  to the left,  agree=0.800, adj=0.559, (0 split)
##       Units Sold < 6678.5   to the left,  agree=0.747, adj=0.441, (0 split)
## 
## Node number 15: 81280 observations,    complexity param=0.01670105
##   mean=1358044, MSE=5.717211e+10 
##   left son=30 (32636 obs) right son=31 (48644 obs)
##   Primary splits:
##       Units Sold < 7939.5   to the left,  improve=0.7740294, (0 missing)
##       Unit Cost  < 382.935  to the right, improve=0.3346489, (0 missing)
##       Unit Price < 552.735  to the right, improve=0.3346489, (0 missing)
##       Total Cost < 2659437  to the right, improve=0.3346489, (0 missing)
##       Item Type  splits as  ----R-L-----, improve=0.3346489, (0 missing)
##   Surrogate splits:
##       Total Revenue < 5305730  to the left,  agree=0.718, adj=0.298, (0 split)
##       Total Cost    < 3989916  to the left,  agree=0.718, adj=0.298, (0 split)
##       Item Type     splits as  ----R-L-----, agree=0.683, adj=0.212, (0 split)
##       Unit Price    < 552.735  to the right, agree=0.683, adj=0.212, (0 split)
##       Unit Cost     < 382.935  to the right, agree=0.683, adj=0.212, (0 split)
## 
## Node number 26: 37000 observations
##   mean=649879.6, MSE=2.196317e+10 
## 
## Node number 27: 36772 observations
##   mean=1161731, MSE=2.193856e+10 
## 
## Node number 28: 34115 observations
##   mean=633611.9, MSE=1.534094e+10 
## 
## Node number 29: 41203 observations
##   mean=1052711, MSE=1.466157e+10 
## 
## Node number 30: 32636 observations
##   mean=1101220, MSE=1.547089e+10 
## 
## Node number 31: 48644 observations
##   mean=1530352, MSE=1.120726e+10