Nama NIM Email RPubs
Julian Salomo 20194920003 https://rpubs.com/juliansalomo
Vanessa Supit 20194920014 https://rpubs.com/vanessasupit
Kefas Ronaldo 20194920004 https://rpubs.com/kefasronaldo
Jocelyn Irene Gani 20194920002 https://rpubs.com/irenegani

Department  : Business Statistics
Address           : ARA Center, Matana University Tower
                         Jl. CBD Barat Kav, RT.1, Curug Sangereng, Kelapa Dua, Tangerang, Banten 15810.



Setup our MySQL connection to R

Data <- dbConnect(RMySQL::MySQL(),
                 user ='root',
                 password='',
                 dbname='factory_db',
                 host='localhost',
                 port=3306)
knitr::opts_chunk$set(connection = "Data")   

Buatlah dokumen Rmd untuk melakukan analisa Database Factory yang berpusat pada data/tabel Konsumen (customer).

1 Membuat database

#dbExecute(Data, "CREATE DATABASE factory_exam")

2 Konfigurasi Database

2.1 Mengambil data tabel dari database lama

Categories

SELECT *
  FROM categories

Customers

SELECT *
  FROM customers

Employees

SELECT *
  FROM employees

Orderdetails

SELECT *
  FROM orderdetails

Orders

SELECT *
  FROM orders

Products

SELECT *
  FROM products

Suppliers

SELECT *
  FROM suppliers

Shippers

SELECT *
  FROM shippers

2.2 Mengganti koneksi database ke database baru

Data <- dbConnect(MySQL(),
                 user ='root',
                 password='',
                 dbname='factory_exam',
                 host='localhost',
                 port=3306)
knitr::opts_chunk$set(connection = "Data")   

2.3 Memasukkan data ke dalam database baru.

#dbWriteTable(Data, "Categories", Categories, append = T)
#dbWriteTable(Data, "Customers", Customers, append = T)
#dbWriteTable(Data, "Employees", Employees, append = T)
#dbWriteTable(Data, "Orderdetails", Orderdetails, append = T)
#dbWriteTable(Data, "Orders", Orders, append = T)
#dbWriteTable(Data, "Products", Products, append = T)
#dbWriteTable(Data, "Suppliers", Suppliers, append = T)
#dbWriteTable(Data, "Shippers", Shippers, append = T)
dbListTables(Data)
## [1] "categories"   "customers"    "employees"    "orderdetails" "orders"      
## [6] "products"     "shippers"     "suppliers"

3 Join tabel (yang berhubungan dengan data customer)

3.1 Daftar Informasi Customer dengan semua pesanannya.

SELECT o.OrderDate, c.CustomerID, c.CustomerName, c.ContactName, c.Address, c.Country, o.OrderID, p.ProductName, d.Quantity, p.Price, (Price*Quantity) TotalAmount
  FROM customers c
    LEFT JOIN orders o
    ON c.CustomerID=o.CustomerID
      LEFT JOIN orderdetails d
      ON o.OrderID = d.OrderID
        LEFT JOIN products p
        ON p.ProductID = d.ProductID
  ORDER BY c.CustomerID
datatable(x,
            extensions = 'FixedColumns',
            option = list(scrollX = TRUE, fixedColumns = TRUE)
          )

3.2 Total jumlah pembelian tiap customer

SELECT c.CustomerID, c.CustomerName, SUM(d.Quantity*p.Price) Total_Order
  FROM customers c
    LEFT JOIN orders o
    ON c.CustomerID=o.CustomerID
      LEFT JOIN orderdetails d
      ON o.OrderID = d.OrderID
        LEFT JOIN products p
        ON p.ProductID = d.ProductID
  GROUP BY c.CustomerID
    ORDER BY Total_Order DESC
datatable(Cust_Order,
            extensions = 'FixedColumns',
            option = list(scrollX = TRUE, fixedColumns = TRUE)
          )

3.3 Total transaksi tiap customer

