Modul 5 ini membahas penerapan metode Structural Equation Modeling – Partial Least Squares (SEM-PLS) untuk menganalisis hubungan antar variabel perilaku pelanggan berdasarkan dataset Customer Personality Analysis. Analisis dilakukan untuk mengetahui hubungan antara spending behavior, purchase activity, customer engagement, dan customer loyalty dalam aktivitas pembelian pelanggan.
Dataset yang digunakan berasal dari Kaggle dengan jumlah 2240 observasi dan 29 variabel yang berkaitan dengan karakteristik pelanggan, aktivitas pembelian, serta respons terhadap kampanye pemasaran. Tahapan analisis meliputi eksplorasi data, preprocessing data, pembentukan inner dan outer model, evaluasi SEM-PLS, serta visualisasi hasil analisis.
library(plspm)
## Warning: package 'plspm' was built under R version 4.5.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.5.3
##
## 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
library(psych)
## Warning: package 'psych' was built under R version 4.5.3
##
## Attaching package: 'psych'
## The following objects are masked from 'package:plspm':
##
## alpha, rescale, unidim
library(corrplot)
## corrplot 0.95 loaded
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.5.3
##
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
##
## %+%, alpha
## The following object is masked from 'package:plspm':
##
## alpha
data <- read.csv(
"marketing_campaign.csv",
sep = ";"
)
Menampilkan Data
head(data)
## ID Year_Birth Education Marital_Status Income Kidhome Teenhome Dt_Customer
## 1 5524 1957 Graduation Single 58138 0 0 04/09/2012
## 2 2174 1954 Graduation Single 46344 1 1 08/03/2014
## 3 4141 1965 Graduation Together 71613 0 0 21/08/2013
## 4 6182 1984 Graduation Together 26646 1 0 10/02/2014
## 5 5324 1981 PhD Married 58293 1 0 19/01/2014
## 6 7446 1967 Master Together 62513 0 1 09/09/2013
## Recency MntWines MntFruits MntMeatProducts MntFishProducts MntSweetProducts
## 1 58 635 88 546 172 88
## 2 38 11 1 6 2 1
## 3 26 426 49 127 111 21
## 4 26 11 4 20 10 3
## 5 94 173 43 118 46 27
## 6 16 520 42 98 0 42
## MntGoldProds NumDealsPurchases NumWebPurchases NumCatalogPurchases
## 1 88 3 8 10
## 2 6 2 1 1
## 3 42 1 8 2
## 4 5 2 2 0
## 5 15 5 5 3
## 6 14 2 6 4
## NumStorePurchases NumWebVisitsMonth AcceptedCmp3 AcceptedCmp4 AcceptedCmp5
## 1 4 7 0 0 0
## 2 2 5 0 0 0
## 3 10 4 0 0 0
## 4 4 6 0 0 0
## 5 6 5 0 0 0
## 6 10 6 0 0 0
## AcceptedCmp1 AcceptedCmp2 Complain Z_CostContact Z_Revenue Response
## 1 0 0 0 3 11 1
## 2 0 0 0 3 11 0
## 3 0 0 0 3 11 0
## 4 0 0 0 3 11 0
## 5 0 0 0 3 11 0
## 6 0 0 0 3 11 0
Struktur Data
str(data)
## 'data.frame': 2240 obs. of 29 variables:
## $ ID : int 5524 2174 4141 6182 5324 7446 965 6177 4855 5899 ...
## $ Year_Birth : int 1957 1954 1965 1984 1981 1967 1971 1985 1974 1950 ...
## $ Education : chr "Graduation" "Graduation" "Graduation" "Graduation" ...
## $ Marital_Status : chr "Single" "Single" "Together" "Together" ...
## $ Income : int 58138 46344 71613 26646 58293 62513 55635 33454 30351 5648 ...
## $ Kidhome : int 0 1 0 1 1 0 0 1 1 1 ...
## $ Teenhome : int 0 1 0 0 0 1 1 0 0 1 ...
## $ Dt_Customer : chr "04/09/2012" "08/03/2014" "21/08/2013" "10/02/2014" ...
## $ Recency : int 58 38 26 26 94 16 34 32 19 68 ...
## $ MntWines : int 635 11 426 11 173 520 235 76 14 28 ...
## $ MntFruits : int 88 1 49 4 43 42 65 10 0 0 ...
## $ MntMeatProducts : int 546 6 127 20 118 98 164 56 24 6 ...
## $ MntFishProducts : int 172 2 111 10 46 0 50 3 3 1 ...
## $ MntSweetProducts : int 88 1 21 3 27 42 49 1 3 1 ...
## $ MntGoldProds : int 88 6 42 5 15 14 27 23 2 13 ...
## $ NumDealsPurchases : int 3 2 1 2 5 2 4 2 1 1 ...
## $ NumWebPurchases : int 8 1 8 2 5 6 7 4 3 1 ...
## $ NumCatalogPurchases: int 10 1 2 0 3 4 3 0 0 0 ...
## $ NumStorePurchases : int 4 2 10 4 6 10 7 4 2 0 ...
## $ NumWebVisitsMonth : int 7 5 4 6 5 6 6 8 9 20 ...
## $ AcceptedCmp3 : int 0 0 0 0 0 0 0 0 0 1 ...
## $ AcceptedCmp4 : int 0 0 0 0 0 0 0 0 0 0 ...
## $ AcceptedCmp5 : int 0 0 0 0 0 0 0 0 0 0 ...
## $ AcceptedCmp1 : int 0 0 0 0 0 0 0 0 0 0 ...
## $ AcceptedCmp2 : int 0 0 0 0 0 0 0 0 0 0 ...
## $ Complain : int 0 0 0 0 0 0 0 0 0 0 ...
## $ Z_CostContact : int 3 3 3 3 3 3 3 3 3 3 ...
## $ Z_Revenue : int 11 11 11 11 11 11 11 11 11 11 ...
## $ Response : int 1 0 0 0 0 0 0 0 1 0 ...
Dimensi Data
dim(data)
## [1] 2240 29
Nama Variabel
colnames(data)
## [1] "ID" "Year_Birth" "Education"
## [4] "Marital_Status" "Income" "Kidhome"
## [7] "Teenhome" "Dt_Customer" "Recency"
## [10] "MntWines" "MntFruits" "MntMeatProducts"
## [13] "MntFishProducts" "MntSweetProducts" "MntGoldProds"
## [16] "NumDealsPurchases" "NumWebPurchases" "NumCatalogPurchases"
## [19] "NumStorePurchases" "NumWebVisitsMonth" "AcceptedCmp3"
## [22] "AcceptedCmp4" "AcceptedCmp5" "AcceptedCmp1"
## [25] "AcceptedCmp2" "Complain" "Z_CostContact"
## [28] "Z_Revenue" "Response"
Statistik deskriptif
summary(data)
## ID Year_Birth Education Marital_Status
## Min. : 0 Min. :1893 Length:2240 Length:2240
## 1st Qu.: 2828 1st Qu.:1959 Class :character Class :character
## Median : 5458 Median :1970 Mode :character Mode :character
## Mean : 5592 Mean :1969
## 3rd Qu.: 8428 3rd Qu.:1977
## Max. :11191 Max. :1996
##
## Income Kidhome Teenhome Dt_Customer
## Min. : 1730 Min. :0.0000 Min. :0.0000 Length:2240
## 1st Qu.: 35303 1st Qu.:0.0000 1st Qu.:0.0000 Class :character
## Median : 51382 Median :0.0000 Median :0.0000 Mode :character
## Mean : 52247 Mean :0.4442 Mean :0.5062
## 3rd Qu.: 68522 3rd Qu.:1.0000 3rd Qu.:1.0000
## Max. :666666 Max. :2.0000 Max. :2.0000
## NA's :24
## Recency MntWines MntFruits MntMeatProducts
## Min. : 0.00 Min. : 0.00 Min. : 0.0 Min. : 0.0
## 1st Qu.:24.00 1st Qu.: 23.75 1st Qu.: 1.0 1st Qu.: 16.0
## Median :49.00 Median : 173.50 Median : 8.0 Median : 67.0
## Mean :49.11 Mean : 303.94 Mean : 26.3 Mean : 166.9
## 3rd Qu.:74.00 3rd Qu.: 504.25 3rd Qu.: 33.0 3rd Qu.: 232.0
## Max. :99.00 Max. :1493.00 Max. :199.0 Max. :1725.0
##
## MntFishProducts MntSweetProducts MntGoldProds NumDealsPurchases
## Min. : 0.00 Min. : 0.00 Min. : 0.00 Min. : 0.000
## 1st Qu.: 3.00 1st Qu.: 1.00 1st Qu.: 9.00 1st Qu.: 1.000
## Median : 12.00 Median : 8.00 Median : 24.00 Median : 2.000
## Mean : 37.53 Mean : 27.06 Mean : 44.02 Mean : 2.325
## 3rd Qu.: 50.00 3rd Qu.: 33.00 3rd Qu.: 56.00 3rd Qu.: 3.000
## Max. :259.00 Max. :263.00 Max. :362.00 Max. :15.000
##
## NumWebPurchases NumCatalogPurchases NumStorePurchases NumWebVisitsMonth
## Min. : 0.000 Min. : 0.000 Min. : 0.00 Min. : 0.000
## 1st Qu.: 2.000 1st Qu.: 0.000 1st Qu.: 3.00 1st Qu.: 3.000
## Median : 4.000 Median : 2.000 Median : 5.00 Median : 6.000
## Mean : 4.085 Mean : 2.662 Mean : 5.79 Mean : 5.317
## 3rd Qu.: 6.000 3rd Qu.: 4.000 3rd Qu.: 8.00 3rd Qu.: 7.000
## Max. :27.000 Max. :28.000 Max. :13.00 Max. :20.000
##
## AcceptedCmp3 AcceptedCmp4 AcceptedCmp5 AcceptedCmp1
## Min. :0.00000 Min. :0.00000 Min. :0.00000 Min. :0.00000
## 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000
## Median :0.00000 Median :0.00000 Median :0.00000 Median :0.00000
## Mean :0.07277 Mean :0.07455 Mean :0.07277 Mean :0.06429
## 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000
## Max. :1.00000 Max. :1.00000 Max. :1.00000 Max. :1.00000
##
## AcceptedCmp2 Complain Z_CostContact Z_Revenue
## Min. :0.00000 Min. :0.000000 Min. :3 Min. :11
## 1st Qu.:0.00000 1st Qu.:0.000000 1st Qu.:3 1st Qu.:11
## Median :0.00000 Median :0.000000 Median :3 Median :11
## Mean :0.01339 Mean :0.009375 Mean :3 Mean :11
## 3rd Qu.:0.00000 3rd Qu.:0.000000 3rd Qu.:3 3rd Qu.:11
## Max. :1.00000 Max. :1.000000 Max. :3 Max. :11
##
## Response
## Min. :0.0000
## 1st Qu.:0.0000
## Median :0.0000
## Mean :0.1491
## 3rd Qu.:0.0000
## Max. :1.0000
##
# Mengecek missing value
colSums(is.na(data))
## ID Year_Birth Education Marital_Status
## 0 0 0 0
## Income Kidhome Teenhome Dt_Customer
## 24 0 0 0
## Recency MntWines MntFruits MntMeatProducts
## 0 0 0 0
## MntFishProducts MntSweetProducts MntGoldProds NumDealsPurchases
## 0 0 0 0
## NumWebPurchases NumCatalogPurchases NumStorePurchases NumWebVisitsMonth
## 0 0 0 0
## AcceptedCmp3 AcceptedCmp4 AcceptedCmp5 AcceptedCmp1
## 0 0 0 0
## AcceptedCmp2 Complain Z_CostContact Z_Revenue
## 0 0 0 0
## Response
## 0
# Menghapus missing value
data <- na.omit(data)
# Mengecek kembali missing value
colSums(is.na(data))
## ID Year_Birth Education Marital_Status
## 0 0 0 0
## Income Kidhome Teenhome Dt_Customer
## 0 0 0 0
## Recency MntWines MntFruits MntMeatProducts
## 0 0 0 0
## MntFishProducts MntSweetProducts MntGoldProds NumDealsPurchases
## 0 0 0 0
## NumWebPurchases NumCatalogPurchases NumStorePurchases NumWebVisitsMonth
## 0 0 0 0
## AcceptedCmp3 AcceptedCmp4 AcceptedCmp5 AcceptedCmp1
## 0 0 0 0
## AcceptedCmp2 Complain Z_CostContact Z_Revenue
## 0 0 0 0
## Response
## 0
pls_data <- data %>%
select(
# Spending Behavior
MntWines,
MntMeatProducts,
MntFishProducts,
MntSweetProducts,
# Purchase Activity
NumWebPurchases,
NumCatalogPurchases,
NumStorePurchases,
# Customer Engagement
NumWebVisitsMonth,
Response,
# Customer Loyalty
Recency,
Complain
)
# Menampilkan data
head(pls_data)
## MntWines MntMeatProducts MntFishProducts MntSweetProducts NumWebPurchases
## 1 635 546 172 88 8
## 2 11 6 2 1 1
## 3 426 127 111 21 8
## 4 11 20 10 3 2
## 5 173 118 46 27 5
## 6 520 98 0 42 6
## NumCatalogPurchases NumStorePurchases NumWebVisitsMonth Response Recency
## 1 10 4 7 1 58
## 2 1 2 5 0 38
## 3 2 10 4 0 26
## 4 0 4 6 0 26
## 5 3 6 5 0 94
## 6 4 10 6 0 16
## Complain
## 1 0
## 2 0
## 3 0
## 4 0
## 5 0
## 6 0
describe(pls_data)
## vars n mean sd median trimmed mad min max
## MntWines 1 2216 305.09 337.33 174.5 250.28 245.37 0 1493
## MntMeatProducts 2 2216 167.00 224.28 68.0 119.82 88.96 0 1725
## MntFishProducts 3 2216 37.64 54.75 12.0 25.20 17.79 0 259
## MntSweetProducts 4 2216 27.03 41.07 8.0 17.39 11.86 0 262
## NumWebPurchases 5 2216 4.09 2.74 4.0 3.82 2.97 0 27
## NumCatalogPurchases 6 2216 2.67 2.93 2.0 2.22 2.97 0 28
## NumStorePurchases 7 2216 5.80 3.25 5.0 5.49 2.97 0 13
## NumWebVisitsMonth 8 2216 5.32 2.43 6.0 5.40 2.97 0 20
## Response 9 2216 0.15 0.36 0.0 0.06 0.00 0 1
## Recency 10 2216 49.01 28.95 49.0 48.99 37.06 0 99
## Complain 11 2216 0.01 0.10 0.0 0.00 0.00 0 1
## range skew kurtosis se
## MntWines 1493 1.17 0.58 7.17
## MntMeatProducts 1725 2.02 5.03 4.76
## MntFishProducts 259 1.91 3.06 1.16
## MntSweetProducts 262 2.10 4.09 0.87
## NumWebPurchases 27 1.20 4.05 0.06
## NumCatalogPurchases 28 1.88 8.04 0.06
## NumStorePurchases 13 0.70 -0.63 0.07
## NumWebVisitsMonth 20 0.22 1.84 0.05
## Response 1 1.96 1.83 0.01
## Recency 99 0.00 -1.20 0.61
## Complain 1 10.12 100.44 0.00
cor_matrix <- cor(pls_data)
cor_matrix
## MntWines MntMeatProducts MntFishProducts
## MntWines 1.00000000 0.56886000 0.3977210502
## MntMeatProducts 0.56886000 1.00000000 0.5735740153
## MntFishProducts 0.39772105 0.57357402 1.0000000000
## MntSweetProducts 0.39032580 0.53513611 0.5838669550
## NumWebPurchases 0.55378594 0.30709037 0.2996875104
## NumCatalogPurchases 0.63475274 0.73412660 0.5327567837
## NumStorePurchases 0.64001191 0.48600555 0.4577450432
## NumWebVisitsMonth -0.32197790 -0.53948442 -0.4464232918
## Response 0.24629896 0.23774642 0.1081451099
## Recency 0.01572102 0.02251764 0.0005509232
## Complain -0.03947021 -0.02378194 -0.0212202304
## MntSweetProducts NumWebPurchases NumCatalogPurchases
## MntWines 0.39032580 0.553785939 0.63475274
## MntMeatProducts 0.53513611 0.307090366 0.73412660
## MntFishProducts 0.58386696 0.299687510 0.53275678
## MntSweetProducts 1.00000000 0.333937217 0.49513582
## NumWebPurchases 0.33393722 1.000000000 0.38686764
## NumCatalogPurchases 0.49513582 0.386867640 1.00000000
## NumStorePurchases 0.45522516 0.516240183 0.51784045
## NumWebVisitsMonth -0.42237080 -0.051226263 -0.52200377
## Response 0.11617037 0.151431233 0.21991361
## Recency 0.02510977 -0.005640854 0.02408141
## Complain -0.02264120 -0.016641779 -0.02083919
## NumStorePurchases NumWebVisitsMonth Response
## MntWines 0.6400119079 -0.321977901 0.246298957
## MntMeatProducts 0.4860055453 -0.539484417 0.237746418
## MntFishProducts 0.4577450432 -0.446423292 0.108145110
## MntSweetProducts 0.4552251636 -0.422370804 0.116170373
## NumWebPurchases 0.5162401827 -0.051226263 0.151431233
## NumCatalogPurchases 0.5178404511 -0.522003774 0.219913612
## NumStorePurchases 1.0000000000 -0.432398257 0.036241129
## NumWebVisitsMonth -0.4323982573 1.000000000 -0.002208954
## Response 0.0362411292 -0.002208954 1.000000000
## Recency -0.0004338266 -0.018563643 -0.199766369
## Complain -0.0169407070 0.019785006 -0.002029294
## Recency Complain
## MntWines 0.0157210194 -0.039470211
## MntMeatProducts 0.0225176351 -0.023781944
## MntFishProducts 0.0005509232 -0.021220230
## MntSweetProducts 0.0251097703 -0.022641200
## NumWebPurchases -0.0056408538 -0.016641779
## NumCatalogPurchases 0.0240814076 -0.020839191
## NumStorePurchases -0.0004338266 -0.016940707
## NumWebVisitsMonth -0.0185636434 0.019785006
## Response -0.1997663693 -0.002029294
## Recency 1.0000000000 0.013636670
## Complain 0.0136366703 1.000000000
corrplot(
cor_matrix,
method = "color",
type = "upper",
tl.col = "black",
tl.srt = 45
)
# Histogram Spending Behavior
ggplot(pls_data, aes(x = MntWines)) +
geom_histogram(
bins = 20,
fill = "skyblue",
color = "black"
) +
labs(
title = "Distribusi Pembelian Wine",
x = "MntWines",
y = "Frekuensi"
)
inner_model <- matrix(c(
0, 0, 0, 0,
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0
), nrow = 4, byrow = TRUE)
# Nama konstruk
colnames(inner_model) <- rownames(inner_model) <- c(
"Spending_Behavior",
"Purchase_Activity",
"Customer_Engagement",
"Customer_Loyalty"
)
# Menampilkan inner model
inner_model
## Spending_Behavior Purchase_Activity Customer_Engagement
## Spending_Behavior 0 0 0
## Purchase_Activity 1 0 0
## Customer_Engagement 0 1 0
## Customer_Loyalty 0 0 1
## Customer_Loyalty
## Spending_Behavior 0
## Purchase_Activity 0
## Customer_Engagement 0
## Customer_Loyalty 0
outer_model <- list(
c(
"MntWines",
"MntMeatProducts",
"MntFishProducts",
"MntSweetProducts"
),
c(
"NumWebPurchases",
"NumCatalogPurchases",
"NumStorePurchases"
),
c(
"NumWebVisitsMonth",
"Response"
),
c(
"Recency",
"Complain"
)
)
# Tipe indikator
modes <- c("A", "A", "A", "A")
set.seed(123)
pls_model <- plspm(
pls_data,
inner_model,
outer_model,
modes = modes
)
summary(pls_model)
## PARTIAL LEAST SQUARES PATH MODELING (PLS-PM)
##
## ----------------------------------------------------------
## MODEL SPECIFICATION
## 1 Number of Cases 2216
## 2 Latent Variables 4
## 3 Manifest Variables 11
## 4 Scale of Data Standardized Data
## 5 Non-Metric PLS FALSE
## 6 Weighting Scheme centroid
## 7 Tolerance Crit 1e-06
## 8 Max Num Iters 100
## 9 Convergence Iters 10
## 10 Bootstrapping FALSE
## 11 Bootstrap samples NULL
##
## ----------------------------------------------------------
## BLOCKS DEFINITION
## Block Type Size Mode
## 1 Spending_Behavior Exogenous 4 A
## 2 Purchase_Activity Endogenous 3 A
## 3 Customer_Engagement Endogenous 2 A
## 4 Customer_Loyalty Endogenous 2 A
##
## ----------------------------------------------------------
## BLOCKS UNIDIMENSIONALITY
## Mode MVs C.alpha DG.rho eig.1st eig.2nd
## Spending_Behavior A 4 0.8052 8.73e-01 2.53 0.678
## Purchase_Activity A 3 0.7297 8.48e-01 1.95 0.613
## Customer_Engagement A 2 0.0000 2.72e-23 1.00 0.998
## Customer_Loyalty A 2 0.0269 6.73e-01 1.01 0.986
##
## ----------------------------------------------------------
## OUTER MODEL
## weight loading communality redundancy
## Spending_Behavior
## 1 MntWines 0.374 0.781 0.6107 0.000000
## 1 MntMeatProducts 0.337 0.853 0.7284 0.000000
## 1 MntFishProducts 0.277 0.777 0.6031 0.000000
## 1 MntSweetProducts 0.270 0.758 0.5750 0.000000
## Purchase_Activity
## 2 NumWebPurchases 0.257 0.686 0.4704 0.314553
## 2 NumCatalogPurchases 0.545 0.863 0.7452 0.498247
## 2 NumStorePurchases 0.422 0.837 0.7002 0.468177
## Customer_Engagement
## 3 NumWebVisitsMonth 0.780 -0.782 0.6109 0.142684
## 3 Response -0.624 0.625 0.3912 0.091379
## Customer_Loyalty
## 4 Recency 0.987 0.989 0.9776 0.012080
## 4 Complain 0.150 0.163 0.0266 0.000329
##
## ----------------------------------------------------------
## CROSSLOADINGS
## Spending_Behavior Purchase_Activity
## Spending_Behavior
## 1 MntWines 0.7815 0.7585
## 1 MntMeatProducts 0.8535 0.6843
## 1 MntFishProducts 0.7766 0.5606
## 1 MntSweetProducts 0.7583 0.5479
## Purchase_Activity
## 2 NumWebPurchases 0.4839 0.6859
## 2 NumCatalogPurchases 0.7663 0.8632
## 2 NumStorePurchases 0.6530 0.8368
## Customer_Engagement
## 3 NumWebVisitsMonth -0.5401 -0.4802
## 3 Response 0.2337 0.1742
## Customer_Loyalty
## 4 Recency 0.0204 0.0115
## 4 Complain -0.0348 -0.0228
## Customer_Engagement Customer_Loyalty
## Spending_Behavior
## 1 MntWines 0.4049 0.00960
## 1 MntMeatProducts 0.5692 0.01866
## 1 MntFishProducts 0.4158 -0.00263
## 1 MntSweetProducts 0.4020 0.02139
## Purchase_Activity
## 2 NumWebPurchases 0.1344 -0.00806
## 2 NumCatalogPurchases 0.5445 0.02064
## 2 NumStorePurchases 0.3600 -0.00296
## Customer_Engagement
## 3 NumWebVisitsMonth -0.7816 -0.01535
## 3 Response 0.6255 -0.19741
## Customer_Loyalty
## 4 Recency -0.1101 0.98873
## 4 Complain -0.0167 0.16317
##
## ----------------------------------------------------------
## INNER MODEL
## $Purchase_Activity
## Estimate Std. Error t value Pr(>|t|)
## Intercept -1.98e-16 0.0122 -1.62e-14 1
## Spending_Behavior 8.18e-01 0.0122 6.68e+01 0
##
## $Customer_Engagement
## Estimate Std. Error t value Pr(>|t|)
## Intercept -6.63e-16 0.0186 -3.56e-14 1.00e+00
## Purchase_Activity 4.83e-01 0.0186 2.60e+01 4.59e-130
##
## $Customer_Loyalty
## Estimate Std. Error t value Pr(>|t|)
## Intercept -1.39e-17 0.0211 -6.59e-16 1.00e+00
## Customer_Engagement -1.11e-01 0.0211 -5.26e+00 1.55e-07
##
## ----------------------------------------------------------
## CORRELATIONS BETWEEN LVs
## Spending_Behavior Purchase_Activity Customer_Engagement
## Spending_Behavior 1.0000 0.8177 0.567
## Purchase_Activity 0.8177 1.0000 0.483
## Customer_Engagement 0.5671 0.4833 1.000
## Customer_Loyalty 0.0149 0.0079 -0.111
## Customer_Loyalty
## Spending_Behavior 0.0149
## Purchase_Activity 0.0079
## Customer_Engagement -0.1112
## Customer_Loyalty 1.0000
##
## ----------------------------------------------------------
## SUMMARY INNER MODEL
## Type R2 Block_Communality Mean_Redundancy
## Spending_Behavior Exogenous 0.0000 0.629 0.0000
## Purchase_Activity Endogenous 0.6686 0.639 0.4270
## Customer_Engagement Endogenous 0.2336 0.501 0.1170
## Customer_Loyalty Endogenous 0.0124 0.502 0.0062
## AVE
## Spending_Behavior 0.629
## Purchase_Activity 0.639
## Customer_Engagement 0.501
## Customer_Loyalty 0.502
##
## ----------------------------------------------------------
## GOODNESS-OF-FIT
## [1] 0.4224
##
## ----------------------------------------------------------
## TOTAL EFFECTS
## relationships direct indirect total
## 1 Spending_Behavior -> Purchase_Activity 0.818 0.0000 0.8177
## 2 Spending_Behavior -> Customer_Engagement 0.000 0.3952 0.3952
## 3 Spending_Behavior -> Customer_Loyalty 0.000 -0.0439 -0.0439
## 4 Purchase_Activity -> Customer_Engagement 0.483 0.0000 0.4833
## 5 Purchase_Activity -> Customer_Loyalty 0.000 -0.0537 -0.0537
## 6 Customer_Engagement -> Customer_Loyalty -0.111 0.0000 -0.1112
# Outer loading
pls_model$outer_model
## name block weight loading communality
## 1 MntWines Spending_Behavior 0.3740758 0.7814980 0.61073911
## 2 MntMeatProducts Spending_Behavior 0.3374870 0.8534756 0.72842060
## 3 MntFishProducts Spending_Behavior 0.2765034 0.7766190 0.60313706
## 4 MntSweetProducts Spending_Behavior 0.2702054 0.7582595 0.57495747
## 5 NumWebPurchases Purchase_Activity 0.2572733 0.6858841 0.47043705
## 6 NumCatalogPurchases Purchase_Activity 0.5454190 0.8632302 0.74516636
## 7 NumStorePurchases Purchase_Activity 0.4215207 0.8367755 0.70019325
## 8 NumWebVisitsMonth Customer_Engagement 0.7802291 -0.7816070 0.61090953
## 9 Response Customer_Engagement -0.6237727 0.6254962 0.39124548
## 10 Recency Customer_Loyalty 0.9866889 0.9887306 0.97758821
## 11 Complain Customer_Loyalty 0.1497196 0.1631747 0.02662599
## redundancy
## 1 0.0000000000
## 2 0.0000000000
## 3 0.0000000000
## 4 0.0000000000
## 5 0.3145525919
## 6 0.4982473352
## 7 0.4681765629
## 8 0.1426836772
## 9 0.0913790679
## 10 0.0120795580
## 11 0.0003290038
# Cross loading
pls_model$crossloadings
## name block Spending_Behavior Purchase_Activity
## 1 MntWines Spending_Behavior 0.78149799 0.75845879
## 2 MntMeatProducts Spending_Behavior 0.85347560 0.68427414
## 3 MntFishProducts Spending_Behavior 0.77661899 0.56062627
## 4 MntSweetProducts Spending_Behavior 0.75825950 0.54785643
## 5 NumWebPurchases Purchase_Activity 0.48389316 0.68588414
## 6 NumCatalogPurchases Purchase_Activity 0.76630125 0.86323019
## 7 NumStorePurchases Purchase_Activity 0.65300586 0.83677551
## 8 NumWebVisitsMonth Customer_Engagement -0.54007755 -0.48015475
## 9 Response Customer_Engagement 0.23366316 0.17418066
## 10 Recency Customer_Loyalty 0.02041739 0.01150035
## 11 Complain Customer_Loyalty -0.03477619 -0.02278843
## Customer_Engagement Customer_Loyalty
## 1 0.40485110 0.009602292
## 2 0.56922118 0.018657279
## 3 0.41577042 -0.002633494
## 4 0.40200991 0.021385701
## 5 0.13442689 -0.008057368
## 6 0.54445866 0.020640823
## 7 0.35997594 -0.002964407
## 8 -0.78160702 -0.015354339
## 9 0.62549618 -0.197411090
## 10 -0.11012491 0.988730608
## 11 -0.01670266 0.163174735
# Path coefficient
pls_model$path_coefs
## Spending_Behavior Purchase_Activity Customer_Engagement
## Spending_Behavior 0.0000000 0.0000000 0.0000000
## Purchase_Activity 0.8177035 0.0000000 0.0000000
## Customer_Engagement 0.0000000 0.4832799 0.0000000
## Customer_Loyalty 0.0000000 0.0000000 -0.1111597
## Customer_Loyalty
## Spending_Behavior 0
## Purchase_Activity 0
## Customer_Engagement 0
## Customer_Loyalty 0
# Nilai R-Square
pls_model$inner_model
## $Purchase_Activity
## Estimate Std. Error t value Pr(>|t|)
## Intercept -1.980099e-16 0.01223381 -1.618546e-14 1
## Spending_Behavior 8.177035e-01 0.01223381 6.683963e+01 0
##
## $Customer_Engagement
## Estimate Std. Error t value Pr(>|t|)
## Intercept -6.631956e-16 0.01860589 -3.564439e-14 1.000000e+00
## Purchase_Activity 4.832799e-01 0.01860589 2.597456e+01 4.593561e-130
##
## $Customer_Loyalty
## Estimate Std. Error t value Pr(>|t|)
## Intercept -1.392153e-17 0.02112085 -6.591368e-16 1.000000e+00
## Customer_Engagement -1.111597e-01 0.02112085 -5.263035e+00 1.553593e-07
pls_model$gof
## [1] 0.4224461
plot(pls_model)
ggplot(
pls_data,
aes(x = factor(Response))
) +
geom_bar(
fill = "steelblue"
) +
labs(
title = "Distribusi Response Customer",
x = "Response",
y = "Jumlah"
)
loading_data <- pls_model$outer_model
ggplot(
loading_data,
aes(
x = name,
y = loading
)
) +
geom_bar(
stat = "identity",
fill = "skyblue"
) +
coord_flip() +
labs(
title = "Outer Loading Indicators",
x = "Indikator",
y = "Loading Factor"
)
ggplot(
pls_data,
aes(
x = MntWines,
y = NumWebPurchases
)
) +
geom_point(
color = "darkblue",
alpha = 0.6
) +
geom_smooth(
method = "lm",
se = FALSE,
color = "red"
) +
labs(
title = "Hubungan MntWines dan NumWebPurchases",
x = "MntWines",
y = "NumWebPurchases"
)
## `geom_smooth()` using formula = 'y ~ x'
ggplot(
pls_data,
aes(
y = NumWebPurchases
)
) +
geom_boxplot(
fill = "orange"
) +
labs(
title = "Boxplot NumWebPurchases",
y = "Jumlah Web Purchases"
)