Title: “Biedronki” author: “Sofia Animato, Nel Mazur” date: “2024-01-22” output: html_document —

Libraries:

library(rvest)
library(dplyr)
library(tidyr)
library(rstatix)
library(ggplot2)
library(dlookr)
library(editrules)
library(htmltools)
library(kableExtra)
library(frequency)
library(qwraps2)
library(arsenal)
library(e1071)
library(haven)
library(papeR)
library(dplyr)
library(tidyverse)
library(kableExtra)
library(summarytools)
library(classInt)
library(pastecs)
library(reporttools)
library(desctable)
library(psych)
library(frequency)
library(ggpubr)
library(ggforce)
library(ggdist)
library(gghalves)
library(gtsummary)
library(AER)
library(ggstatsplot)
library(ggplot2)
library (readr)

Import dataset:

Biedronki <- read_csv("Biedronki.csv")
## Rows: 1000 Columns: 17
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (8): Invoice ID, Branch, City, Customer type, Gender, Product line, Dat...
## dbl  (8): Unit price, Quantity, Tax 5%, Total, cogs, gross margin percentage...
## time (1): Time
## 
## ℹ 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.

Introduction:

In the bustling landscape of the retail industry, supermarkets stand as indispensable players, serving as the cornerstone of consumer convenience and satisfaction. In the context of this dynamic sector, our research project is intended to explore and comprehend the complexity of consumer behaviours within Biedronki supermarkets. The primary step of our analysis consists of deeply analyse the data through data wrangling operations, in order to prepare them to be further analysed. This phase is followed by data visualization actions that help the readers to better understand the data frame thanks to visual charts that depicts pattern and trends. Eventually, univariate and bivariate statistics are applied to provide a deeper quantitative understanding of the factors influencing consumer behaviors within Biedronki supermarkets. Throughout our investigation, Gross income emerges as the core variable, indeed we decided to select it for its representative nature and its potential to unveil insights into consumer dynamics.

Missing Values: all the rows are complete:

The analysis reveals that all rows in the “Biedronki” dataset are complete, indicating that there are no missing values across any observation or variable.

sum(complete.cases(Biedronki))
## [1] 1000
nrow(Biedronki[complete.cases(Biedronki), ])/nrow(Biedronki)*100
## [1] 100

Identify outliers:

The output and the boxplot presents a subset of the dataset containing rows identified as outliers in the: total, cogs, tax 5%, gross income. Grouped by the supermarket branch.

Identified outliers for Total:

Biedronki %>%
  group_by(Branch) %>%
  identify_outliers(`Total`)
## # A tibble: 4 × 19
##   Branch `Invoice ID` City    `Customer type` Gender `Product line` `Unit price`
##   <chr>  <chr>        <chr>   <chr>           <chr>  <chr>                 <dbl>
## 1 A      687-47-8271  Yangon  Normal          Male   Fashion acces…         99.0
## 2 A      325-77-6186  Yangon  Member          Female Home and life…         90.6
## 3 B      744-16-7898  Mandal… Normal          Female Home and life…         97.4
## 4 B      303-96-2227  Mandal… Normal          Female Home and life…         97.4
## # ℹ 12 more variables: Quantity <dbl>, `Tax 5%` <dbl>, Total <dbl>, Date <chr>,
## #   Time <time>, Payment <chr>, cogs <dbl>, `gross margin percentage` <dbl>,
## #   `gross income` <dbl>, Rating <dbl>, is.outlier <lgl>, is.extreme <lgl>
boxplot(Total~Branch, data=Biedronki)

Identified outliers for cogs:

Biedronki %>%
  group_by(Branch) %>%
  identify_outliers('cogs')
## # A tibble: 4 × 19
##   Branch `Invoice ID` City    `Customer type` Gender `Product line` `Unit price`
##   <chr>  <chr>        <chr>   <chr>           <chr>  <chr>                 <dbl>
## 1 A      687-47-8271  Yangon  Normal          Male   Fashion acces…         99.0
## 2 A      325-77-6186  Yangon  Member          Female Home and life…         90.6
## 3 B      744-16-7898  Mandal… Normal          Female Home and life…         97.4
## 4 B      303-96-2227  Mandal… Normal          Female Home and life…         97.4
## # ℹ 12 more variables: Quantity <dbl>, `Tax 5%` <dbl>, Total <dbl>, Date <chr>,
## #   Time <time>, Payment <chr>, cogs <dbl>, `gross margin percentage` <dbl>,
## #   `gross income` <dbl>, Rating <dbl>, is.outlier <lgl>, is.extreme <lgl>
boxplot(cogs~Branch, data=Biedronki)

Identified outliers for Tax 5%:

Biedronki %>%
  group_by(Branch) %>%
  identify_outliers(`Tax 5%`)
## # A tibble: 4 × 19
##   Branch `Invoice ID` City    `Customer type` Gender `Product line` `Unit price`
##   <chr>  <chr>        <chr>   <chr>           <chr>  <chr>                 <dbl>
## 1 A      687-47-8271  Yangon  Normal          Male   Fashion acces…         99.0
## 2 A      325-77-6186  Yangon  Member          Female Home and life…         90.6
## 3 B      744-16-7898  Mandal… Normal          Female Home and life…         97.4
## 4 B      303-96-2227  Mandal… Normal          Female Home and life…         97.4
## # ℹ 12 more variables: Quantity <dbl>, `Tax 5%` <dbl>, Total <dbl>, Date <chr>,
## #   Time <time>, Payment <chr>, cogs <dbl>, `gross margin percentage` <dbl>,
## #   `gross income` <dbl>, Rating <dbl>, is.outlier <lgl>, is.extreme <lgl>
boxplot(Biedronki$`Tax 5%`~Branch, data=Biedronki)

Identified outliers for gross income:

Biedronki %>%
  group_by(Branch) %>%
  identify_outliers(`gross income`)