SELECT c.CustomerID, c.CustomerName, COUNT(o.OrderID) Frequency
  FROM customers c
    LEFT JOIN orders o
    ON c.CustomerID=o.CustomerID
      LEFT JOIN orderdetails d
      ON o.OrderID = d.OrderID
        LEFT JOIN products p
        ON p.ProductID = d.ProductID
  GROUP BY c.CustomerID
    ORDER BY Frequency DESC
datatable(Cust_Trans,
            extensions = 'FixedColumns',
            option = list(scrollX = TRUE, fixedColumns = TRUE)
          )

3.4 Jumlah customer berdasarkan negara

SELECT Country, COUNT(CustomerID) Customer
  FROM customers
    GROUP BY Country
      ORDER BY Customer DESC
datatable(Country_Cust,
            extensions = 'FixedColumns',
            option = list(scrollX = TRUE, fixedColumns = TRUE)
          )

3.5 Total jumlah pembelian tiap negara

SELECT Country, COUNT(DISTINCT c.CustomerID) Customer, SUM(d.Quantity) Quantity, SUM(d.Quantity*p.Price) Total_Order
  FROM customers c
    LEFT JOIN orders o
    ON c.CustomerID=o.CustomerID
      LEFT JOIN orderdetails d
      ON o.OrderID = d.OrderID
        LEFT JOIN products p
        ON p.ProductID = d.ProductID
    GROUP BY Country
      ORDER BY Total_Order DESC
datatable(Country_Exp,
            extensions = 'FixedColumns',
            option = list(scrollX = TRUE, fixedColumns = TRUE)
          )

3.6 Total unit pembelian tiap negara

SELECT Country, SUM(Quantity) Quantity
  FROM customers C
    JOIN orders O
      ON C.CustomerID = O.CustomerID
      JOIN orderdetails D
        ON O.OrderID = D.OrderID
    GROUP BY Country
      ORDER BY Quantity
datatable(Country_Sales,
            extensions = 'FixedColumns',
            option = list(scrollX = TRUE, fixedColumns = TRUE)
          )

3.7 Total transaksi tiap negara

SELECT Country, COUNT(o.OrderID) Frequency
  FROM customers c
    LEFT JOIN orders o
    ON c.CustomerID=o.CustomerID
      LEFT JOIN orderdetails d
      ON o.OrderID = d.OrderID
        LEFT JOIN products p
        ON p.ProductID = d.ProductID
    GROUP BY Country
      ORDER BY Frequency DESC
datatable(Country_Trans,
            extensions = 'FixedColumns',
            option = list(scrollX = TRUE, fixedColumns = TRUE)
          )

3.8 Total unit pembelian tiap bulan (Kuantitas)

SELECT DATE_FORMAT(OrderDate, '%Y-%m') Month, SUM(Quantity) Quantity
  FROM orders O
    JOIN orderdetails D
      ON O.OrderID = D.OrderID
    GROUP BY DATE_FORMAT(OrderDate, '%Y-%m')
      ORDER BY DATE_FORMAT(OrderDate, '%Y-%m')
datatable(Month_Sales,
            extensions = 'FixedColumns',
            option = list(scrollX = TRUE, fixedColumns = TRUE)
          )

3.9 Jumlah pembelian produk dan Harganya

SELECT MAX(OrderDate) OrderDate,COUNT(DISTINCT o.OrderID) Frequency, p.ProductID, ProductName, SUM(Quantity) Quantity, Price
  FROM orders o
    JOIN orderdetails d
      ON o.OrderID = d.OrderID
      JOIN products p
        ON p.ProductID = d.ProductID
    GROUP BY p.ProductID
      ORDER BY p.ProductID
datatable(product,
            extensions = 'FixedColumns',
            option = list(scrollX = TRUE, fixedColumns = TRUE)
          )

4 Membersihkan data.

Data tidak valid yang dapat mengganggu perhitungan hanyalah NA di dalam data, sehingga proses pembersihan data yang diperlukan hanyalah pemrosesan untuk nilai yang hilang atau NA, yang dapat diselesaikan dengan na.omit()

