A customer service firm wants to test whether customer satisfaction scores differ between those served by human agents versus those served by an AI chatbot. After interactions, customers rate their satisfaction (single-item rating scale). Is there a difference in the average satisfaction scores of the two groups?
To test if there is a statistically significant difference in customer satisfaction scores between those served by human agents and those served by an AI chatbot.
There is no difference between the average satisfaction scores of customers served by human agents and those served by an AI chatbot.
There is a difference between the average satisfaction scores of customers served by human agents and those served by an AI chatbot.
##install.packages(“readxl”)
chooseCRANmirror(graphics = FALSE, ind = 1)
install.packages("readxl")
## Installing package into 'C:/Users/manit/AppData/Local/R/win-library/4.5'
## (as 'lib' is unspecified)
## package 'readxl' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'readxl'
## Warning in file.copy(savedcopy, lib, recursive = TRUE): problem copying
## C:\Users\manit\AppData\Local\R\win-library\4.5\00LOCK\readxl\libs\x64\readxl.dll
## to C:\Users\manit\AppData\Local\R\win-library\4.5\readxl\libs\x64\readxl.dll:
## Permission denied
## Warning: restored 'readxl'
##
## The downloaded binary packages are in
## C:\Users\manit\AppData\Local\Temp\RtmpCOHNZc\downloaded_packages
library(readxl)
A6R2<- read_excel("C:\\Users\\manit\\OneDrive\\Desktop\\A6R2.xlsx")
head(A6R2)
## # A tibble: 6 × 3
## CustomerID ServiceType SatisfactionScore
## <dbl> <chr> <dbl>
## 1 1 Human 9
## 2 2 Human 6
## 3 3 Human 6
## 4 4 Human 9
## 5 5 Human 9
## 6 6 Human 8
Calculate the mean, median, SD, and sample size for each variable. ## INSTALL THE REQUIRED PACKAGE
#install.packages("dplyr")
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
A6R2 %>%
group_by(ServiceType) %>%
summarise(
Mean = mean(SatisfactionScore, na.rm = TRUE),
Median = median(SatisfactionScore, na.rm = TRUE),
SD = sd(SatisfactionScore, na.rm = TRUE),
N = n()
)
## # A tibble: 2 × 5
## ServiceType Mean Median SD N
## <chr> <dbl> <dbl> <dbl> <int>
## 1 AI 3.6 3 1.60 100
## 2 Human 7.42 8 1.44 100
hist(A6R2$SatisfactionScore[A6R2$ServiceType == "Human"],
main = "Histogram of Human SatisfactionScore ",
xlab = "SatisfactionScore",
ylab = "Frequency",
col = "lightblue",
border = "black",
breaks = 20)
hist(A6R2$SatisfactionScore[A6R2$ServiceType == "AI"],
main = "Histogram of AI SatisfactionScore ",
xlab = "SatisfactionScore",
ylab = "Frequency",
col = "lightgreen",
border = "black",
breaks = 20)
#QUESTIONS # Answer the questions below as comments within the R
script:
Q1) Check the SKEWNESS of the VARIABLE 1 histogram. In your
opinion, does the histogram look symmetrical, positively skewed, or
negatively skewed?
Ans)The histogram is positively skewed, with
more low scores and a tail to the right.
Q2) Check the KURTOSIS
of the VARIABLE 1 histogram. In your opinion, does the histogram look
too flat, too tall, or does it have a proper bell curve?
Ans)The
histogram is too flat, showing low kurtosis rather than a proper bell
curve.
Q3) Check the SKEWNESS of the VARIABLE 2 histogram. In
your opinion, does the histogram look symmetrical, positively skewed, or
negatively skewed?
Ans)The histogram is negatively skewed, with
most values on the higher end and a tail to the left.
Q4) Check
the KUROTSIS of the VARIABLE 2 histogram. In your opinion, does the
histogram look too flat, too tall, or does it have a proper bell
curve?
Ans)The histogram is too tall, showing high kurtosis with
a sharp peak.
Check the normality for each group’s score statistically.The Shapiro-Wilk Test is a test that checks skewness and kurtosis at the same time.The test is checking “Is this variable the SAME as normal data (null hypothesis) or DIFFERENT from normal data (alternate hypothesis)?”For this test, if p is GREATER than .05 (p > .05), the data is NORMAL.If p is LESS than .05 (p < .05), the data is NOT normal.
shapiro.test(A6R2$SatisfactionScore[A6R2$ServiceType == "Human"])
##
## Shapiro-Wilk normality test
##
## data: A6R2$SatisfactionScore[A6R2$ServiceType == "Human"]
## W = 0.93741, p-value = 0.0001344
shapiro.test(A6R2$SatisfactionScore[A6R2$ServiceType == "AI"])
##
## Shapiro-Wilk normality test
##
## data: A6R2$SatisfactionScore[A6R2$ServiceType == "AI"]
## W = 0.91143, p-value = 5.083e-06
#Answer the questions below as a comment within the R script:
Was the data normally distributed for Variable 1?
Ans)No,
the data is not normally distributed because the p-value (0.0001344) is
less than 0.05.
Was the data normally distributed for Variable
2? Ans)No, the data is not normally distributed because the p-value
(5.083e-06) is less than 0.05.
Check for any outliers impacting the mean for each group’s scores.
install.packages("ggplot2")
## Installing package into 'C:/Users/manit/AppData/Local/R/win-library/4.5'
## (as 'lib' is unspecified)
## package 'ggplot2' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\manit\AppData\Local\Temp\RtmpCOHNZc\downloaded_packages
install.packages("ggpubr")
## Installing package into 'C:/Users/manit/AppData/Local/R/win-library/4.5'
## (as 'lib' is unspecified)
## package 'ggpubr' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\manit\AppData\Local\Temp\RtmpCOHNZc\downloaded_packages
library(ggplot2)
library(ggpubr)
ggboxplot(A6R2, x = "ServiceType", y = "SatisfactionScore",
color = "ServiceType",
palette = "jco",
add = "jitter")
#Answer the questions below as a comment within the R script.
Q1) Were there any dots outside of the boxplot? Are these dots close
to the whiskers of the boxplot or are they very far away?
Ans)Yes,There are several outliers in both groups, and some of them are
far from the whiskers. Because the outliers are not close to the
boxplot, the Mann-Whitney U test is more appropriate.
#PURPOSE: Test if there was a difference between the distributions of the two groups.
wilcox.test(SatisfactionScore ~ServiceType , data = A6R2, exact = FALSE)
##
## Wilcoxon rank sum test with continuity correction
##
## data: SatisfactionScore by ServiceType
## W = 497, p-value < 2.2e-16
## alternative hypothesis: true location shift is not equal to 0
If results were statistically significant (p < .05), continue to effect size section below. If results were NOT statistically significant (p > .05), skip to reporting section below.
Determine how big of a difference there was between the group distributions. # INSTALL REQUIRED PACKAGE
install.packages("effectsize")
## Installing package into 'C:/Users/manit/AppData/Local/R/win-library/4.5'
## (as 'lib' is unspecified)
## package 'effectsize' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\manit\AppData\Local\Temp\RtmpCOHNZc\downloaded_packages
library(effectsize)
rank_biserial(SatisfactionScore~ ServiceType, data = A6R2, exact = FALSE)
## r (rank biserial) | 95% CI
## ----------------------------------
## -0.90 | [-0.93, -0.87]
#Answer the questions below as a comment within the R script:
Q1) What is the size of the effect?
Ans)The rank-biserial
correlation is –0.90, which falls in the large effect range. This means
the difference between the two groups is very strong and meaningful.
Q2) Which group had the higher average rank?
Ans)Because the
effect is negative, the AI group had the higher average rank (their
scores were ranked higher than the Human group).
#WRITTEN REPORT FOR MANN-WHITNEY U TEST
A Mann-Whitney U test was conducted to compare customer satisfaction scores between customers helped by Human agents (n = 100) and those assisted by an AI chatbot (n = 100). Customers served by Human agents had a higher median satisfaction score (Mdn = around 7–8) compared to customers served by the AI chatbot (Mdn = around 3–4). The test indicated a statistically significant difference between the two groups, U = 0, p < .001. The effect size was large (r = –0.90), indicating a very strong difference in satisfaction levels, with Human agents producing substantially higher satisfaction than the AI chatbot.