## # A tibble: 4 × 19
##   Branch `Invoice ID` City    `Customer type` Gender `Product line` `Unit price`
##   <chr>  <chr>        <chr>   <chr>           <chr>  <chr>                 <dbl>
## 1 A      687-47-8271  Yangon  Normal          Male   Fashion acces…         99.0
## 2 A      325-77-6186  Yangon  Member          Female Home and life…         90.6
## 3 B      744-16-7898  Mandal… Normal          Female Home and life…         97.4
## 4 B      303-96-2227  Mandal… Normal          Female Home and life…         97.4
## # ℹ 12 more variables: Quantity <dbl>, `Tax 5%` <dbl>, Total <dbl>, Date <chr>,
## #   Time <time>, Payment <chr>, cogs <dbl>, `gross margin percentage` <dbl>,
## #   `gross income` <dbl>, Rating <dbl>, is.outlier <lgl>, is.extreme <lgl>
boxplot(Biedronki$`gross income`~Branch, data=Biedronki)

Imputate outliers and data correction:

Imputing outliers for the total, cogs, tax 5%, gross income variables involves replacing extreme values with more moderate values. Capping is method used in this process.

Imputate outlier for “Total”:

Biedronki %>%
   mutate(Total_imp = imputate_outlier(Biedronki, Total, method = "capping")) %>%
  summary()
## Impute outliers with capping
## 
## * Information of Imputation (before vs after)
##                     Original      Imputation   
## described_variables "value"       "value"      
## n                   "1000"        "1000"       
## na                  "0"           "0"          
## mean                "322.9667"    "321.1578"   
## sd                  "245.8853"    "241.4160"   
## se_mean             "7.775577"    "7.634244"   
## IQR                 "346.9279"    "346.9279"   
## skewness            "0.8925698"   "0.8247647"  
## kurtosis            "-0.08188476" "-0.31237265"
## p00                 "10.6785"     "10.6785"    
## p01                 "19.18843"    "19.18843"   
## p05                 "41.07023"    "41.07023"   
## p10                 "68.103"      "68.103"     
## p20                 "97.7382"     "97.7382"    
## p25                 "124.4224"    "124.4224"   
## p30                 "147.4546"    "147.4546"   
## p40                 "195.0984"    "195.0984"   
## p50                 "253.848"     "253.848"    
## p60                 "325.7268"    "325.7268"   
## p70                 "419.2146"    "419.2146"   
## p75                 "471.3502"    "471.3502"   
## p80                 "533.2572"    "533.2572"   
## p90                 "718.9108"    "718.9108"   
## p95                 "822.4965"    "822.2671"   
## p99                 "950.2657"    "932.3663"   
## p100                "1042.650"    " 951.825"
##   Invoice ID           Branch              City           Customer type     
##  Length:1000        Length:1000        Length:1000        Length:1000       
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##     Gender          Product line         Unit price       Quantity    
##  Length:1000        Length:1000        Min.   :10.08   Min.   : 1.00  
##  Class :character   Class :character   1st Qu.:32.88   1st Qu.: 3.00  
##  Mode  :character   Mode  :character   Median :55.23   Median : 5.00  
##                                        Mean   :55.67   Mean   : 5.51  
##                                        3rd Qu.:77.94   3rd Qu.: 8.00  
##                                        Max.   :99.96   Max.   :10.00  
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##      Tax 5%            Total             Date               Time         
##  Min.   : 0.5085   Min.   :  10.68   Length:1000        Length:1000      
##  1st Qu.: 5.9249   1st Qu.: 124.42   Class :character   Class1:hms       
##  Median :12.0880   Median : 253.85   Mode  :character   Class2:difftime  
##  Mean   :15.3794   Mean   : 322.97                      Mode  :numeric   
##  3rd Qu.:22.4453   3rd Qu.: 471.35                                       
##  Max.   :49.6500   Max.   :1042.65                                       
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##    Payment               cogs        gross margin percentage  gross income    
##  Length:1000        Min.   : 10.17   Min.   :4.762           Min.   : 0.5085  
##  Class :character   1st Qu.:118.50   1st Qu.:4.762           1st Qu.: 5.9249  
##  Mode  :character   Median :241.76   Median :4.762           Median :12.0880  
##                     Mean   :307.59   Mean   :4.762           Mean   :15.3794  
##                     3rd Qu.:448.90   3rd Qu.:4.762           3rd Qu.:22.4453  
##                     Max.   :993.00   Max.   :4.762           Max.   :49.6500  
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##      Rating       Total_imp.Original  Total_imp.Imputation
##  Min.   : 4.000   value        value                      
##  1st Qu.: 5.500   1000         1000                       
##  Median : 7.000   0            0                          
##  Mean   : 6.973   322.9667     321.1578                   
##  3rd Qu.: 8.500   245.8853     241.4160                   
##  Max.   :10.000   7.775577     7.634244                   
##                   346.9279     346.9279                   
##                   0.8925698    0.8247647                  
##                   -0.08188476  -0.31237265                
##                   10.6785      10.6785                    
##                   19.18843     19.18843                   
##                   41.07023     41.07023                   
##                   68.103       68.103                     
##                   97.7382      97.7382                    
##                   124.4224     124.4224                   
##                   147.4546     147.4546                   
##                   195.0984     195.0984                   
##                   253.848      253.848                    
##                   325.7268     325.7268                   
##                   419.2146     419.2146                   
##                   471.3502     471.3502                   
##                   533.2572     533.2572                   
##                   718.9108     718.9108                   
##                   822.4965     822.2671                   
##                   950.2657     932.3663                   
##                   1042.650      951.825

Imputate outlier for “Cogs”:

Biedronki %>%
   mutate(Cogs_imp = imputate_outlier(Biedronki, cogs, method = "capping")) %>%
  summary()