x <- na.omit(x)

5 Analisis Statistik Deskriptif RFM

Dalam bagian ini, kita melakukan analisis RFM (Recency, Frequency, Monetary). Adapun standard yang saya gunakan untuk analisis ini adalah sebagai berikut:

  • Recency: Melakukan transaksi dalam sebulan terakhir untuk customer. Melakukan transaksi dalam seminggu terakhir untuk negara. Dibeli dalam seminggu terakhir untuk produk.
  • Frequency: Memiliki total transaksi di atas kuartil 3
  • Monetary: Memiliki jumlah total pembelian dan total unit pembelian di atas kuartil 3

5.1 Recency (R)

Tanggal order terakhir adalah

max(x$OrderDate, na.rm = TRUE)
## [1] "1997-02-12"

Customer

Maka kita akan mengambil customer yang melakukan order selama sebulan terakhir mulai 1997-01-12

Berikut nama-nama customer yang melakukan transaksi dalam sebulan terakhir

Recency_Cust <- x[,c("OrderDate", "CustomerID", "CustomerName")] %>% 
  filter(OrderDate >= "1997-01-12")  %>% 
  distinct()
Cust1<-Recency_Cust$CustomerName %>% unique()

plot1 <- Recency_Cust %>% 
  group_by(CustomerName) %>% 
  summarise(LastOrder=max(OrderDate))%>%
  ggplot() +
  aes(x = LastOrder, y = CustomerName) +
  geom_tile(size = 1.2) +
  theme_minimal()+
  theme(axis.text.x = element_text(angle = 45, hjust = 1))+
             theme(axis.title = element_text(size = 16),
                   axis.text = element_text(size = 10)
                   )
plot1

26 Nama di atas merupakan customer yang memenuhi standard recency, yaitu melakukan transaksi dalam sebulan terakhir, sehingga memiliki kemungkinan lebih besar untuk melakukan transaksi lagi.

Negara

Berikut daftar negara yang melakukan transaksi dalam seminggu terakhir mulai 1997-02-05

Recency_Country <- x[,c("OrderDate", "Country")] %>% 
  filter(OrderDate >= "1997-02-05")  %>% 
  distinct()
Country1 <- Recency_Country$Country %>% unique()
plot2 <- ggplotly(Recency_Country %>% 
  group_by(Country) %>% 
  summarise(LastOrder=max(OrderDate)) %>% 
  ggplot() +
  aes(x = LastOrder, y = Country, fill = Country) +
  geom_tile(size = 1.2) +
  scale_fill_hue(direction = 1) +
  theme_minimal()+
  theme(legend.position = "none",
        axis.text.x = element_text(angle = 45, hjust = 1))+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 12)
                   ))
plot2

7 negara di atas merupakan negara yang memenuhi standard recency, yaitu melakukan transaksi dalam seminggu terakhir, sehingga customer dari negara terkait memiliki kemungkinan lebih besar untuk melakukan transaksi lagi.

Product

Berikut daftar produk yang dibeli dalam seminggu terakhir mulai 1997-02-05

Recency_Prod <- product[,c("OrderDate", "ProductName")] %>% 
  filter(OrderDate >= "1997-02-05")  %>% 
  distinct()
Prod1 <- Recency_Prod$ProductName %>% unique()
plot3 <- ggplotly(Recency_Prod %>% 
  group_by(ProductName) %>% 
  summarise(LastOrder=max(OrderDate))%>%
  ggplot() +
  aes(x = LastOrder, y = ProductName, fill = ProductName) +
  geom_tile(size = 1.2) +
  scale_fill_hue(direction = 1) +
  theme_minimal()+
  theme(legend.position = "none",
        axis.text.x = element_text(angle = 45, hjust = 1))+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 11)
                   ))
plot3

19 produk di atas merupakan produk yang memenuhi standard recency, yaitu dibeli dalam seminggu terakhir, sehingga produk terkait memiliki kemungkinan lebih besar untuk dibeli lagi.

5.2 Frequency (F)

Customer

