Analisis Sales dengan Budget Sales pada Data Coffee Chain

Nama : Fariska Ziadatun Ni’mah

NIM : M0725064

Kelas : D


Deskripsi Insight

Dataset Coffee Chain memuat informasi mengenai Sales (penjualan aktual) dan Budget Sales (target penjualan). Analisis ini bertujuan untuk mengetahui apakah sales mampu mencapai atau melebihi budget sales yang telah ditetapkan.

Perbandingan dilakukan melalui analisis selisih, visualisasi data, dan uji hipotesis untuk mengetahui apakah sales secara signifikan lebih besar dari budget sales.


Import Library

library(readxl)
library(ggplot2)
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

Import Data

data_c <- read_excel("C:/Users/Lenovo/Documents/semester 2/SIM/1. Tugas SIM 2025B - Coffee Chain Datasets/1. Tugas SIM 2025B - Coffee Chain Datasets.xlsx")
head(data_c)
## # A tibble: 6 × 20
##   `Area Code` Date                Market  `Market Size` Product   `Product Line`
##         <dbl> <dttm>              <chr>   <chr>         <chr>     <chr>         
## 1         719 2012-01-01 00:00:00 Central Major Market  Amaretto  Beans         
## 2         970 2012-01-01 00:00:00 Central Major Market  Colombian Beans         
## 3         970 2012-01-01 00:00:00 Central Major Market  Decaf Ir… Beans         
## 4         303 2012-01-01 00:00:00 Central Major Market  Green Tea Leaves        
## 5         303 2012-01-01 00:00:00 Central Major Market  Caffe Mo… Beans         
## 6         720 2012-01-01 00:00:00 Central Major Market  Decaf Es… Beans         
## # ℹ 14 more variables: `Product Type` <chr>, State <chr>, Type <chr>,
## #   `Budget COGS` <dbl>, `Budget Margin` <dbl>, `Budget Profit` <dbl>,
## #   `Budget Sales` <dbl>, COGS <dbl>, Inventory <dbl>, Margin <dbl>,
## #   Marketing <dbl>, Profit <dbl>, Sales <dbl>, `Total Expenses` <dbl>
summary(data_c)
##    Area Code          Date                        Market         
##  Min.   :203.0   Min.   :2012-01-01 00:00:00   Length:4248       
##  1st Qu.:417.0   1st Qu.:2012-06-23 12:00:00   Class :character  
##  Median :573.0   Median :2012-12-16 12:00:00   Mode  :character  
##  Mean   :582.3   Mean   :2012-12-15 22:00:00                     
##  3rd Qu.:772.0   3rd Qu.:2013-06-08 12:00:00                     
##  Max.   :985.0   Max.   :2013-12-01 00:00:00                     
##  Market Size          Product          Product Line       Product Type      
##  Length:4248        Length:4248        Length:4248        Length:4248       
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##     State               Type            Budget COGS     Budget Margin   
##  Length:4248        Length:4248        Min.   :  0.00   Min.   :-210.0  
##  Class :character   Class :character   1st Qu.: 30.00   1st Qu.:  50.0  
##  Mode  :character   Mode  :character   Median : 50.00   Median :  70.0  
##                                        Mean   : 74.83   Mean   : 100.8  
##                                        3rd Qu.: 90.00   3rd Qu.: 130.0  
##                                        Max.   :450.00   Max.   : 690.0  
##  Budget Profit      Budget Sales         COGS          Inventory      
##  Min.   :-320.00   Min.   :   0.0   Min.   :  0.00   Min.   :-3534.0  
##  1st Qu.:  20.00   1st Qu.:  80.0   1st Qu.: 43.00   1st Qu.:  432.0  
##  Median :  40.00   Median : 130.0   Median : 60.00   Median :  619.0  
##  Mean   :  60.91   Mean   : 175.6   Mean   : 84.43   Mean   :  749.4  
##  3rd Qu.:  80.00   3rd Qu.: 210.0   3rd Qu.:100.00   3rd Qu.:  910.5  
##  Max.   : 560.00   Max.   :1140.0   Max.   :364.00   Max.   : 8252.0  
##      Margin          Marketing          Profit           Sales    
##  Min.   :-302.00   Min.   :  0.00   Min.   :-638.0   Min.   : 17  
##  1st Qu.:  52.75   1st Qu.: 13.00   1st Qu.:  17.0   1st Qu.:100  
##  Median :  76.00   Median : 22.00   Median :  40.0   Median :138  
##  Mean   : 104.29   Mean   : 31.19   Mean   :  61.1   Mean   :193  
##  3rd Qu.: 132.00   3rd Qu.: 39.00   3rd Qu.:  92.0   3rd Qu.:230  
##  Max.   : 613.00   Max.   :156.00   Max.   : 778.0   Max.   :912  
##  Total Expenses  
##  Min.   : 10.00  
##  1st Qu.: 33.00  
##  Median : 46.00  
##  Mean   : 54.06  
##  3rd Qu.: 65.00  
##  Max.   :190.00