## Impute outliers with capping
## 
## * Information of Imputation (before vs after)
##                     Original      Imputation   
## described_variables "value"       "value"      
## n                   "1000"        "1000"       
## na                  "0"           "0"          
## mean                "307.5874"    "305.8646"   
## sd                  "234.1765"    "229.9200"   
## se_mean             "7.405311"    "7.270708"   
## IQR                 "330.4075"    "330.4075"   
## skewness            "0.8925698"   "0.8247647"  
## kurtosis            "-0.08188476" "-0.31237265"
## p00                 "10.17"       "10.17"      
## p01                 "18.2747"     "18.2747"    
## p05                 "39.1145"     "39.1145"    
## p10                 "64.86"       "64.86"      
## p20                 "93.084"      "93.084"     
## p25                 "118.4975"    "118.4975"   
## p30                 "140.433"     "140.433"    
## p40                 "185.808"     "185.808"    
## p50                 "241.76"      "241.76"     
## p60                 "310.216"     "310.216"    
## p70                 "399.252"     "399.252"    
## p75                 "448.905"     "448.905"    
## p80                 "507.864"     "507.864"    
## p90                 "684.677"     "684.677"    
## p95                 "783.3300"    "783.1115"   
## p99                 "905.0150"    "887.9679"   
## p100                "993.0"       "906.5"
##   Invoice ID           Branch              City           Customer type     
##  Length:1000        Length:1000        Length:1000        Length:1000       
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##     Gender          Product line         Unit price       Quantity    
##  Length:1000        Length:1000        Min.   :10.08   Min.   : 1.00  
##  Class :character   Class :character   1st Qu.:32.88   1st Qu.: 3.00  
##  Mode  :character   Mode  :character   Median :55.23   Median : 5.00  
##                                        Mean   :55.67   Mean   : 5.51  
##                                        3rd Qu.:77.94   3rd Qu.: 8.00  
##                                        Max.   :99.96   Max.   :10.00  
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##      Tax 5%            Total             Date               Time         
##  Min.   : 0.5085   Min.   :  10.68   Length:1000        Length:1000      
##  1st Qu.: 5.9249   1st Qu.: 124.42   Class :character   Class1:hms       
##  Median :12.0880   Median : 253.85   Mode  :character   Class2:difftime  
##  Mean   :15.3794   Mean   : 322.97                      Mode  :numeric   
##  3rd Qu.:22.4453   3rd Qu.: 471.35                                       
##  Max.   :49.6500   Max.   :1042.65                                       
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##    Payment               cogs        gross margin percentage  gross income    
##  Length:1000        Min.   : 10.17   Min.   :4.762           Min.   : 0.5085  
##  Class :character   1st Qu.:118.50   1st Qu.:4.762           1st Qu.: 5.9249  
##  Mode  :character   Median :241.76   Median :4.762           Median :12.0880  
##                     Mean   :307.59   Mean   :4.762           Mean   :15.3794  
##                     3rd Qu.:448.90   3rd Qu.:4.762           3rd Qu.:22.4453  
##                     Max.   :993.00   Max.   :4.762           Max.   :49.6500  
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##      Rating       Cogs_imp.Original  Cogs_imp.Imputation
##  Min.   : 4.000   value        value                    
##  1st Qu.: 5.500   1000         1000                     
##  Median : 7.000   0            0                        
##  Mean   : 6.973   307.5874     305.8646                 
##  3rd Qu.: 8.500   234.1765     229.9200                 
##  Max.   :10.000   7.405311     7.270708                 
##                   330.4075     330.4075                 
##                   0.8925698    0.8247647                
##                   -0.08188476  -0.31237265              
##                   10.17        10.17                    
##                   18.2747      18.2747                  
##                   39.1145      39.1145                  
##                   64.86        64.86                    
##                   93.084       93.084                   
##                   118.4975     118.4975                 
##                   140.433      140.433                  
##                   185.808      185.808                  
##                   241.76       241.76                   
##                   310.216      310.216                  
##                   399.252      399.252                  
##                   448.905      448.905                  
##                   507.864      507.864                  
##                   684.677      684.677                  
##                   783.3300     783.1115                 
##                   905.0150     887.9679                 
##                   993.0        906.5

Imputate outlier for “Tax 5%”:

Biedronki %>%
   mutate(Tax_5_imp = imputate_outlier(Biedronki, `Tax 5%`, method = "capping")) %>%
  summary()