summary(Cust_Trans[,"Frequency"])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   2.000   4.000   5.692   8.000  35.000

Kuartil ketiga dari total transaksi customer adalah 8 kali transaksi.

Customer dengan total transaksi di atas 8 adalah

Trans_Cust <- Cust_Trans %>% 
  filter(Frequency >= 8) 
Cust2 <- Trans_Cust$CustomerName
plot4 <- ggplotly(ggplot(Trans_Cust) +
  aes(x = CustomerName, fill = Frequency, weight = Frequency) +
  geom_bar() +
  scale_fill_distiller(palette = "YlGnBu", direction = 1) +
  labs(y = "Frequency") +
  coord_flip() +
  theme_minimal()+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 10)
                   ))
plot4

26 Nama di atas merupakan customer yang memenuhi standard frequency, yaitu memiliki total transaksi di atas 8 transaksi, sehingga memiliki kemungkinan lebih besar untuk melakukan transaksi lagi.

Negara

summary(Country_Trans[,"Frequency"])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    2.00   12.00   18.00   24.67   28.00   76.00

Kuartil ketiga dari total transaksi tiap negara adalah 28 kali transaksi.

Negara dengan total transaksi di atas 28 adalah

Trans_Country <- Country_Trans %>% 
  filter(Frequency >= 28) 
Country2 <- Trans_Country$Country
plot5 <- ggplotly(ggplot(Trans_Country) +
  aes(x = Country, fill = Frequency, weight = Frequency) +
  geom_bar() +
  scale_fill_distiller(palette = "YlGnBu", direction = 1) +
  labs(y = "Frequency") +
  coord_flip() +
  theme_minimal()+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 12)
                   ))
plot5

6 Negara di atas merupakan negara yang memenuhi standard frequency, yaitu memiliki total transaksi di atas 28 transaksi, sehingga customer dari negara terkait memiliki kemungkinan lebih besar untuk melakukan transaksi lagi.

Product

summary(product[,"Frequency"])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.000   3.000   7.000   6.727   9.000  14.000

Kuartil 3 dari total transaksi tiap produk adalah 9

Produk dengan total transaksi di atas 9 adalah

Frequency_Prod <- product[,c("ProductName", "Frequency")] %>% 
  filter(Frequency >= 9) 
Prod2 <- Frequency_Prod$ProductName
plot6 <- ggplotly(ggplot(Frequency_Prod) +
  aes(x = ProductName, fill = Frequency, weight = Frequency) +
  geom_bar() +
  scale_fill_distiller(palette = "YlGnBu", direction = 1) +
  labs(y = "Frequency") +
  coord_flip() +
  theme_minimal()+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 10)
                   ))
plot6

25 produk di atas merupakan produk yang memenuhi standard Frequency, yaitu memiliki total transaksi di atas 9, sehingga produk terkait memiliki kemungkinan lebih besar untuk dibeli lagi.

5.3 Monetary (M)

Customer

x[,c("CustomerID", "CustomerName", "Quantity")] %>% 
  group_by(CustomerID) %>%
  summarise(Quantity=sum(Quantity)) %>%
  summary()
##    CustomerID       Quantity      
##  Min.   : 2.00   Min.   :   2.00  
##  1st Qu.:23.25   1st Qu.:  45.75  
##  Median :47.50   Median :  97.50  
##  Mean   :46.74   Mean   : 172.20  
##  3rd Qu.:69.75   3rd Qu.: 189.75  
##  Max.   :91.00   Max.   :1418.00

Kuartil ketiga dari total unit pembelian customer adalah 189.75 unit. Kita akan menggunakan nilai 190 karena unit pembelian harus integer.

Customer dengan total unit pembelian di atas 190 adalah

Freq_Cust <- x[,c("CustomerName", "Quantity")] %>% 
  group_by(CustomerName) %>%
  summarise(Quantity=sum(Quantity)) %>% 
  filter(Quantity >= 190) 