Variabel

p_data <- data_c %>%
  select(Sales, `Budget Sales`)
p_data
## # A tibble: 4,248 × 2
##    Sales `Budget Sales`
##    <dbl>          <dbl>
##  1   219            220
##  2   190            190
##  3   234            240
##  4   100             80
##  5   134            150
##  6   180            210
##  7   341            300
##  8   150            130
##  9   140            120
## 10   130            110
## # ℹ 4,238 more rows

Perhitungan Selisih

p_data$Selisih <- p_data$Sales - p_data$`Budget Sales`
p_data
## # A tibble: 4,248 × 3
##    Sales `Budget Sales` Selisih
##    <dbl>          <dbl>   <dbl>
##  1   219            220      -1
##  2   190            190       0
##  3   234            240      -6
##  4   100             80      20
##  5   134            150     -16
##  6   180            210     -30
##  7   341            300      41
##  8   150            130      20
##  9   140            120      20
## 10   130            110      20
## # ℹ 4,238 more rows

Visualisasi 1: Scatter Plot

ggplot(p_data, aes(x = `Budget Sales`, y = Sales)) +
  geom_point(color = "blue") +
  geom_abline(slope = 1, intercept = 0, color = "red") +
  ggtitle("Perbandingan Sales vs Budget Sales") +
  xlab("Budget Sales") +
  ylab("Sales")

Garis merah pada visualisasi menunjukkan kondisi ideal, yaitu ketika sales sama dengan budget sales. Jika titik-titik berada di atas garis tersebut, berarti sales lebih tinggi dibandingkan budget sales yang telah ditetapkan.


Visualisasi 2: Histogram Selisih

ggplot(p_data, aes(x = Selisih)) +
  geom_histogram(fill = "darkblue", bins = 30) +
  ggtitle("Distribusi Selisih Sales - Budget Sales")

Histogram ini digunakan untuk melihat distribusi selisih antara sales dan budget sales. Melalui grafik ini kita dapat mengetahui apakah sales lebih sering berada di atas atau di bawah budget sales, serta melihat penyebaran perbedaannya secara keseluruhan.


Statistik Deskriptif

mean(p_data$Selisih)
## [1] 17.33781
median(p_data$Selisih)
## [1] 16

Uji Hipotesis (One-Tailed Test)

t.test(p_data$Sales, p_data$`Budget Sales`,
       paired = TRUE,
       alternative = "greater")
## 
##  Paired t-test
## 
## data:  p_data$Sales and p_data$`Budget Sales`
## t = 25.518, df = 4247, p-value < 2.2e-16
## alternative hypothesis: true mean difference is greater than 0
## 95 percent confidence interval:
##  16.21998      Inf
## sample estimates:
## mean difference 
##        17.33781

Hasil uji hipotesis digunakan untuk mengetahui apakah sales lebih besar dari budget sales. Jika p-value < 0.05, maka sales terbukti lebih besar dari budget sales. Jika tidak, maka belum terdapat bukti bahwa budget sales telah terlampaui.


Interpretasi

Berdasarkan visualisasi scatter plot, terlihat bahwa cukup banyak titik pada sales yang berada di atas garis, yang menunjukkan bahwa banyak sales yang melebihi budget sales yang ditentukan. Namun, tidak semua budget sales tercapai, masih ada sales yang berada di bawah budget sales.

Analisis selisih pada histogram menunjukkan adanya perbedaan antara sales dan budget sales. Sebagian besar nilai berada di sisi positif yang berarti sales cenderung melebihi budget sales. Akan tetapi, penyebaran data yang cukup bervariasi menunjukkan bahwa tidak semua sales memiliki selisih yang sama terhadap budget sales.

Hasil uji paired t-test menunjukkan nilai p-value < 2.2e-16 yang jauh lebih kecil dari 0.05, dapat diartikan hipotesis nol (H₀) ditolak atau rata-rata sales terbukti lebih besar dari budget sales. Selain itu, rata-rata selisih sebesar 17.33781 dan nilai mediannya 16 juga menunjukkan bahwa sales berhasil melampaui budget sales serta distribusi data stabil.


Kesimpulan

Berdasarkan analisis, sales cenderung lebih tinggi dari budget sales dan perbedaannya terbukti signifikan secara statistik. Hal ini menunjukkan bahwa sales secara umum mampu melampaui budget sales, meskipun masih terdapat variasi dalam pencapaiannya.