## Impute outliers with capping
## 
## * Information of Imputation (before vs after)
##                     Original      Imputation   
## described_variables "value"       "value"      
## n                   "1000"        "1000"       
## na                  "0"           "0"          
## mean                "15.37937"    "15.29323"   
## sd                  "11.70883"    "11.49600"   
## se_mean             "0.3702656"   "0.3635354"  
## IQR                 "16.52037"    "16.52037"   
## skewness            "0.8925698"   "0.8247647"  
## kurtosis            "-0.08188476" "-0.31237265"
## p00                 "0.5085"      "0.5085"     
## p01                 "0.913735"    "0.913735"   
## p05                 "1.955725"    "1.955725"   
## p10                 "3.243"       "3.243"      
## p20                 "4.6542"      "4.6542"     
## p25                 "5.924875"    "5.924875"   
## p30                 "7.02165"     "7.02165"    
## p40                 "9.2904"      "9.2904"     
## p50                 "12.088"      "12.088"     
## p60                 "15.5108"     "15.5108"    
## p70                 "19.9626"     "19.9626"    
## p75                 "22.44525"    "22.44525"   
## p80                 "25.3932"     "25.3932"    
## p90                 "34.23385"    "34.23385"   
## p95                 "39.16650"    "39.15557"   
## p99                 "45.25075"    "44.39840"   
## p100                "49.650"      "45.325"
##   Invoice ID           Branch              City           Customer type     
##  Length:1000        Length:1000        Length:1000        Length:1000       
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##     Gender          Product line         Unit price       Quantity    
##  Length:1000        Length:1000        Min.   :10.08   Min.   : 1.00  
##  Class :character   Class :character   1st Qu.:32.88   1st Qu.: 3.00  
##  Mode  :character   Mode  :character   Median :55.23   Median : 5.00  
##                                        Mean   :55.67   Mean   : 5.51  
##                                        3rd Qu.:77.94   3rd Qu.: 8.00  
##                                        Max.   :99.96   Max.   :10.00  
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##      Tax 5%            Total             Date               Time         
##  Min.   : 0.5085   Min.   :  10.68   Length:1000        Length:1000      
##  1st Qu.: 5.9249   1st Qu.: 124.42   Class :character   Class1:hms       
##  Median :12.0880   Median : 253.85   Mode  :character   Class2:difftime  
##  Mean   :15.3794   Mean   : 322.97                      Mode  :numeric   
##  3rd Qu.:22.4453   3rd Qu.: 471.35                                       
##  Max.   :49.6500   Max.   :1042.65                                       
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##    Payment               cogs        gross margin percentage  gross income    
##  Length:1000        Min.   : 10.17   Min.   :4.762           Min.   : 0.5085  
##  Class :character   1st Qu.:118.50   1st Qu.:4.762           1st Qu.: 5.9249  
##  Mode  :character   Median :241.76   Median :4.762           Median :12.0880  
##                     Mean   :307.59   Mean   :4.762           Mean   :15.3794  
##                     3rd Qu.:448.90   3rd Qu.:4.762           3rd Qu.:22.4453  
##                     Max.   :993.00   Max.   :4.762           Max.   :49.6500  
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##      Rating       Tax_5_imp.Original  Tax_5_imp.Imputation
##  Min.   : 4.000   value        value                      
##  1st Qu.: 5.500   1000         1000                       
##  Median : 7.000   0            0                          
##  Mean   : 6.973   15.37937     15.29323                   
##  3rd Qu.: 8.500   11.70883     11.49600                   
##  Max.   :10.000   0.3702656    0.3635354                  
##                   16.52037     16.52037                   
##                   0.8925698    0.8247647                  
##                   -0.08188476  -0.31237265                
##                   0.5085       0.5085                     
##                   0.913735     0.913735                   
##                   1.955725     1.955725                   
##                   3.243        3.243                      
##                   4.6542       4.6542                     
##                   5.924875     5.924875                   
##                   7.02165      7.02165                    
##                   9.2904       9.2904                     
##                   12.088       12.088                     
##                   15.5108      15.5108                    
##                   19.9626      19.9626                    
##                   22.44525     22.44525                   
##                   25.3932      25.3932                    
##                   34.23385     34.23385                   
##                   39.16650     39.15557                   
##                   45.25075     44.39840                   
##                   49.650       45.325

Imputate outlier for “gross income”:

Biedronki %>%
   mutate(gross_income_imp = imputate_outlier(Biedronki, `gross income`, method = "capping")) %>%
  summary()
## Impute outliers with capping
## 
## * Information of Imputation (before vs after)
##                     Original      Imputation   
## described_variables "value"       "value"      
## n                   "1000"        "1000"       
## na                  "0"           "0"          
## mean                "15.37937"    "15.29323"   
## sd                  "11.70883"    "11.49600"   
## se_mean             "0.3702656"   "0.3635354"  
## IQR                 "16.52037"    "16.52037"   
## skewness            "0.8925698"   "0.8247647"  
## kurtosis            "-0.08188476" "-0.31237265"
## p00                 "0.5085"      "0.5085"     
## p01                 "0.913735"    "0.913735"   
## p05                 "1.955725"    "1.955725"   
## p10                 "3.243"       "3.243"      
## p20                 "4.6542"      "4.6542"     
## p25                 "5.924875"    "5.924875"   
## p30                 "7.02165"     "7.02165"    
## p40                 "9.2904"      "9.2904"     
## p50                 "12.088"      "12.088"     
## p60                 "15.5108"     "15.5108"    
## p70                 "19.9626"     "19.9626"    
## p75                 "22.44525"    "22.44525"   
## p80                 "25.3932"     "25.3932"    
## p90                 "34.23385"    "34.23385"   
## p95                 "39.16650"    "39.15557"   
## p99                 "45.25075"    "44.39840"   
## p100                "49.650"      "45.325"
##   Invoice ID           Branch              City           Customer type     
##  Length:1000        Length:1000        Length:1000        Length:1000       
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##     Gender          Product line         Unit price       Quantity    
##  Length:1000        Length:1000        Min.   :10.08   Min.   : 1.00  
##  Class :character   Class :character   1st Qu.:32.88   1st Qu.: 3.00  
##  Mode  :character   Mode  :character   Median :55.23   Median : 5.00  
##                                        Mean   :55.67   Mean   : 5.51  
##                                        3rd Qu.:77.94   3rd Qu.: 8.00  
##                                        Max.   :99.96   Max.   :10.00  
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##      Tax 5%            Total             Date               Time         
##  Min.   : 0.5085   Min.   :  10.68   Length:1000        Length:1000      
##  1st Qu.: 5.9249   1st Qu.: 124.42   Class :character   Class1:hms       
##  Median :12.0880   Median : 253.85   Mode  :character   Class2:difftime  
##  Mean   :15.3794   Mean   : 322.97                      Mode  :numeric   
##  3rd Qu.:22.4453   3rd Qu.: 471.35                                       
##  Max.   :49.6500   Max.   :1042.65                                       
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##                                                                          
##    Payment               cogs        gross margin percentage  gross income    
##  Length:1000        Min.   : 10.17   Min.   :4.762           Min.   : 0.5085  
##  Class :character   1st Qu.:118.50   1st Qu.:4.762           1st Qu.: 5.9249  
##  Mode  :character   Median :241.76   Median :4.762           Median :12.0880  
##                     Mean   :307.59   Mean   :4.762           Mean   :15.3794  
##                     3rd Qu.:448.90   3rd Qu.:4.762           3rd Qu.:22.4453  
##                     Max.   :993.00   Max.   :4.762           Max.   :49.6500  
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##                                                                               
##      Rating       gross_income_imp.Original  gross_income_imp.Imputation
##  Min.   : 4.000   value        value                                    
##  1st Qu.: 5.500   1000         1000                                     
##  Median : 7.000   0            0                                        
##  Mean   : 6.973   15.37937     15.29323                                 
##  3rd Qu.: 8.500   11.70883     11.49600                                 
##  Max.   :10.000   0.3702656    0.3635354                                
##                   16.52037     16.52037                                 
##                   0.8925698    0.8247647                                
##                   -0.08188476  -0.31237265                              
##                   0.5085       0.5085                                   
##                   0.913735     0.913735                                 
##                   1.955725     1.955725                                 
##                   3.243        3.243                                    
##                   4.6542       4.6542                                   
##                   5.924875     5.924875                                 
##                   7.02165      7.02165                                  
##                   9.2904       9.2904                                   
##                   12.088       12.088                                   
##                   15.5108      15.5108                                  
##                   19.9626      19.9626                                  
##                   22.44525     22.44525                                 
##                   25.3932      25.3932                                  
##                   34.23385     34.23385                                 
##                   39.16650     39.15557                                 
##                   45.25075     44.39840                                 
##                   49.650       45.325