Cust3 <- Freq_Cust$CustomerName
plot7 <- ggplotly(ggplot(Freq_Cust) +
  aes(x = CustomerName, fill = Quantity, weight = Quantity) +
  geom_bar() +
  scale_fill_distiller(palette = "YlGnBu", direction = 1) +
  labs(y = "Frequency") +
  coord_flip() +
  theme_minimal()+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 12)
                   ))
plot7

19 Nama di atas merupakan customer yang memenuhi standard Monetary, yaitu memiliki total unit pembelian di atas 190 unit, sehingga memiliki kemungkinan lebih besar untuk melakukan transaksi lagi.

Cust_Order$Total_Order %>% summary()
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max.     NA's 
##    62.46   950.14  2381.50  5221.95  5756.10 35631.21       17

Kuartil ketiga dari total jumlah pembelian customer adalah 5756.10

Customer dengan total jumlah pembelian di atas $ 5756.10 adalah

Order_Cust <- Cust_Order %>% 
  filter(Total_Order >= 5756.10) 
Cust4 <-Order_Cust$CustomerName
plot8 <- ggplotly(ggplot(Order_Cust) +
  aes(x = CustomerName, fill = Total_Order, weight = Total_Order) +
  geom_bar() +
  scale_fill_distiller(palette = "YlGnBu", direction = 1) +
  labs(y = "Total Order ($)") +
  coord_flip() +
  theme_minimal()+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 12)
                   ))
plot8

19 Nama di atas merupakan customer yang memenuhi standard Monetary, yaitu memiliki total jumlah pembelian di atas 5756.10, sehingga memiliki kemungkinan lebih besar untuk melakukan transaksi lagi.

Negara

summary(Country_Sales[,"Quantity"])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    24.0   221.0   355.0   606.8   772.0  2139.0

Kuartil ketiga dari total unit pembelian negara adalah 772 unit.

Negara dengan total unit pembelian di atas 772 adalah

Sales_Country <- Country_Sales %>% 
  filter(Quantity >= 772)  
Country3 <- Sales_Country$Country 
plot9 <- ggplotly(ggplot(Sales_Country) +
  aes(x = Country, fill = Quantity, weight = Quantity) +
  geom_bar() +
  scale_fill_distiller(palette = "YlGnBu", direction = 1) +
  labs(y = "Quantity") +
  coord_flip() +
  theme_minimal()+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 12)
                   ))
plot9

6 Negara di atas merupakan negara yang memenuhi standard Monetary, yaitu memiliki total unit pembelian di atas 772 unit, sehingga memiliki kemungkinan lebih besar untuk melakukan transaksi lagi.

Country_Exp$Total_Order %>% summary()
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     399    4329    9721   18401   29549   69612

Kuartil ketiga dari total jumlah pembelian negara adalah 29549

Negara dengan total jumlah pembelian di atas $ 29549 adalah

Exp_Country <- Country_Exp %>% 
  filter(Total_Order >= 29549)  
Country4 <- Exp_Country$Country

plot10 <- ggplotly(ggplot(Exp_Country) +
  aes(x = Country, fill = Total_Order, weight = Total_Order) +
  geom_bar() +
  scale_fill_distiller(palette = "YlGnBu", direction = 1) +
  labs(y = "Total Order ($)") +
  coord_flip() +
  theme_minimal()+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 12)
                   ))
plot10

6 Negara di atas merupakan negara yang memenuhi standard Monetary, yaitu memiliki total jumlah pembelian di atas 29549, sehingga memiliki kemungkinan lebih besar untuk melakukan transaksi lagi.

Product

summary(product[,"Quantity"])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     5.0    90.0   159.0   165.5   209.0   458.0

Kuartil 3 dari total transaksi tiap produk adalah 209

Produk dengan total transaksi di atas 209 adalah

Monetary_Prod <- product[,c("ProductName", "Quantity")] %>% 
  filter(Quantity >= 209)  