Rules to follow:

We have the following rules:

RULE <- editset(c("gross_income > 0"))
RULE <- editset(c("Rating > 6"))

How many times the rule has been violated:

The analysis reveals only one violation based on the specified rules. This suggests that the dataset ‘Biedronki’ is generally in compliance with the defined criteria.

violated <- violatedEdits(RULE, Biedronki)
summary(violated)
## Edit violations, 1000 observations, 0 completely missing (0%):
## 
##  editname freq   rel
##      num1  341 34.1%
## 
## Edit violations per record:
## 
##  errors freq   rel
##       0  659 65.9%
##       1  341 34.1%
plot(violated)

Data Visualization:

Plot 1:

Gross margin percentage from the product lines are similar. The lowest values of gross margin percentage can be observed in the category of health and beauty products.

ggplot(Biedronki,
 aes(x = Biedronki$`Product line`,
 y = Biedronki$`gross margin percentage`)) +
  geom_col()

Plot 2:

In each branch the rating values range from 4 to 10. There are no outliers. The median rating is similar in all cases and is around 7. All ratings are equally distributed. Slightly lower ratings can be observed in branch B.

ggplot(data = Biedronki, mapping = aes(x = Branch, y = Biedronki$Rating)) +
    geom_boxplot(color="red")

Plot 3:

The minimum, maximum and median cost of good sold is similar in each city.

ggplot(data = Biedronki) + 
  stat_summary(
    mapping = aes(x = City, y = cogs),
    fun.min = min,
    fun.max = max,
    fun = median,
    size = 0.75 
  )

Plot 4:

In Mandalay, there is no significant difference in gross income between different payment methods. There was not significant gender difference observed with the different payment types. In Naypyitaw, a higher gross income value can be observed for cash payments and a significantly lower one for card payments. Women used card payments more often. In Yangon, the highest gross income was with ewallet payment. There was not a significant gender difference observed for the different payment types.

ggplot(Biedronki,
 aes(x = Payment,
 y = Biedronki$`gross income`,
 fill = Gender)) +
 geom_col() +
 scale_fill_brewer( palette = "Dark2") +
 facet_grid(~ City)

Univariate Statistics:

Summary tables:

The summary table reveals that the majority of the observations in the dataset ‘Biedronki’ fall within the first gross income class (0-10 kPLN). This concentration suggests that a significant portion of the data is characterized by lower gross income levels, which may affect the purchasing behaviour of costumers, thus it may be crucial for the developement of commercial and marketing strategies.

tabl1<-c("0-10 kPLN","10-20 kPLN","20-30 kPLN","30-40 kPLN","40-50 kPLN")
limits<-cut(Biedronki$`gross income`,seq(0,50,by=10),labels=tabl1)
tablee1<-freq(limits,type="html")
kbl(tablee1)
Freq % Valid % Valid Cum. % Total % Total Cum.
0-10 kPLN 434 43.4 43.4 43.4 43.4
10-20 kPLN 267 26.7 70.1 26.7 70.1
20-30 kPLN 162 16.2 86.3 16.2 86.3
30-40 kPLN 97 9.7 96.0 9.7 96.0
40-50 kPLN 40 4.0 100.0 4.0 100.0
<NA> 0 NA NA 0.0 100.0
Total 1000 100.0 100.0 100.0 100.0

Frequency Tables:

The frequency table illustrated below allows for a quick assessment of the prevalence of income levels within the specified ranges, providing valuable insights into the dataset’s economic profiles. As well as the summary table presented few lines before, it reveals that the majority of the observations in the dataset ‘Biedronki’ fall within the first gross income class. This should be, again, a useful information to consider while implementing strategic decisions.

Gross income - Biedronka - values in kPLN
Freq % Valid % Valid Cum. % Total % Total Cum.
0-10 kPLN 434 43.4 43.4 43.4 43.4
10-20 kPLN 267 26.7 70.1 26.7 70.1
20-30 kPLN 162 16.2 86.3 16.2 86.3
30-40 kPLN 97 9.7 96.0 9.7 96.0
40-50 kPLN 40 4.0 100.0 4.0 100.0
<NA> 0 NA NA 0.0 100.0
Total 1000 100.0 100.0 100.0 100.0
##        # classes  Goodness of fit Tabular accuracy 
##        5.0000000        0.9443457        0.7543108

Basic plots:

This histogram visually represents the distribution of gross income in the ‘Biedronki’ dataset. The bars are colored green, and the density plots overlayed in different colors correspond to the cities Yangon, Naypyitaw, and Mandalay. The graph provides a clear depiction of the income distribution, while the density lines highlight potential variations across different cities. The legend at the top-right indicates the city corresponding to each density plot, enhancing the interpretability of the graph.

This boxplot illustrates the distribution of gross income in ‘Biedronki’ across different cities. Each box represents the interquartile range (IQR) of income for a specific city, with the median marked by a line inside each box. The whiskers extend to the minimum and maximum values within 1.5 times the IQR. this boxplot is effective to compare the central tendency and spread of income data between different cities, providing a summary of the dataset’s variation across locations.

ggplot2 plots:

This composite visualization effectively communicates insights into the distribution of gross income in ‘Biedronki’ supermarkets across three cities. The density plot provides a visual representation of the income distribution, distinguished by city with a palette of colors. The dashed red lines represent normal density overlays.

The summary table presents key descriptive statistics, including the count, mean, and standard deviation for each city. This provides a concise numerical summary of the income data within each location.

The descriptive text at the bottom adds context to the visualization, mentioning the dataset size and the focus on a random sample of 200 Biedronki supermarkets. Overall, this multifaceted approach enhances the understanding of the gross income distribution in relation to different cities in the dataset. This chart is, again, useful to implement marketing and strategic decisions, especially when it comes to market segmentation and placement of new products; with this concern, it could be the basis for further analysis on consumer’s purchasing behaviour and needs based on their provenience.

Summary table 1:

Gross income statistics for individual payment types at Biedronki are similar. This suggests a high degree of uniformity in the distribution of gross income, with no significant differences between payment categories. All measures of central tendency (mean, median) and variability (standard deviation, interquartile range) show similar values for each type of payment. Additionally, skewness and kurtosis, which indicate the shape of the distribution, do not show any noticeable differences. Overall, based on the statistical analysis provided, the gross income profiles across payment types appear remarkably consistent.

Biedronki %>%
  select(`gross income`,Payment) %>%
  tbl_summary(label= `gross income` ~ "Table 1. Biedronki - gross income in kPLN by type of payment.",digits=c(`gross income`)~3,by=Payment,type = all_continuous() ~ "continuous2", statistic = all_continuous() ~ c("{N_nonmiss}", "{median}" ,"{p25}", "{p75}", "{min}", "{max}", "{mean}", "{sd}", "{iqr}", "{skewness}", "{kurtosis}"),missing = "no")
Characteristic Cash, N = 344 Credit card, N = 311 Ewallet, N = 345
Table 1. Biedronki - gross income in kPLN by type of payment.


    N 344.000 311.000 345.000
    Median 12.522 11.409 12.080
    25% 6.320 5.627 5.832
    75% 22.548 22.799 22.353
    Minimum 0.509 0.605 0.639
    Maximum 47.790 49.650 49.260
    Mean 15.532 15.429 15.182
    SD 11.555 12.243 11.396
    iqr 16.229 17.173 16.521
    skewness 0.822 0.917 0.915
    kurtosis -0.238 -0.137 0.037

Summary table 2:

The statistics presented in Table 2 indicate consistency of gross income profiles across different customer types at Biedronki. All key measures of central tendency, including mean and median, show similar values for each customer category. Similarly, measures of variability such as standard deviation (SD) and interquartile range (iqr), as well as distribution features such as skewness and kurtosis, do not show significant differences. The lack of variability between customer types suggests that customers, irrespective of their type, have similar financial behaviors or contribute equally to the gross income distribution at Biedronki.

In summary, the consistent statistical results imply a homogeneous gross income distribution across different customer types, providing valuable insights for Biedronki’s understanding of its customer base and informing business strategies accordingly.

Biedronki %>%
  select(`gross income`,`Customer type`) %>%
  tbl_summary(label= `gross income` ~ "Table 1. Biedronki - gross income in kPLN by type of customer.",digits=c(`gross income`)~3,by=`Customer type`,type = all_continuous() ~ "continuous2", statistic = all_continuous() ~ c("{N_nonmiss}", "{median}" ,"{p25}", "{p75}", "{min}", "{max}", "{mean}", "{sd}", "{iqr}", "{skewness}", "{kurtosis}"),missing = "no")
Characteristic Member, N = 501 Normal, N = 499
Table 1. Biedronki - gross income in kPLN by type of customer.

    N 501.000 499.000
    Median 12.668 11.306
    25% 5.631 6.154
    75% 23.123 22.029
    Minimum 0.509 0.605
    Maximum 49.650 49.490
    Mean 15.609 15.149
    SD 11.809 11.614
    iqr 17.492 15.875
    skewness 0.837 0.942
    kurtosis -0.224 0.038

Summary table 3:

The statistics presented in Table 3 reveal, again, a consistency in the gross income profiles across different product lines at Biedronki. All key measures of central tendency, including mean and median, show similar values for each product line. The measures of variability such as standard deviation and interquartile range, as well as distribution characteristics like skewness and kurtosis, exhibit no significant differences at all. The absence of variability in these results across product lines suggests, same as for the costumer types, a uniformity in the financial dynamics of gross income. Product lines seem to contribute equally to the gross income distribution at Biedronki.

This uniformity of gross income distribution across different product lines, may have implications for strategic decision-making, inventory management, and marketing strategies, as the financial patterns do not exhibit significant distinctions among product categories.

Biedronki %>%
  select(`gross income`,`Product line`) %>%
  tbl_summary(label= `gross income` ~ "Table 1. Biedronki - gross income in kPLN by type of product line.",digits=c(`gross income`)~3,by=`Product line`,type = all_continuous() ~ "continuous2", statistic = all_continuous() ~ c("{N_nonmiss}", "{median}" ,"{p25}", "{p75}", "{min}", "{max}", "{mean}", "{sd}", "{iqr}", "{skewness}", "{kurtosis}"),missing = "no")
Characteristic Electronic accessories, N = 170 Fashion accessories, N = 178 Food and beverages, N = 174 Health and beauty, N = 152 Home and lifestyle, N = 160 Sports and travel, N = 166
Table 1. Biedronki - gross income in kPLN by type of product line.





    N 170.000 178.000 174.000 152.000 160.000 166.000
    Median 11.487 10.079 12.023 12.967 12.295 12.902
    25% 5.643 5.055 6.424 5.984 6.004 6.346
    75% 22.658 21.081 21.555 23.463 23.417 22.747
    Minimum 1.273 0.605 1.079 0.888 0.699 0.509
    Maximum 44.879 49.650 49.260 45.250 48.750 47.720
    Mean 15.221 14.528 15.365 15.412 16.030 15.813
    SD 11.712 11.598 11.769 11.311 12.124 11.827
    iqr 17.015 16.026 15.131 17.479 17.414 16.401
    skewness 0.802 0.979 1.020 0.771 0.907 0.785
    kurtosis -0.537 0.273 0.154 -0.323 -0.086 -0.302

Distribution of gross income with a breakdown by product lines:

This histogram offers insights into the distribution of gross income in ‘Biedronki’ with a breakdown by product lines. The green bars represent the overall distribution, while overlaid density plots in different colors correspond to specific product lines, including Electronic accessories, Fashion accessories, and Food and beverages. The legend at the top-right facilitates interpretation by associating each density plot with its respective product line.

This visualization effectively compares the income distribution across various product categories, providing a visual understanding of how different types of products contribute to the overall gross income.

hist(Biedronki$`gross income`, breaks="FD", col="green", probability = TRUE,
     main="Gross income in kPLN - Biedronki")
lines(density(Biedronki$`gross income`[Biedronki$`Product line`=="Electronic accessories"]),col=2)
lines(density(Biedronki$`gross income`[Biedronki$`Product line`=="Fashion accessories"]),col=3)
lines(density(Biedronki$`gross income`[Biedronki$`Product line`=="Food and beverages"]),col=4)
legend("topright", legend=c("Electronic accessories", "Fashion accessories", "Food and beverages"),
       col=c(2,3,4), lty=1:2, horiz=FALSE, box.lty=0, cex=0.8)

Data Frame Summary:

This is a comprehensive summary report for the ‘Biedronki’ dataset using the dfSummary function. The report includes various statistics and visualizations, it is a valuable tool for initial exploratory data analysis, offering insights into data distributions, missing values, and other key attributes. Overall, this approach facilitates a quick and thorough understanding of the dataset’s structure and content.

dfSummary(Biedronki,
          plain.ascii  = FALSE, 
          style        = "grid", 
          graph.magnif = 0.75, 
          valid.col    = FALSE,
          tmp.img.dir  = "/tmp")
## temporary images written to 'C:\tmp'

Data Frame Summary

Biedronki

Dimensions: 1000 x 17
Duplicates: 0

No Variable Stats / Values Freqs (% of Valid) Graph Missing
1 Invoice ID
[character]
1. 101-17-6199
2. 101-81-4070
3. 102-06-2002
4. 102-77-2261
5. 105-10-6182
6. 105-31-1824
7. 106-35-6779
8. 109-28-2512
9. 109-86-4363
10. 110-05-6330
[ 990 others ]
1 ( 0.1%)
1 ( 0.1%)
1 ( 0.1%)
1 ( 0.1%)
1 ( 0.1%)
1 ( 0.1%)
1 ( 0.1%)
1 ( 0.1%)
1 ( 0.1%)
1 ( 0.1%)
990 (99.0%)
0
(0.0%)
2 Branch
[character]
1. A
2. B
3. C
340 (34.0%)
332 (33.2%)
328 (32.8%)
0
(0.0%)
3 City
[character]
1. Mandalay
2. Naypyitaw
3. Yangon
332 (33.2%)
328 (32.8%)
340 (34.0%)
0
(0.0%)
4 Customer type
[character]
1. Member
2. Normal
501 (50.1%)
499 (49.9%)
0
(0.0%)
5 Gender
[character]
1. Female
2. Male
501 (50.1%)
499 (49.9%)
0
(0.0%)
6 Product line
[character]
1. Electronic accessories
2. Fashion accessories
3. Food and beverages
4. Health and beauty
5. Home and lifestyle
6. Sports and travel
170 (17.0%)
178 (17.8%)
174 (17.4%)
152 (15.2%)
160 (16.0%)
166 (16.6%)
0
(0.0%)
7 Unit price
[numeric]
Mean (sd) : 55.7 (26.5)
min < med < max:
10.1 < 55.2 < 100
IQR (CV) : 45.1 (0.5)
943 distinct values 0
(0.0%)
8 Quantity
[numeric]
Mean (sd) : 5.5 (2.9)
min < med < max:
1 < 5 < 10
IQR (CV) : 5 (0.5)
1 : 112 (11.2%)
2 : 91 ( 9.1%)
3 : 90 ( 9.0%)
4 : 109 (10.9%)
5 : 102 (10.2%)
6 : 98 ( 9.8%)
7 : 102 (10.2%)
8 : 85 ( 8.5%)
9 : 92 ( 9.2%)
10 : 119 (11.9%)
0
(0.0%)
9 Tax 5%
[numeric]
Mean (sd) : 15.4 (11.7)
min < med < max:
0.5 < 12.1 < 49.6
IQR (CV) : 16.5 (0.8)
990 distinct values 0
(0.0%)
10 Total
[numeric]
Mean (sd) : 323 (245.9)
min < med < max:
10.7 < 253.8 < 1042.7
IQR (CV) : 346.9 (0.8)
990 distinct values 0
(0.0%)
11 Date
[character]
1. 2/7/2019
2. 2/15/2019
3. 1/8/2019
4. 3/14/2019
5. 3/2/2019
6. 1/23/2019
7. 1/25/2019
8. 1/26/2019
9. 3/5/2019
10. 1/19/2019
[ 79 others ]
20 ( 2.0%)
19 ( 1.9%)
18 ( 1.8%)
18 ( 1.8%)
18 ( 1.8%)
17 ( 1.7%)
17 ( 1.7%)
17 ( 1.7%)
17 ( 1.7%)
16 ( 1.6%)
823 (82.3%)
0
(0.0%)
12 Time
[hms, difftime]
min : 36000
med : 55140
max : 75540
units : secs
506 distinct values 0
(0.0%)
13 Payment
[character]
1. Cash
2. Credit card
3. Ewallet
344 (34.4%)
311 (31.1%)
345 (34.5%)
0
(0.0%)
14 cogs
[numeric]
Mean (sd) : 307.6 (234.2)
min < med < max:
10.2 < 241.8 < 993
IQR (CV) : 330.4 (0.8)
990 distinct values 0
(0.0%)
15 gross margin percentage
[numeric]
1 distinct value 4.76!: 1000 (100.0%)
! rounded