Prod3 <- Monetary_Prod$ProductName 
plot11 <- ggplotly(ggplot(Monetary_Prod) +
  aes(x = ProductName, fill = Quantity, weight = Quantity) +
  geom_bar() +
  scale_fill_distiller(palette = "YlGnBu", direction = 1) +
  labs(y = "Quantity") +
  coord_flip() +
  theme_minimal()+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 12)
                   ))
plot11

20 produk di atas merupakan produk yang memenuhi standard Monetary, yaitu memiliki total unit pembelian di atas 209, sehingga produk terkait memiliki kemungkinan lebih besar untuk dibeli lagi.

5.4 RFM

Selanjutnya kita akan menggabungkan seluruh hasil analisis kita.

Customer

Cust_RFM <- c(Cust1, Cust2, Cust3, Cust4) %>% unique()
data.frame(Customer=Cust_RFM)
##                        Customer
## 1          Blondel père et fils
## 2        Bottom-Dollar Marketse
## 3         Consolidated Holdings
## 4                  Ernst Handel
## 5            Familia Arquibaldo
## 6                Folk och fä HB
## 7                Franchi S.p.A.
## 8        Galería del gastrónomo
## 9           Gourmet Lanchonetes
## 10   Hungry Coyote Import Store
## 11 Hungry Owl All-Night Grocers
## 12             La maison d'Asie
## 13               Mère Paillarde
## 14       Old World Delicatessen
## 15             Piccolo und mehr
## 16      Princesa Isabel Vinhoss
## 17                  Que Delícia
## 18                   QUICK-Stop
## 19           Reggiani Caseifici
## 20           Richter Supermarkt
## 21           Save-a-lot Markets
## 22                Simons bistro
## 23        Split Rail Beer & Ale
## 24           Toms Spezialitäten
## 25               Wartian Herkku
## 26       Wellington Importadora
## 27   Rattlesnake Canyon Grocery
## 28               Frankenversand
## 29            LILA-Supermercado
## 30          Tortuga Restaurante
## 31            Die Wandernde Kuh
## 32                Queen Cozinha
## 33           Berglunds snabbköp
## 34          Lehmanns Marktstand
## 35              Königlich Essen
## 36                 Vaffeljernet
## 37             Romero y tomillo
## 38           Seven Seas Imports
## 39             Suprêmes délices

39 Customer di atas merupakan customer yang kemungkinan besar akan melakukan transaksi lagi menurut analisis RFM.

Negara

Country_RFM <- c(Country1, Country2, Country3, Country4) %>% unique()
data.frame(Country=Country_RFM)
##   Country
## 1  France
## 2 Austria
## 3  Canada
## 4     USA
## 5   Italy
## 6 Germany
## 7 Finland
## 8  Brazil
## 9      UK

9 Negara di atas merupakan negara yang kemungkinan besar akan melakukan transaksi lagi menurut analisis RFM.

Product

Prod_RFM <- c(Prod1, Prod2, Prod3) %>% unique()
data.frame(Product= Prod_RFM)
##                             Product
## 1                             Chang
## 2                    Queso Cabrales
## 3         Queso Manchego La Pastora
## 4                           Pavlova
## 5        Teatime Chocolate Biscuits
## 6                Schoggi Schokolade
## 7                 Rössle Sauerkraut
## 8           Thüringer Rostbratwurst
## 9                     Sasquatch Ale
## 10                        Spegesild
## 11                    Perth Pasties
## 12                        Tourtière
## 13           Gnocchi di nonna Alice
## 14                   Ravioli Angelo
## 15                   Sirop d'érable
## 16        Wimmers gute Semmelknödel
## 17        Louisiana Hot Spiced Okra
## 18                    Longlife Tofu
## 19             Rhönbräu Klosterbier
## 20                     Alice Mutton
## 21               Guaraná Fantástica
## 22                Gorgonzola Telino
## 23                          Geitost
## 24                   Steeleye Stout
## 25                      Inlagd Sill
## 26  Jack's New England Clam Chowder
## 27             Raclette Courdavault
## 28                Camembert Pierrot
## 29                   Tarte au sucre
## 30 Louisiana Fiery Hot Pepper Sauce
## 31              Scottish Longbreads
## 32                 Gudbrandsdalsost
## 33                      Fløtemysost
## 34           Mozzarella di Giovanni
## 35                     Lakkalikööri
## 36              Gumbär Gummibärchen
## 37                    Côte de Blaye
## 38                 Chartreuse verte
## 39                 Boston Crab Meat
## 40                     Pâté chinois
## 41                     Vegie-spread

41 Produk di atas merupakan produk yang kemungkinan besar akan dibeli lagi menurut analisis RFM.

6 Statistik Inferensial (Regresi dan Klasifikasi)

Pengaruh kuantitas pembelian terhadap total pengeluaran per negara.

cor1 <- ggplotly(ggplot(Country_Exp, aes(x = Quantity, y = Total_Order)) +
                   geom_point()+
             geom_smooth(se = FALSE, method = 'lm') +
             labs(x = 'Kuantitas pemesanan (unit)', y = 'Total jumlah pemesanan $') +
             theme_light()+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 12)
                   )
         )
cor1

Pengaruh harga produk terhadap kuantitas pemesanan

cor2 <- ggplotly(ggplot(product, aes(x = Price, y = Quantity)) +
  geom_point() +
  labs(x = 'Harga Produk $', y = 'Kuantitas pemesanan (unit)') +
  theme_light()+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 12)
                   )
     )
cor2

Pengaruh jumlah customer dengan kuantitas pembelian per negara.

cor3 <- ggplotly(ggplot(Country_Exp, aes(x = Customer, y = Quantity)) +
  geom_point()+
  geom_smooth(se = FALSE, method = 'lm') +
  labs(x = 'Jumlah Customer', y = 'Kuantitas pemesanan (unit)') +
  theme_light()+
             theme(axis.title = element_text(size = 18),
                   axis.text = element_text(size = 12)
                   ))
cor3

6.1 Estimasi Regresi Linier

Pengaruh kuantitas pembelian terhadap total pengeluaran per negara.

lm1 <- lm(Total_Order~Quantity, data = Country_Exp)
summary(lm1)
## 
## Call:
## lm(formula = Total_Order ~ Quantity, data = Country_Exp)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -13682.2  -1761.9   -862.5   2626.7   7937.0 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   77.425   1504.170   0.051    0.959    
## Quantity      30.197      1.754  17.218 4.76e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 4871 on 19 degrees of freedom
## Multiple R-squared:  0.9398, Adjusted R-squared:  0.9366 
## F-statistic: 296.5 on 1 and 19 DF,  p-value: 4.756e-13

p-value dari model linier di atas lebih kecil dari 0.05 (tingkat kesalahan 5%), yang membuktikan bahwa terdapat hubungan linier antara Kuantitas dan jumlah total pemesanan. Model liniernya adalah sebagai berikut: \[TotalOrder=77.425+30.197\times Quantity\]

Pengaruh harga produk terhadap kuantitas pemesanan

lm2 <- lm(Quantity~Price, data = product)
summary(lm2)
## 
## Call:
## lm(formula = Quantity ~ Price, data = product)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -160.061  -72.956   -7.155   37.006  296.006 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 159.3218    15.4485  10.313 4.95e-16 ***
## Price         0.2138     0.3488   0.613    0.542    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 102.8 on 75 degrees of freedom
## Multiple R-squared:  0.004985,   Adjusted R-squared:  -0.008282 
## F-statistic: 0.3758 on 1 and 75 DF,  p-value: 0.5417

p-value dari model linier di atas lebih besar dari 0.05 (tingkat kesalahan 5%), yang membuktikan bahwa tidak terdapat hubungan linier antara Harga produk dan Kuantitas produk terjual.

Pengaruh jumlah customer dengan kuantitas pembelian per negara.

lm3 <- lm(Quantity~Customer, data = Country_Exp)
summary(lm3)
## 
## Call:
## lm(formula = Quantity ~ Customer, data = Country_Exp)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -555.08 -218.35  -75.90   85.24 1251.24 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    62.58     145.66   0.430 0.672282    
## Customer      125.59      25.88   4.852 0.000111 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 425.8 on 19 degrees of freedom
## Multiple R-squared:  0.5534, Adjusted R-squared:  0.5299 
## F-statistic: 23.54 on 1 and 19 DF,  p-value: 0.0001107