0
(0.0%)
16 gross income
[numeric]
Mean (sd) : 15.4 (11.7)
min < med < max:
0.5 < 12.1 < 49.6
IQR (CV) : 16.5 (0.8)
990 distinct values 0
(0.0%)
17 Rating
[numeric]
Mean (sd) : 7 (1.7)
min < med < max:
4 < 7 < 10
IQR (CV) : 3 (0.2)
61 distinct values 0
(0.0%)

Statistical inference:

Gross income and City:

This plot provides a clear overview of how the distribution of gross income varies between cities. This type of visualization is valuable for identifying potential differences or patterns in income levels across different locations, aiding in the exploration of geographical variations within the dataset. We can conlcude that gross income is not significant different in cities.

Biedronki$City <- as.factor(Biedronki$City)
Biedronki$income <- as.numeric(Biedronki$`gross income`)

ggbetweenstats(
  data  = Biedronki,
  y     = income,
  x     = City,
  title = "Distribution of Gross Income  across City"
)

Rating and Customer type:

The resulting plot provides a clear overview of how the distribution of ratings varies between customer types. This type of visualization is valuable for identifying potential differences or patterns in ratings across different customer segments, aiding in the exploration of customer preferences within the dataset. we can conclude that rating is not significant different by customer type.

Biedronki$Customer <- as.factor(Biedronki$`Customer type`)
Biedronki$Rating <- as.numeric(Biedronki$Rating)

ggbetweenstats(
  data  = Biedronki,
  y     = Rating,
  x     = Customer,
  title = "Distribution of Rating across Customer Type"
)

Quantatity and Gender:

The resulting plot provides a clear overview of how the distribution of quantity varies between genders. This type of visualization is valuable for identifying potential differences or patterns in purchasing behavior across different gender groups, aiding in the exploration of gender-related variations within the dataset.Our conclusion is that Quantity, thus number of products purchased by the customer, is significant different by gender. Indeed, women buy more products on average than men.

Biedronki$Gender <- as.factor(Biedronki$Gender)
Biedronki$Quantity <- as.numeric(Biedronki$Quantity)

ggbetweenstats(
  data  = Biedronki,
  y     = Quantity,
  x     = Gender,
  title = "Distribution of quantatity across gender"
)

Unit price and Product Line:

The resulting plot provides a clear overview of how the distribution of unit prices varies across different product lines. This type of visualization is valuable for identifying potential differences or patterns in pricing strategies across product categories, aiding in the exploration of pricing dynamics within the dataset. however, we can conclude that in this case unit price of each product is not significant different by product line.

Biedronki$Line <- as.factor(Biedronki$`Product line`)
Biedronki$Unit <- as.numeric(Biedronki$`Unit price`)

ggbetweenstats(
  data  = Biedronki,
  y     = Unit,
  x     = Line,
  title = "Distribution of unit price across product line"
)

Bivariate Analysis (Correlation):

This analysis creates a correlation matrix plot for the ‘Biedronki’ dataset. It provides a visual representation of the correlation coefficients. This type of plot is valuable for quickly assessing relationships and dependencies between variables in the dataset. white squares indicate no or weak correlation, we have them mostly for “rating” and “quality”, as well as some for “income” and “unit”. With regard to the cases in which we have correlation that equals to 1, it indicates a perfect positive linear relationship between the variables. This means that as one variable increases, the other variable also increases proportionally. The variables are perfectly aligned on a straight line. As far as the cases in which correlation equals to 0.63 or 0.71, it indicates a moderately strong positive linear relationship between two variables. The positive sign suggests that as one variable increases, there is a tendency for the other variable to increase as well, but not perfectly.

ggcorrmat(
  data     = Biedronki,
  colors   = c("#B2182B", "white", "#4D4D4D"),
  title    = "Correlalogram for Biedronki dataset",
)
## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero

Final conclusion and considerations:

In conclusion, the data analysis offers insightful information that the supermarket chain can use as a guide for making strategic decisions. Important conclusions and possible tactics consist of:

Customer Demographics and Marketing:

Since most observations are made by those with lesser incomes, focused marketing methods for reasonably priced goods and promotions seem to be the best option.

Geographical Considerations:

Small differences in gross income between cities point to the possibility of marketing tactics tailored to a particular area. The greatest solutions might be tailored marketing or the launch of certain products for areas based on a regular allocation of gross income across various cities.

Gender-Specific Marketing:

Significant differences in purchasing behavior between genders highlight opportunities for gender-specific marketing campaigns. it’s crucial to keep in mind that women tend to buy more products on average, so tailor our strategy to each gender’s preferences is a must.

Pricing Strategies:

Since most customers fall into the category with the lowest total revenue, there is no significant difference in unit prices, making it difficult to maintain a consistent pricing strategy across the product line. Additionally, implementing strategic price promotions and discounts to attract price-sensitive customers, especially low-income groups, can increase sales. Of course, it’s important to analyze, monitor, and adjust your advertising strategy based on evolving customer behavior patterns.

Correlation-Based Strategies:

Try to exploit identified correlations to inform cross-selling or bundling strategies, improving customer engagement and satisfaction. The best behavior would be to consider promotions that capitalize on relationships such as the positive correlation between “rating” and “quantity.”

Market Segmentation Refinement:

From this dataset we can infer that the most profitable segment may be focused on women, but the observed total income distribution and purchasing Action. Continuing to monitor and collect data on customer behavior is essential for further segmentation and personalized marketing strategies.

Customer Engagement Programs:

Finally, developing a customer engagement program that rewards loyalty across payment methods, customer types, and product lines will lead to build loyal relationships, which helps to create a ripple effect and a positive word of mouth. For example, to improve overall customer satisfaction, encouraging repeat business through personalized offers and promotions can lead to loyalty and all the positive effects listed above.

Together, these strategies aim to increase sales, improve customer satisfaction and contribute to the overall success of “Biedronki” supermarkets. Regular analysis and adjustments based on customer behavior and market trends are essential for continued success in the competitive retail industry.