p-value dari model linier di atas lebih kecil dari 0.05 (tingkat kesalahan 5%), yang membuktikan bahwa terdapat hubungan linier antara Kuantitas dan jumlah customer. Model liniernya adalah sebagai berikut: \[Quantity=62.28+125.59\times Customer\]

7 Saran dan Kesimpulan

Dari RFM customer kita dapat menyimpulkan bahwa kita memiliki best customer yaiu

  • Blondel pere et fils
  • Bottom-Dollar Marketse
  • Ernst Handel
  • Hungry Owl all-night Grocers
  • Mere Paillorde
  • Old world delcatessen
  • QUICK-Stop
  • Save a-lot market
  • Wartian Herkku

Customer diatas adalah customer yang melakukan order dalam sebulan terakhir, frekuensi order yang tergolong banyak dan melakukan order terhadap product yang mahal atau high-priced products. saran strategi untuk mempertahankan best customer adalah dengan memberikan rewards, membangun kepercayaan dan juga mempromosikan product baru kepada best customer.

selain best customer diatas, adapun yang dapat kita sebut sebagai customer yang setia dimana customer ini mungkin tidak melakukan order dalam 1 bulan terakhir namun customer memiliki frekuensi order yang tergolong tinggi dan product yang diorder termasuk high-priced product. berikut adalah nama-nama customernya :

  • Queen Cozinha
  • Rattle snake cayan grocery
  • seven seas import
  • LILA-Supermercado
  • Frankeversand
  • vaffeljernet
  • Die wandeunde Kuh
  • Mere Pallarde

strategi yang dapat dilakukan oleh perusahaan adalah mendapatkan feedback lalu melakukan survey kenapa dalam 1 bulan ini belum melakukan order setelah itu melakukan upsell producst atau teknik dimana penjual mengundang customer melakukan pembelian terhadap high-priced product dengan memberikan bonus.

Adapun customer yang memiliki potensi menjadi customer tetap dimana customer ini frekuensi order rendah namun mempunyai order dalam dan membeli high-priced products. berikut nama customer yang tergolong :

  • Split-rail beer & Ale
  • Simons Birto
  • Richter supermarkets
  • Piccolo und mehr

Strategi yang dapat dilakukan terhadap customer diatas adalah dengan menawarkan loyalty program atau menawarkan membership secara khusus agar mereka merasa special customer.

Terdapat customer yang perlu diperhatikan meskipun jarang melakukan order namun customer tersebut melakukan purhase terhadap high-priced product dalam kuantitas yang banyak. customer tersebut adalah supreme delices , perusahaan memiliki potensi kehilangan customer seperti ini, strategi yang dpat dilakukan adalah menghubungi customer untuk memperkenalkan penawaran products terbaru atau combo products.

adapaun customer yang sering melakukan order dan dalam kuantitas yang banyak namun products yang diorder adalah bukan high-priced products. berikut adalah nama customer tersebut :

  • Familia Arquibaldo
  • Folk och fa HB
  • La maison d’Asie
  • Romero y tommillo
  • lehmans markstand
  • la maisan d’Asie
  • Koniglich Essen

strategi yang dapat dilakukan perusahaan adalah memberikan free trial terhadap high-priced products agar customer memiliki rasa penasaran terhadap products tersebut, bisa juga dengan menawarkan store credit atau yang lebih dikenal dengan voucher refund.

untuk negara yang memiliki frekuensi order rendah namun kuantitas dan total pembeliannya tergolong tinggi, terdapat kemungkinan bahwa negara tersebut terhalang dengan ongkos kirim yang tinggi, perusahaan harus mempertimbangkan untuk memberikan semacam bantuan ongkos kirim agar negara tersebut melakukan lebih banyak order terhadap product.