1.0 Introduction

In today’s digital world, social media connects people globally, deeply penetrating our daily lives. The escalation of digital platforms and social media networks as information, communication, and product discovery tools has revolutionized the e-commerce consumer decision-making process. The importance of social media marketing in influencing consumer purchasing intentions, especially post-Covid-19, is a pivotal focus of this study. Additionally, digital marketing on social media has been found to significantly impact purchasing decisions, particularly for small and medium-sized enterprises (SMEs) products.

Our project aims to investigate the impact of social media on the purchasing behavior of consumers from different demographic backgrounds in the field of e-commerce.We will explore how consumers of various demographics behave when influenced by social media. The project targets SMEs and novice social media marketers in Malaysia, offering strategic insights for them to effectively engage with their audience and optimize their marketing efforts in the digital realm.
We will apply sophiscated data science process in this project, starting from business understanding to final stage deployment.

Data Science Process

2.0 Business Understanding

Our project delves into the impact of social media on consumer purchasing behaviors, focusing on how various demographic segments interact with and are influenced by digital marketing campaigns. Our goal is to identify the factors that drive online purchasing decisions, providing SMEs with a competitive in their marketing approaches.

2.1 Project Objective

The study aims to achieve the following objectives:
1. To identify the key factors that influence consumer preferences, buying decisions, and brand loyalty in the context of social media.
2. To gain insights of how social media influences consumer behavior.
3. To provide actionable insights for businesses to optimize their social media marketing strategies.

2.2 Problem Statement

SMEs often struggle to utilize social media to drive sales due to the inability to measure its impact. Our project aims to bridge this gap.

2.3 Methodology

The methodology involves obtaining relevant datasets from various sources and analyzing them to understand the influence of social media on consumer behavior. The data collected includes basic information about the respondents, such as gender, age, ethnicity, occupation, and annual income. The project emphasizes the importance of understanding the factors that drive consumer choices and using social media data to enhance marketing strategies and stay competitive in the market.

2.4 Target Audience

The project targets SMEs and novice social media marketers in Malaysia, offering strategic insights to enhance marketing approaches and customer engagement.

2.5 Outcome Expectation

Through the deployment of a sophisticated data science process, we anticipate SMEs will gain a deeper, more nuanced understanding of their target audience, leading to more effective marketing campaigns and, ultimately, a stronger presence in the e-commerce sector.

3.0 Data Understanding

3.1 About The Dataset

Several datasets were obtained by searching from multiple sites such as data world, mendeley data and The National Center for Biotechnology Information (NCBI) website, and then brought to group discussion. After the discussion, we decided to use the data set of title with title “The survey dataset of The Influence of theory of planned behaviour on purchase behaviour on social media” (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9111892/). The year of the dataset is 2022.

Since the dataset is in xlsx file, openxlsx package is installed, and loaded in the library. After that read.xlsx function is used to assess the dataset.Since the data start from second row, hence the ‘startRow = 2’ parameter is used to import the data from the second row of excel file

library(openxlsx)
group_assignment_dataset<- read.xlsx("group assignment dataset.xlsx", startRow = 2)

The column names are shown below using colnames function.

colnames(group_assignment_dataset)
##  [1] "ID"                                                    
##  [2] "Gender"                                                
##  [3] "Age"                                                   
##  [4] "Ethnic"                                                
##  [5] "Occupation"                                            
##  [6] "Annual.Income"                                         
##  [7] "Social.Media.usage"                                    
##  [8] "Experience.of.purchasing.due.to.social.media.influence"
##  [9] "Reviews.and.rating.impact.on.purchasing.decision"      
## [10] "Average.time.spent.on.the.Internet.(weekly)"           
## [11] "Attention.to.advertisement.on.social.media"            
## [12] "Purchase.Behaviour.1.(PB1)"                            
## [13] "Purchase.Behaviour.2.(PB2)"                            
## [14] "Purchase.Behaviour.3.(PB3)"                            
## [15] "Purchase.Behaviour.4.(PB4)"                            
## [16] "Attitude.1.(ATTD1)"                                    
## [17] "Attitude.2.(ATTD2)"                                    
## [18] "Attitude.3.(ATTD3)"                                    
## [19] "Attitude.4.(ATTD4)"                                    
## [20] "Social.Norms.1.(SN1)"                                  
## [21] "Social.Norms.2.(SN2)"                                  
## [22] "Social.Norms.3.(SN3)"                                  
## [23] "Social.Norms.4.(SN4)"                                  
## [24] "Perceived.Behavioural.Control.1.(PBC1)"                
## [25] "Perceived.Behavioural.Control.2.(PBC2)"                
## [26] "Perceived.Behavioural.Control.3.(PBC3)"                
## [27] "Perceived.Behavioural.Control.4.(PBC4)"

nrow and ncol function are used to count the number of columns and rows respectively. The dataset composed of 219 rows and 27 columns.

nrow(group_assignment_dataset)
## [1] 219
ncol(group_assignment_dataset)
## [1] 27

str() function shows the internal structure of the group_assignment_dataset.

str(group_assignment_dataset)
## 'data.frame':    219 obs. of  27 variables:
##  $ ID                                                    : num  1 2 3 4 5 6 7 8 9 10 ...
##  $ Gender                                                : chr  "Female" "Male" "Female" "Male" ...
##  $ Age                                                   : chr  "29 - 34 Years Old" "23 - 28 Years Old" "29 - 34 Years Old" "35 - 40 Years Old" ...
##  $ Ethnic                                                : chr  "Chinese" "Chinese" "Chinese" "Malay" ...
##  $ Occupation                                            : chr  "Homemaker" "Student" "Homemaker" "Businessman" ...
##  $ Annual.Income                                         : chr  "RM50,001-RM70,000" "RM50,001-RM70,000" "Less than RM30,000" "More than RM90,001" ...
##  $ Social.Media.usage                                    : chr  "Yes" "Yes" "Yes" "Yes" ...
##  $ Experience.of.purchasing.due.to.social.media.influence: chr  "Yes" "Yes" "Yes" "Yes" ...
##  $ Reviews.and.rating.impact.on.purchasing.decision      : chr  "Yes" "Yes" "Yes" "No" ...
##  $ Average.time.spent.on.the.Internet.(weekly)           : chr  "More than 40 hours" "More than 40 hours" "5 hours – 10 hours" "1 hour – 4 hours" ...
##  $ Attention.to.advertisement.on.social.media            : chr  "Yes" "Yes" "No" "Yes" ...
##  $ Purchase.Behaviour.1.(PB1)                            : chr  "Neutral" "Agree" "Strongly disagree" "Agree" ...
##  $ Purchase.Behaviour.2.(PB2)                            : chr  "Neutral" "Agree" "Strongly disagree" "Agree" ...
##  $ Purchase.Behaviour.3.(PB3)                            : chr  "Neutral" "Disagree" "Strongly disagree" "Neutral" ...
##  $ Purchase.Behaviour.4.(PB4)                            : chr  "Neutral" "Strongly agree" "Disagree" "Agree" ...
##  $ Attitude.1.(ATTD1)                                    : chr  "Neutral" "Agree" "Neutral" "Agree" ...
##  $ Attitude.2.(ATTD2)                                    : chr  "Neutral" "Neutral" "Strongly disagree" "Agree" ...
##  $ Attitude.3.(ATTD3)                                    : chr  "Neutral" "Agree" "Strongly disagree" "Agree" ...
##  $ Attitude.4.(ATTD4)                                    : chr  "Neutral" "Neutral" "Disagree" "Neutral" ...
##  $ Social.Norms.1.(SN1)                                  : chr  "Neutral" "Strongly disagree" "Strongly disagree" "Neutral" ...
##  $ Social.Norms.2.(SN2)                                  : chr  "Neutral" "Disagree" "Strongly disagree" "Neutral" ...
##  $ Social.Norms.3.(SN3)                                  : chr  "Neutral" "Agree" "Strongly disagree" "Agree" ...
##  $ Social.Norms.4.(SN4)                                  : chr  "Neutral" "Neutral" "Strongly disagree" "Agree" ...
##  $ Perceived.Behavioural.Control.1.(PBC1)                : chr  "Neutral" "Neutral" "Strongly disagree" "Neutral" ...
##  $ Perceived.Behavioural.Control.2.(PBC2)                : chr  "Neutral" "Agree" "Strongly disagree" "Agree" ...
##  $ Perceived.Behavioural.Control.3.(PBC3)                : chr  "Neutral" "Disagree" "Strongly disagree" "Neutral" ...
##  $ Perceived.Behavioural.Control.4.(PBC4)                : chr  "Neutral" "Disagree" "Strongly disagree" "Agree" ...

From the output above, group_assignment_dataset is a data frame which consists of 219 observations of 7 variables, and more details on the type of variables are revealed.

3.2 Data Cleaning for EDA

3.2.1 Checking Missing Value

To make sure that there is no missing value or NA in our dataset, dplyr package is first loaded in the library, and then function such as count() is used to determine the unique values of each column.

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
count(group_assignment_dataset)
##     n
## 1 219

There are 219 unique values

Other than this, functions such as complete.cases() and any(is.na()) are adopted to check if there are any missing or NA values in the dataset.

complete.cases(group_assignment_dataset)
##   [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [61] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [76] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [91] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [106] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [121] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [136] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [151] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [166] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [181] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [196] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [211] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE

Since the output is false, there is no missing data, thus data imputation will not be adopted.

any(is.na(group_assignment_dataset))
## [1] FALSE


3.2.2 Remove Irrelevant Data

As our concern is to analyze the impact of social media on consumer behaviour, the data with no social media usage will be removed from our dataset.

In this step, select() function is used to choose only the columns named “ID”, “Age”, “Social.Media.usage”, and “Experience.of.purchasing.due.to.social.media.influence”. Then the pipe operator, %>% passed the output of select() function as the input to the next function, filter() function which then filters rows where the “Social.Media.usage” column is equal to “No” and the “Experience.of.purchasing.due.to.social.media.influence” column is equal to “Yes”.

The code and the output of selected data are showed below.

library(dplyr)

group_assignment_dataset %>%
  select(ID, Age, Social.Media.usage, Experience.of.purchasing.due.to.social.media.influence) %>%
  filter(Social.Media.usage == "No" & Experience.of.purchasing.due.to.social.media.influence == "Yes") 
##    ID               Age Social.Media.usage
## 1   9 23 - 28 Years Old                 No
## 2 135 29 - 34 Years Old                 No
## 3 183            Others                 No
## 4 190 23 - 28 Years Old                 No
## 5 191 17 - 22 Years Old                 No
## 6 197 23 - 28 Years Old                 No
## 7 198 17 - 22 Years Old                 No
## 8 210 17 - 22 Years Old                 No
## 9 219 17 - 22 Years Old                 No
##   Experience.of.purchasing.due.to.social.media.influence
## 1                                                    Yes
## 2                                                    Yes
## 3                                                    Yes
## 4                                                    Yes
## 5                                                    Yes
## 6                                                    Yes
## 7                                                    Yes
## 8                                                    Yes
## 9                                                    Yes

After that, the latest data frame, final_dataset is formed by removing 9 data with no social media usage from the group_assignment_dataset by using anti_join function.

selected_data <- group_assignment_dataset %>%
  select(ID, Age, Social.Media.usage, Experience.of.purchasing.due.to.social.media.influence) %>%
  filter(Social.Media.usage == "No" & Experience.of.purchasing.due.to.social.media.influence == "Yes") 
final_dataset <- group_assignment_dataset %>%
  anti_join(selected_data)
## Joining with `by = join_by(ID, Age, Social.Media.usage,
## Experience.of.purchasing.due.to.social.media.influence)`

After removing data, there are only 210 values, which can be checked by count and nrow fucntion

count(final_dataset)
##     n
## 1 210
nrow(final_dataset)
## [1] 210

The structure of final_dataset is as below.

str(final_dataset)
## 'data.frame':    210 obs. of  27 variables:
##  $ ID                                                    : num  1 2 3 4 5 6 7 8 10 11 ...
##  $ Gender                                                : chr  "Female" "Male" "Female" "Male" ...
##  $ Age                                                   : chr  "29 - 34 Years Old" "23 - 28 Years Old" "29 - 34 Years Old" "35 - 40 Years Old" ...
##  $ Ethnic                                                : chr  "Chinese" "Chinese" "Chinese" "Malay" ...
##  $ Occupation                                            : chr  "Homemaker" "Student" "Homemaker" "Businessman" ...
##  $ Annual.Income                                         : chr  "RM50,001-RM70,000" "RM50,001-RM70,000" "Less than RM30,000" "More than RM90,001" ...
##  $ Social.Media.usage                                    : chr  "Yes" "Yes" "Yes" "Yes" ...
##  $ Experience.of.purchasing.due.to.social.media.influence: chr  "Yes" "Yes" "Yes" "Yes" ...
##  $ Reviews.and.rating.impact.on.purchasing.decision      : chr  "Yes" "Yes" "Yes" "No" ...
##  $ Average.time.spent.on.the.Internet.(weekly)           : chr  "More than 40 hours" "More than 40 hours" "5 hours – 10 hours" "1 hour – 4 hours" ...
##  $ Attention.to.advertisement.on.social.media            : chr  "Yes" "Yes" "No" "Yes" ...
##  $ Purchase.Behaviour.1.(PB1)                            : chr  "Neutral" "Agree" "Strongly disagree" "Agree" ...
##  $ Purchase.Behaviour.2.(PB2)                            : chr  "Neutral" "Agree" "Strongly disagree" "Agree" ...
##  $ Purchase.Behaviour.3.(PB3)                            : chr  "Neutral" "Disagree" "Strongly disagree" "Neutral" ...
##  $ Purchase.Behaviour.4.(PB4)                            : chr  "Neutral" "Strongly agree" "Disagree" "Agree" ...
##  $ Attitude.1.(ATTD1)                                    : chr  "Neutral" "Agree" "Neutral" "Agree" ...
##  $ Attitude.2.(ATTD2)                                    : chr  "Neutral" "Neutral" "Strongly disagree" "Agree" ...
##  $ Attitude.3.(ATTD3)                                    : chr  "Neutral" "Agree" "Strongly disagree" "Agree" ...
##  $ Attitude.4.(ATTD4)                                    : chr  "Neutral" "Neutral" "Disagree" "Neutral" ...
##  $ Social.Norms.1.(SN1)                                  : chr  "Neutral" "Strongly disagree" "Strongly disagree" "Neutral" ...
##  $ Social.Norms.2.(SN2)                                  : chr  "Neutral" "Disagree" "Strongly disagree" "Neutral" ...
##  $ Social.Norms.3.(SN3)                                  : chr  "Neutral" "Agree" "Strongly disagree" "Agree" ...
##  $ Social.Norms.4.(SN4)                                  : chr  "Neutral" "Neutral" "Strongly disagree" "Agree" ...
##  $ Perceived.Behavioural.Control.1.(PBC1)                : chr  "Neutral" "Neutral" "Strongly disagree" "Neutral" ...
##  $ Perceived.Behavioural.Control.2.(PBC2)                : chr  "Neutral" "Agree" "Strongly disagree" "Agree" ...
##  $ Perceived.Behavioural.Control.3.(PBC3)                : chr  "Neutral" "Disagree" "Strongly disagree" "Neutral" ...
##  $ Perceived.Behavioural.Control.4.(PBC4)                : chr  "Neutral" "Disagree" "Strongly disagree" "Agree" ...


3.2.3 Data Preprocessing : Renaming Data for Modelling 1:Classification

First, the column names are changed using names() function and first 6 rows are showed using head() function.

df1<-final_dataset[,c('Age', 'Ethnic', 'Occupation', 'Annual.Income', 'Average.time.spent.on.the.Internet.(weekly)', 'Purchase.Behaviour.1.(PB1)', 'Purchase.Behaviour.2.(PB2)', 'Purchase.Behaviour.4.(PB4)')]
names(df1) <- c("Age_Group", "Ethnic", "Occupation", "Annual_Income_Group", "Weekly_Time_Spent_Group", "PB1", "PB2", "PB4")
head(df1)
##           Age_Group  Ethnic  Occupation Annual_Income_Group
## 1 29 - 34 Years Old Chinese   Homemaker   RM50,001-RM70,000
## 2 23 - 28 Years Old Chinese     Student   RM50,001-RM70,000
## 3 29 - 34 Years Old Chinese   Homemaker  Less than RM30,000
## 4 35 - 40 Years Old   Malay Businessman  More than RM90,001
## 5 23 - 28 Years Old Chinese    Employee   RM70,001-RM90,000
## 6 23 - 28 Years Old Chinese     Student  Less than RM30,000
##   Weekly_Time_Spent_Group               PB1               PB2            PB4
## 1      More than 40 hours           Neutral           Neutral        Neutral
## 2      More than 40 hours             Agree             Agree Strongly agree
## 3      5 hours – 10 hours Strongly disagree Strongly disagree       Disagree
## 4        1 hour – 4 hours             Agree             Agree          Agree
## 5     10 hours – 20 hours           Neutral             Agree Strongly agree
## 6     10 hours – 20 hours    Strongly agree    Strongly agree Strongly agree

After that the categorical variables are converted to 1,2,3,4,5 for modelling.

df1$Age_Group[df1$Age_Group == "17 - 22 Years Old"]<-1
df1$Age_Group[df1$Age_Group == "23 - 28 Years Old"]<-2
df1$Age_Group[df1$Age_Group == "29 - 34 Years Old"]<-3
df1$Age_Group[df1$Age_Group == "35 - 40 Years Old"]<-4
df1$Age_Group[df1$Age_Group == "Others"]<-5
df1$Age_Group<-as.numeric(df1$Age_Group)

df1$Ethnic[df1$Ethnic == "Chinese"]<-1
df1$Ethnic[df1$Ethnic == "Indian"]<-2
df1$Ethnic[df1$Ethnic == "Malay"]<-3
df1$Ethnic[df1$Ethnic == "Others"]<-4
df1$Ethnic<-as.numeric(df1$Ethnic)

df1$Occupation[df1$Occupation == "Businessman"]<-1
df1$Occupation[df1$Occupation == "Employee"]<-2
df1$Occupation[df1$Occupation == "Homemaker"]<-3
df1$Occupation[df1$Occupation == "Retired"]<-4
df1$Occupation[df1$Occupation == "Student"]<-5
df1$Occupation<-as.numeric(df1$Occupation)

df1$Annual_Income_Group[df1$Annual_Income_Group == "Less than RM30,000"]<-1
df1$Annual_Income_Group[df1$Annual_Income_Group == "RM30,001-RM50,000"]<-2
df1$Annual_Income_Group[df1$Annual_Income_Group == "RM50,001-RM70,000"]<-3
df1$Annual_Income_Group[df1$Annual_Income_Group == "RM70,001-RM90,000"]<-4
df1$Annual_Income_Group[df1$Annual_Income_Group == "More than RM90,001"]<-5
df1$Annual_Income_Group<-as.numeric(df1$Annual_Income_Group)

df1$Weekly_Time_Spent_Group[df1$Weekly_Time_Spent_Group == "1 hour – 4 hours"]<-1
df1$Weekly_Time_Spent_Group[df1$Weekly_Time_Spent_Group == "5 hours – 10 hours"]<-2
df1$Weekly_Time_Spent_Group[df1$Weekly_Time_Spent_Group == "10 hours – 20 hours"]<-3
df1$Weekly_Time_Spent_Group[df1$Weekly_Time_Spent_Group == "20 hours – 40 hours"]<-4
df1$Weekly_Time_Spent_Group[df1$Weekly_Time_Spent_Group == "More than 40 hours"]<-5
df1$Weekly_Time_Spent_Group<-as.numeric(df1$Weekly_Time_Spent_Group)

Strongly agree is switched to agree, strongly disagree is switched to disagree to combine the value.

df1$PB1[df1$PB1 == "Strongly agree"]<-"Agree"
df1$PB1[df1$PB1 == "Strongly disagree"]<-"Disagree"

df1$PB2[df1$PB2 == "Strongly agree"]<-"Agree"
df1$PB2[df1$PB2 == "Strongly disagree"]<-"Disagree"

df1$PB4[df1$PB4 == "Strongly agree"]<-"Agree"
df1$PB4[df1$PB4 == "Strongly disagree"]<-"Disagree"


3.2.4 Data Preprocessing : Renaming Data for Modelling 2: Regression

First, the column names are changed using names() function and first 6 rows are showed using head() function.

df2<-final_dataset[,c('Gender', 'Age', 'Ethnic', 'Occupation', 'Annual.Income', 'Experience.of.purchasing.due.to.social.media.influence','Reviews.and.rating.impact.on.purchasing.decision', 'Average.time.spent.on.the.Internet.(weekly)','Attention.to.advertisement.on.social.media','Purchase.Behaviour.1.(PB1)', 'Purchase.Behaviour.2.(PB2)', 'Purchase.Behaviour.4.(PB4)', 'Attitude.4.(ATTD4)', 'Perceived.Behavioural.Control.1.(PBC1)')]
names(df2) <- c("Gender","Age", "Ethnic", "Occupation", "Annual_Income","Experience", "Reviews_and_Rating", "Average_Time_Spent","Attention_To_Advertisement","PB1", "PB2", "PB4", "ATTD4", "PBC1")
head(df2)
##   Gender               Age  Ethnic  Occupation      Annual_Income Experience
## 1 Female 29 - 34 Years Old Chinese   Homemaker  RM50,001-RM70,000        Yes
## 2   Male 23 - 28 Years Old Chinese     Student  RM50,001-RM70,000        Yes
## 3 Female 29 - 34 Years Old Chinese   Homemaker Less than RM30,000        Yes
## 4   Male 35 - 40 Years Old   Malay Businessman More than RM90,001        Yes
## 5 Female 23 - 28 Years Old Chinese    Employee  RM70,001-RM90,000        Yes
## 6 Female 23 - 28 Years Old Chinese     Student Less than RM30,000        Yes
##   Reviews_and_Rating  Average_Time_Spent Attention_To_Advertisement
## 1                Yes  More than 40 hours                        Yes
## 2                Yes  More than 40 hours                        Yes
## 3                Yes  5 hours – 10 hours                         No
## 4                 No    1 hour – 4 hours                        Yes
## 5                Yes 10 hours – 20 hours                         No
## 6                Yes 10 hours – 20 hours                        Yes
##                 PB1               PB2            PB4          ATTD4
## 1           Neutral           Neutral        Neutral        Neutral
## 2             Agree             Agree Strongly agree        Neutral
## 3 Strongly disagree Strongly disagree       Disagree       Disagree
## 4             Agree             Agree          Agree        Neutral
## 5           Neutral             Agree Strongly agree          Agree
## 6    Strongly agree    Strongly agree Strongly agree Strongly agree
##                PBC1
## 1           Neutral
## 2           Neutral
## 3 Strongly disagree
## 4           Neutral
## 5           Neutral
## 6             Agree

After that the categorical variables are converted to 1,2,3,4,5 for modelling.

df2$Gender[df2$Gender == "Male"]<-1
df2$Gender[df2$Gender == "Female"]<-2
df2$Gender<-as.numeric(df2$Gender)

df2$Age[df2$Age == "17 - 22 Years Old"]<-1
df2$Age[df2$Age == "23 - 28 Years Old"]<-2
df2$Age[df2$Age == "29 - 34 Years Old"]<-3
df2$Age[df2$Age == "35 - 40 Years Old"]<-4
df2$Age[df2$Age == "Others"]<-5
df2$Age<-as.numeric(df2$Age)

df2$Ethnic[df2$Ethnic == "Chinese"]<-1
df2$Ethnic[df2$Ethnic == "Indian"]<-2
df2$Ethnic[df2$Ethnic == "Malay"]<-3
df2$Ethnic[df2$Ethnic == "Others"]<-4
df2$Ethnic<-as.numeric(df2$Ethnic)

df2$Occupation[df2$Occupation == "Businessman"]<-1
df2$Occupation[df2$Occupation == "Employee"]<-2
df2$Occupation[df2$Occupation == "Homemaker"]<-3
df2$Occupation[df2$Occupation == "Retired"]<-4
df2$Occupation[df2$Occupation == "Student"]<-5
df2$Occupation<-as.numeric(df2$Occupation)

df2$Annual_Income[df2$Annual_Income == "Less than RM30,000"]<-1
df2$Annual_Income[df2$Annual_Income == "RM30,001-RM50,000"]<-2
df2$Annual_Income[df2$Annual_Income == "RM50,001-RM70,000"]<-3
df2$Annual_Income[df2$Annual_Income == "RM70,001-RM90,000"]<-4
df2$Annual_Income[df2$Annual_Income == "More than RM90,001"]<-5
df2$Annual_Income<-as.numeric(df2$Annual_Income)

df2$Experience[df2$Experience == "Yes"]<-1
df2$Experience[df2$Experience == "No"]<-2
df2$Experience<-as.numeric(df2$Experience)

df2$Reviews_and_Rating[df2$Reviews_and_Rating == "Yes"]<-1
df2$Reviews_and_Rating[df2$Reviews_and_Rating == "No"]<-2
df2$Reviews_and_Rating<-as.numeric(df2$Reviews_and_Rating)

df2$Average_Time_Spent[df2$Average_Time_Spent == "1 hour – 4 hours"]<-1
df2$Average_Time_Spent[df2$Average_Time_Spent == "5 hours – 10 hours"]<-2
df2$Average_Time_Spent[df2$Average_Time_Spent == "10 hours – 20 hours"]<-3
df2$Average_Time_Spent[df2$Average_Time_Spent == "20 hours – 40 hours"]<-4
df2$Average_Time_Spent[df2$Average_Time_Spent == "More than 40 hours"]<-5
df2$Average_Time_Spent<-as.numeric(df2$Average_Time_Spent)

df2$Attention_To_Advertisement[df2$Attention_To_Advertisement == "Yes"]<-1
df2$Attention_To_Advertisement[df2$Attention_To_Advertisement == "No"]<-2
df2$Attention_To_Advertisement<-as.numeric(df2$Attention_To_Advertisement)

df2$PB1[df2$PB1 == "Strongly disagree"]<-1
df2$PB1[df2$PB1 == "Disagree"]<-2
df2$PB1[df2$PB1 == "Neutral"]<-3
df2$PB1[df2$PB1 == "Agree"]<-4
df2$PB1[df2$PB1 == "Strongly agree"]<-5
df2$PB1<-as.numeric(df2$PB1)

df2$PB2[df2$PB2 == "Strongly disagree"]<-1
df2$PB2[df2$PB2 == "Disagree"]<-2
df2$PB2[df2$PB2 == "Neutral"]<-3
df2$PB2[df2$PB2 == "Agree"]<-4
df2$PB2[df2$PB2 == "Strongly agree"]<-5
df2$PB2<-as.numeric(df2$PB2)

df2$PB4[df2$PB4 == "Strongly disagree"]<-1
df2$PB4[df2$PB4 == "Disagree"]<-2
df2$PB4[df2$PB4 == "Neutral"]<-3
df2$PB4[df2$PB4 == "Agree"]<-4
df2$PB4[df2$PB4 == "Strongly agree"]<-5
df2$PB4<-as.numeric(df2$PB4)

df2$ATTD4[df2$ATTD4 == "Strongly disagree"]<-1
df2$ATTD4[df2$ATTD4 == "Disagree"]<-2
df2$ATTD4[df2$ATTD4 == "Neutral"]<-3
df2$ATTD4[df2$ATTD4 == "Agree"]<-4
df2$ATTD4[df2$ATTD4 == "Strongly agree"]<-5
df2$ATTD4<-as.numeric(df2$ATTD4)

df2$PBC1[df2$PBC1 == "Strongly disagree"]<-1
df2$PBC1[df2$PBC1 == "Disagree"]<-2
df2$PBC1[df2$PBC1 == "Neutral"]<-3
df2$PBC1[df2$PBC1 == "Agree"]<-4
df2$PBC1[df2$PBC1 == "Strongly agree"]<-5
df2$PBC1<-as.numeric(df2$PBC1)


4.0 Data Preparation: Exploratory Data Analysis

Section 1: Basic Demographic

Percentage of each demographic are calculated and tabulated. table() function creates a frequency table, prop.table() function generate proportions by dividing each frequency by the total count of ages, after obtaining the percentage by multiplying the proportions to 100, round(…, 2) convert the percentage to 2 decimal places.

gender_percentages <- round(prop.table(table(final_dataset$Gender)) * 100, 2)
age_percentages <- round(prop.table(table(final_dataset$Age)) * 100,2)
ethnic_percentages <- round(prop.table(table(final_dataset$Ethnic)) * 100,2)
occupation_percentages <- round(prop.table(table(final_dataset$Occupation)) * 100,2)
income_percentages <- round(prop.table(table(final_dataset$Annual.Income)) * 100,2)
social_media_usage_percentage <- round(prop.table(table(final_dataset$Social.Media.usage)) * 100,2)
purchase_percentage <- round(prop.table(table(final_dataset$Experience.of.purchasing.due.to.social.media.influence)) * 100,2)
reviewrating_percentage <- round(prop.table(table(final_dataset$Reviews.and.rating.impact.on.purchasing.decision)) * 100,2)
advertisement_percentage <- round(prop.table(table(final_dataset$Attention.to.advertisement.on.social.media)) * 100,2)
timespent_percentage <- round(prop.table(table(final_dataset$`Average.time.spent.on.the.Internet.(weekly)`)) * 100,2)

There are 54.76% of females and 45.24% of males involved in the survey questionnaire.

gender_percentages
## 
## Female   Male 
##  54.76  45.24

The majority of the respondents are from 23-28 years old (31.43%).

age_percentages
## 
## 17 - 22 Years Old 23 - 28 Years Old 29 - 34 Years Old 35 - 40 Years Old 
##             19.52             31.43             25.24             18.57 
##            Others 
##              5.24

The majority of respondents are Chinese with a percentage of 81.90%

ethnic_percentages
## 
## Chinese  Indian   Malay  Others 
##   81.90    7.62   10.00    0.48

Most of the respondents are employees (44.76%).

occupation_percentages
## 
## Businessman    Employee   Homemaker     Retired     Student 
##       22.38       44.76        7.62        0.95       24.29

For annual income, the majority of respondents falls within the range of RM50,001 - RM70,000 (23.33%) and more than RM90,001 (23.81), while the annual income range of RM70,001 - RM90,000 bracket has the lowest representation of 12.38%.

income_percentages
## 
## Less than RM30,000 More than RM90,001  RM30,001-RM50,000  RM50,001-RM70,000 
##              17.62              23.81              22.86              23.33 
##  RM70,001-RM90,000 
##              12.38

97.62% of respondents have used social media and 27.14% will spend an average of 1 to 4 hours on the internet.

social_media_usage_percentage
## 
##    No   Yes 
##  2.38 97.62
timespent_percentage
## 
##    1 hour – 4 hours 10 hours – 20 hours 20 hours – 40 hours  5 hours – 10 hours 
##               27.14               14.76               20.00               24.76 
##  More than 40 hours 
##               13.33

89.52% of respondents have experience of purchasing due to social media influence, and

purchase_percentage 
## 
##    No   Yes 
## 10.48 89.52

83.33% have review and rating impact on purchasing decision.

reviewrating_percentage 
## 
##    No   Yes 
## 16.67 83.33

63.33% of them had attention to advertisement on social media.

advertisement_percentage
## 
##    No   Yes 
## 36.67 63.33

Session 2 : Variables

There are 4 themes for section 2 which are Purchase Behavior with 4 questions (PB1, PB2, PB3 and PB4), Attitude (ATTD) with 4 questions, Social Norms (SN) and Perceived Behavioural Control (PBC).

The table of selected variables is listed using the code below.

#List out selected variable name and their descriptions.
variable_names <- c("PB1", "PB2","PB3", "PB4","ATTD1","ATTD2","ATTD4", "SN3", "PBC1")
descriptions <- c(
  "I am willing to buy a product promoted on social media", 
  "There is a high probability that I would purchase a product because of the impact of social media",
  "I am easily influenced by advertisements on social mediaand further make a purchase behaviour", 
  "I had the experience of buying a product due to the influence of social media", 
  "Advertisement on social media can help me to be aware of the existence of products", 
  "Advertisements on social media more easily attract my attention when compared to other advertising channels", 
  "I ever purchase a product that I have become aware of through social media", 
  "I feel good if many people purchased products through social media", 
  "Frequency product advertisement on social media led me to buy")

# Create a matrix using cbind()
variable_description_matrix <- cbind(Variable = variable_names, Description = descriptions)

# Converting the matrix to a data frame using data.frame()
variable_description_table <- data.frame(variable_description_matrix)

# print out the table of selected variables
print(variable_description_table,row.names = FALSE)
##  Variable
##       PB1
##       PB2
##       PB3
##       PB4
##     ATTD1
##     ATTD2
##     ATTD4
##       SN3
##      PBC1
##                                                                                                  Description
##                                                       I am willing to buy a product promoted on social media
##            There is a high probability that I would purchase a product because of the impact of social media
##                I am easily influenced by advertisements on social mediaand further make a purchase behaviour
##                                I had the experience of buying a product due to the influence of social media
##                           Advertisement on social media can help me to be aware of the existence of products
##  Advertisements on social media more easily attract my attention when compared to other advertising channels
##                                   I ever purchase a product that I have become aware of through social media
##                                           I feel good if many people purchased products through social media
##                                                Frequency product advertisement on social media led me to buy

After that, new data frame is created with the selected variables, and the variables are renamed for the ease of analysis.

#Create a new data frame of the selected variables
dfeda2<-final_dataset[,c("Purchase.Behaviour.1.(PB1)","Purchase.Behaviour.2.(PB2)","Purchase.Behaviour.3.(PB3)","Purchase.Behaviour.4.(PB4)","Attitude.1.(ATTD1)","Attitude.2.(ATTD2)","Attitude.4.(ATTD4)","Social.Norms.3.(SN3)", "Perceived.Behavioural.Control.1.(PBC1)" )]

#Change the name of the variables 
names(dfeda2) <- c("PB1", "PB2","PB3", "PB4","ATTD1","ATTD2","ATTD4", "SN3", "PBC1")

#First 6 rows of the dfeda2
head(dfeda2)
##                 PB1               PB2               PB3            PB4
## 1           Neutral           Neutral           Neutral        Neutral
## 2             Agree             Agree          Disagree Strongly agree
## 3 Strongly disagree Strongly disagree Strongly disagree       Disagree
## 4             Agree             Agree           Neutral          Agree
## 5           Neutral             Agree             Agree Strongly agree
## 6    Strongly agree    Strongly agree             Agree Strongly agree
##            ATTD1             ATTD2          ATTD4               SN3
## 1        Neutral           Neutral        Neutral           Neutral
## 2          Agree           Neutral        Neutral             Agree
## 3        Neutral Strongly disagree       Disagree Strongly disagree
## 4          Agree             Agree        Neutral             Agree
## 5        Neutral             Agree          Agree           Neutral
## 6 Strongly agree    Strongly agree Strongly agree    Strongly agree
##                PBC1
## 1           Neutral
## 2           Neutral
## 3 Strongly disagree
## 4           Neutral
## 5           Neutral
## 6             Agree

ggplot2 package is installed and loaded. Since the default order of the histogram is in alphabetical order, the ordinal variables are first rearranged according to the intensity before constructing the histogram.

# Load ggplot2 package
library(ggplot2)

#PB1
# Since the default order is in alphabetical order, the variables on x-axis are rearranged for better comparison
dfeda2$PB1 <- factor(dfeda2$PB1, levels = c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"))

After that, histograms are created for each variable.

# Create a histogram with reordered variables
ggplot(dfeda2, aes(x = PB1, fill = PB1)) + 
  geom_text(stat='count', aes(label=..count..), vjust=-0.5) +
  geom_bar() +
  labs(x = "Response for PB1", y = "Frequency", 
       title = "PB1: I am willing to buy a product promoted on social media")+ scale_fill_viridis_d()
## Warning: The dot-dot notation (`..count..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(count)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

#PB2
dfeda2$PB2 <- factor(dfeda2$PB2, levels = c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"))
ggplot(dfeda2, aes(x = PB2, fill = PB2)) + 
  geom_bar() +
  geom_text(stat='count', aes(label=..count..), vjust=-0.5) +
  labs(x = "Response for PB2", y = "Frequency", 
       title = "PB2: There is a high probability that I would purchase a product because of the \n impact of social media")+ scale_fill_viridis_d()

#PB3
dfeda2$PB3 <- factor(dfeda2$PB3, levels = c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"))
ggplot(dfeda2, aes(x = PB3, fill = PB3)) + 
  geom_bar() +
  geom_text(stat='count', aes(label=..count..), vjust=-0.5) +
  labs(x = "Response for PB3", y = "Frequency", 
       title = "PB3: I am easily influenced by advertisements on social media and \n further make a purchase behaviour")+ scale_fill_viridis_d()

#PB4
dfeda2$PB4 <- factor(dfeda2$PB4, levels = c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"))
ggplot(dfeda2, aes(x = PB4, fill = PB4)) + 
  geom_bar() +
  geom_text(stat='count', aes(label=..count..), vjust=-0.5) +
  labs(x = "Response for PB4", y = "Frequency", 
       title = "PB4: I had the experience of buying a product due to the influence of social media")+ scale_fill_viridis_d()

#ATTD1
dfeda2$ATTD1 <- factor(dfeda2$ATTD1, levels = c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"))
ggplot(dfeda2, aes(x = ATTD1, fill = ATTD1)) + 
  geom_bar() +
  geom_text(stat='count', aes(label=..count..), vjust=-0.5) +
  labs(x = "Response for ATTD1", y = "Frequency", 
       title = "ATTD1: Advertisement on social media can help me to be aware of the \n existence of products")+ scale_fill_viridis_d()

#ATTD2
dfeda2$ATTD2 <- factor(dfeda2$ATTD2, levels = c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"))
ggplot(dfeda2, aes(x = ATTD2, fill = ATTD2)) + 
  geom_bar() +
  geom_text(stat='count', aes(label=..count..), vjust=-0.5) +
  labs(x = "Response for ATTD2", y = "Frequency", 
       title = "ATTD2: Advertisements on social media more easily attract my attention \n when compared to other advertising channels")+ scale_fill_viridis_d()

#ATTD4
dfeda2$ATTD4 <- factor(dfeda2$ATTD4, levels = c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"))
ggplot(dfeda2, aes(x = ATTD4, fill = ATTD4)) + 
  geom_bar() +
  geom_text(stat='count', aes(label=..count..), vjust=-0.5) +
  labs(x = "Response for ATTD4", y = "Frequency", 
       title = "ATTD4: I ever purchase a product that I have become aware of \n through social media")+ scale_fill_viridis_d()

#SN3
dfeda2$SN3 <- factor(dfeda2$SN3, levels = c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"))
ggplot(dfeda2, aes(x = SN3, fill = SN3)) + 
  geom_text(stat='count', aes(label=..count..), vjust=-0.5) +
  geom_bar() +
  labs(x = "Response for SN3", y = "Frequency", 
       title = "SN3: I feel good if many people purchased products through social media")+ scale_fill_viridis_d()

#PBC1
dfeda2$PBC1 <- factor(dfeda2$PBC1, levels = c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"))
ggplot(dfeda2, aes(x = PBC1, fill = PBC1)) + 
  geom_bar() +
  geom_text(stat='count', aes(label=..count..), vjust=-0.5) +
  labs(x = "Response for PBC1", y = "Frequency", 
       title = "PBC1: Frequency product advertisement on social media led me to buy") + scale_fill_viridis_d()


5.0 Data Modeling

As part of our project, we have created two data models - a classification model (Ordinal Logistic Regression) and a regression model (Multiple Regression Model) to explore the relationship between social media and consumer purchasing patterns. These models have helped us gain deeper insights into the impact of social media on consumer purchasing behavior.

5.1 Data Modeling 1 - Classification: Ordinal Logistic Regression

Ordinal Logistic Regression is used to identify the factors that influence the purchase behavior of consumer. An ordinal outcome will fall into three categories by investigating the relationship between dependent variable and multiple independent variables. Ordinal response of “Agree”, “Neutral”, and “Disagree” will be predicted by this model with processed dataset df1.

In this case, there are models to be built from 3 dependent variables below :
- PB1 - I am willing to buy a product promoted on social media
- PB2 - There is a high probability that I would purchase a product because of the impact of social media
- PB4 - I had the experience of buying a product due to the influence of social media

The independent variables used for this model are :
- Age_Group (renamed from Age)
- Ethnic
- Occupation
- Annual_Income_Group (renamed from Annual.Income)
- Weekly_Time_Spent_Group (renamed from Average.time.spent.on.the.Internet.(weekly))

Step 1: Categorical Variables Conversion

df1$PB1<-as.factor(df1$PB1)
df1$PB2<-as.factor(df1$PB2)
df1$PB4<-as.factor(df1$PB4)


Step 2: Splitting Data

The 210 data is split into training and test data subsets

library(caret)
## Loading required package: lattice
# Model 1: PB1
trainIndexPB1<-createDataPartition(df1$PB1, p=0.75, list=F)
data_trainPB1<-df1[trainIndexPB1,]
data_testPB1<-df1[-trainIndexPB1,]
x_testPB1<-data_testPB1[,1:5]
y_testPB1<-data_testPB1[,6]

# Model 2: PB2
trainIndexPB2<-createDataPartition(df1$PB2, p=0.75, list=F)
data_trainPB2<-df1[trainIndexPB2,]
data_testPB2<-df1[-trainIndexPB2,]
x_testPB2<-data_testPB2[,1:5]
y_testPB2<-data_testPB2[,7]

# Model 3: PB4
trainIndexPB4<-createDataPartition(df1$PB4, p=0.75, list=F)
data_trainPB4<-df1[trainIndexPB4,]
data_testPB4<-df1[-trainIndexPB4,]
x_testPB4<-data_testPB4[,1:5]
y_testPB4<-data_testPB4[,8]


Step 3: Model Building

Fit an Ordinal Logistic Regression model using polr() function from MASS package.

library(MASS)
## 
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
## 
##     select
# Model 1: PB1
modelPB1<-polr(PB1~Age_Group + Ethnic + Occupation + Annual_Income_Group + Weekly_Time_Spent_Group, data = data_trainPB1, Hess = T)

# Model 2: PB2
modelPB2<-polr(PB2~Age_Group + Ethnic + Occupation + Annual_Income_Group + Weekly_Time_Spent_Group, data = data_trainPB2, Hess = T)

# Model 3: PB4
modelPB4<-polr(PB4~Age_Group + Ethnic + Occupation + Annual_Income_Group + Weekly_Time_Spent_Group, data = data_trainPB4, Hess = T)


Step 4: Interpreting Model Results

summary(modelPB1)
## Call:
## polr(formula = PB1 ~ Age_Group + Ethnic + Occupation + Annual_Income_Group + 
##     Weekly_Time_Spent_Group, data = data_trainPB1, Hess = T)
## 
## Coefficients:
##                            Value Std. Error t value
## Age_Group                0.07286     0.1624  0.4486
## Ethnic                  -0.83092     0.2643 -3.1443
## Occupation              -0.02938     0.1277 -0.2302
## Annual_Income_Group     -0.12882     0.1158 -1.1127
## Weekly_Time_Spent_Group  0.11669     0.1092  1.0689
## 
## Intercepts:
##                  Value   Std. Error t value
## Agree|Disagree   -1.5348  0.8914    -1.7218
## Disagree|Neutral -0.3237  0.8827    -0.3667
## 
## Residual Deviance: 328.4366 
## AIC: 342.4366
summary(modelPB2)
## Call:
## polr(formula = PB2 ~ Age_Group + Ethnic + Occupation + Annual_Income_Group + 
##     Weekly_Time_Spent_Group, data = data_trainPB2, Hess = T)
## 
## Coefficients:
##                            Value Std. Error t value
## Age_Group                0.13143     0.1635  0.8039
## Ethnic                  -0.48971     0.2716 -1.8031
## Occupation              -0.08069     0.1262 -0.6396
## Annual_Income_Group     -0.08224     0.1191 -0.6904
## Weekly_Time_Spent_Group -0.12805     0.1129 -1.1346
## 
## Intercepts:
##                  Value   Std. Error t value
## Agree|Disagree   -1.1191  0.8913    -1.2556
## Disagree|Neutral -0.1234  0.8863    -0.1393
## 
## Residual Deviance: 326.2854 
## AIC: 340.2854
summary(modelPB4)
## Call:
## polr(formula = PB4 ~ Age_Group + Ethnic + Occupation + Annual_Income_Group + 
##     Weekly_Time_Spent_Group, data = data_trainPB4, Hess = T)
## 
## Coefficients:
##                            Value Std. Error t value
## Age_Group                0.03812     0.1542  0.2473
## Ethnic                  -0.49028     0.2483 -1.9747
## Occupation               0.07148     0.1250  0.5717
## Annual_Income_Group     -0.14462     0.1179 -1.2268
## Weekly_Time_Spent_Group -0.04943     0.1110 -0.4453
## 
## Intercepts:
##                  Value   Std. Error t value
## Agree|Disagree   -0.9562  0.9144    -1.0456
## Disagree|Neutral  0.1100  0.9113     0.1207
## 
## Residual Deviance: 325.2963 
## AIC: 339.2963


Step 5: Prediction of Test Data and Confusion Matrix

predictionPB1<-predict(modelPB1, x_testPB1)
confusionMatrix(predictionPB1, y_testPB1)
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Agree Disagree Neutral
##   Agree       12        5       5
##   Disagree     0        0       0
##   Neutral      8        9      13
## 
## Overall Statistics
##                                           
##                Accuracy : 0.4808          
##                  95% CI : (0.3401, 0.6237)
##     No Information Rate : 0.3846          
##     P-Value [Acc > NIR] : 0.100752        
##                                           
##                   Kappa : 0.1856          
##                                           
##  Mcnemar's Test P-Value : 0.002099        
## 
## Statistics by Class:
## 
##                      Class: Agree Class: Disagree Class: Neutral
## Sensitivity                0.6000          0.0000         0.7222
## Specificity                0.6875          1.0000         0.5000
## Pos Pred Value             0.5455             NaN         0.4333
## Neg Pred Value             0.7333          0.7308         0.7727
## Prevalence                 0.3846          0.2692         0.3462
## Detection Rate             0.2308          0.0000         0.2500
## Detection Prevalence       0.4231          0.0000         0.5769
## Balanced Accuracy          0.6438          0.5000         0.6111
predictionPB2<-predict(modelPB2, x_testPB2)
confusionMatrix(predictionPB2, y_testPB2)
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Agree Disagree Neutral
##   Agree       24        9      14
##   Disagree     0        0       0
##   Neutral      2        2       0
## 
## Overall Statistics
##                                           
##                Accuracy : 0.4706          
##                  95% CI : (0.3293, 0.6154)
##     No Information Rate : 0.5098          
##     P-Value [Acc > NIR] : 0.7580781       
##                                           
##                   Kappa : -0.0408         
##                                           
##  Mcnemar's Test P-Value : 0.0001697       
## 
## Statistics by Class:
## 
##                      Class: Agree Class: Disagree Class: Neutral
## Sensitivity                0.9231          0.0000        0.00000
## Specificity                0.0800          1.0000        0.89189
## Pos Pred Value             0.5106             NaN        0.00000
## Neg Pred Value             0.5000          0.7843        0.70213
## Prevalence                 0.5098          0.2157        0.27451
## Detection Rate             0.4706          0.0000        0.00000
## Detection Prevalence       0.9216          0.0000        0.07843
## Balanced Accuracy          0.5015          0.5000        0.44595
predictionPB4<-predict(modelPB4, x_testPB4)
confusionMatrix(predictionPB4, y_testPB4)
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Agree Disagree Neutral
##   Agree       22        9      13
##   Disagree     0        0       0
##   Neutral      3        3       1
## 
## Overall Statistics
##                                           
##                Accuracy : 0.451           
##                  95% CI : (0.3113, 0.5966)
##     No Information Rate : 0.4902          
##     P-Value [Acc > NIR] : 0.7577815       
##                                           
##                   Kappa : -0.0178         
##                                           
##  Mcnemar's Test P-Value : 0.0003906       
## 
## Statistics by Class:
## 
##                      Class: Agree Class: Disagree Class: Neutral
## Sensitivity                0.8800          0.0000        0.07143
## Specificity                0.1538          1.0000        0.83784
## Pos Pred Value             0.5000             NaN        0.14286
## Neg Pred Value             0.5714          0.7647        0.70455
## Prevalence                 0.4902          0.2353        0.27451
## Detection Rate             0.4314          0.0000        0.01961
## Detection Prevalence       0.8627          0.0000        0.13725
## Balanced Accuracy          0.5169          0.5000        0.45463
# K-fold Cross Validation
val_dfPB1<-df1[,c("Age_Group", "Ethnic", "Occupation", "Annual_Income_Group", "Weekly_Time_Spent_Group", "PB1")]
train_controlPB1<-trainControl(method = "cv", number = 10)
train(PB1~., data=val_dfPB1, trControl=train_controlPB1, method="polr")
## Ordered Logistic or Probit Regression 
## 
## 210 samples
##   5 predictor
##   3 classes: 'Agree', 'Disagree', 'Neutral' 
## 
## No pre-processing
## Resampling: Cross-Validated (10 fold) 
## Summary of sample sizes: 189, 189, 189, 189, 189, 189, ... 
## Resampling results across tuning parameters:
## 
##   method    Accuracy   Kappa     
##   cauchit   0.4282900  0.10923521
##   cloglog   0.4144589  0.08017191
##   logistic  0.4142208  0.08640829
##   loglog    0.4189827  0.09432635
##   probit    0.4189827  0.09354622
## 
## Accuracy was used to select the optimal model using the largest value.
## The final value used for the model was method = cauchit.
val_dfPB2<-df1[,c("Age_Group", "Ethnic", "Occupation", "Annual_Income_Group", "Weekly_Time_Spent_Group", "PB2")]
train_controlPB2<-trainControl(method = "cv", number = 10)
train(PB2~., data=val_dfPB2, trControl=train_controlPB2, method="polr")
## Ordered Logistic or Probit Regression 
## 
## 210 samples
##   5 predictor
##   3 classes: 'Agree', 'Disagree', 'Neutral' 
## 
## No pre-processing
## Resampling: Cross-Validated (10 fold) 
## Summary of sample sizes: 189, 189, 188, 189, 189, 188, ... 
## Resampling results across tuning parameters:
## 
##   method    Accuracy   Kappa       
##   cauchit   0.4902381  -0.001718079
##   cloglog   0.4952381   0.001702128
##   logistic  0.4902381  -0.003363232
##   loglog    0.4807143  -0.019131234
##   probit    0.4854762  -0.010195064
## 
## Accuracy was used to select the optimal model using the largest value.
## The final value used for the model was method = cloglog.
val_dfPB4<-df1[,c("Age_Group", "Ethnic", "Occupation", "Annual_Income_Group", "Weekly_Time_Spent_Group", "PB4")]
train_controlPB4<-trainControl(method = "cv", number = 10)
train(PB4~., data=val_dfPB4, trControl=train_controlPB4, method="polr")
## Ordered Logistic or Probit Regression 
## 
## 210 samples
##   5 predictor
##   3 classes: 'Agree', 'Disagree', 'Neutral' 
## 
## No pre-processing
## Resampling: Cross-Validated (10 fold) 
## Summary of sample sizes: 189, 189, 190, 189, 188, 188, ... 
## Resampling results across tuning parameters:
## 
##   method    Accuracy   Kappa      
##   cauchit   0.4520779  -0.03926287
##   cloglog   0.4807143  -0.01455112
##   logistic  0.4561688  -0.03382313
##   loglog    0.4468615  -0.04733895
##   probit    0.4609307  -0.02653211
## 
## Accuracy was used to select the optimal model using the largest value.
## The final value used for the model was method = cloglog.


5.2 Data Modeling 2 - Regression

The second model chosen for data modeling is the regression model where the regression model is a function that can describe the relationship between one or more independent variables and a dependent variable. The analysis from the regression model can also used for new data prediction. Since there are various independent variables in the dataset, a multiple regression model is selected to use in this research.

The independent variables used for the regression model are Gender, Age, Ethnic, Occupation, Annual_Income, Experience, Reviews_and_Rating, Average_Time_Spent and Attention_To_Advertisement.

There are 5 important dependent variables are selected:
PB1 - I am willing to buy a product promoted on social media
PB2 - There is a high probability that I would purchase a product because of the impact of social media
PB4 - I had the experience of buying a product due to the influence of social media
ATTD4 - I ever purchase a product that I have become aware of through social media
PBC1 - Frequency product advertisement on social media led me to buy

The first step is to create the regression model using the 9 independent variables with 5 dependent variables mentioned above. There will be 5 multiple regression models in total where 1 regression model builds up from 9 independent variables with 1 dependent variable each.

library(carData)
library(car)
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
#Create multiple regression model with PB1
Rmodel1 <- lm(PB1 ~ Gender + Age + Ethnic + Occupation + Annual_Income + Experience + Reviews_and_Rating + Average_Time_Spent + Attention_To_Advertisement, data=df2)

#Create multiple regression model with PB2
Rmodel2 <- lm(PB2~ Gender + Age + Ethnic + Occupation + Annual_Income + Experience + Reviews_and_Rating + Average_Time_Spent + Attention_To_Advertisement, data=df2)

#Create multiple regression model with PB4
Rmodel3 <- lm(PB4~ Gender + Age + Ethnic + Occupation + Annual_Income + Experience + Reviews_and_Rating + Average_Time_Spent + Attention_To_Advertisement, data=df2)

#Create multiple regression model with ATTD4
Rmodel4 <- lm(ATTD4~ Gender + Age + Ethnic + Occupation + Annual_Income + Experience + Reviews_and_Rating + Average_Time_Spent + Attention_To_Advertisement, data=df2)

##Create multiple regression model with PBC1
Rmodel5 <- lm(PBC1~ Gender + Age + Ethnic + Occupation + Annual_Income + Experience + Reviews_and_Rating + Average_Time_Spent + Attention_To_Advertisement, data=df2)

After the 5 regression models are built, the next step is checking for multicollinearity on the 9 independent variables with the 5 selected dependent variables.

vif(Rmodel1)
##                     Gender                        Age 
##                   1.044043                   1.643245 
##                     Ethnic                 Occupation 
##                   1.168035                   1.683687 
##              Annual_Income                 Experience 
##                   1.292193                   1.158721 
##         Reviews_and_Rating         Average_Time_Spent 
##                   1.136080                   1.076079 
## Attention_To_Advertisement 
##                   1.122102
vif(Rmodel2)
##                     Gender                        Age 
##                   1.044043                   1.643245 
##                     Ethnic                 Occupation 
##                   1.168035                   1.683687 
##              Annual_Income                 Experience 
##                   1.292193                   1.158721 
##         Reviews_and_Rating         Average_Time_Spent 
##                   1.136080                   1.076079 
## Attention_To_Advertisement 
##                   1.122102
vif(Rmodel3)
##                     Gender                        Age 
##                   1.044043                   1.643245 
##                     Ethnic                 Occupation 
##                   1.168035                   1.683687 
##              Annual_Income                 Experience 
##                   1.292193                   1.158721 
##         Reviews_and_Rating         Average_Time_Spent 
##                   1.136080                   1.076079 
## Attention_To_Advertisement 
##                   1.122102
vif(Rmodel4)
##                     Gender                        Age 
##                   1.044043                   1.643245 
##                     Ethnic                 Occupation 
##                   1.168035                   1.683687 
##              Annual_Income                 Experience 
##                   1.292193                   1.158721 
##         Reviews_and_Rating         Average_Time_Spent 
##                   1.136080                   1.076079 
## Attention_To_Advertisement 
##                   1.122102
vif(Rmodel5)
##                     Gender                        Age 
##                   1.044043                   1.643245 
##                     Ethnic                 Occupation 
##                   1.168035                   1.683687 
##              Annual_Income                 Experience 
##                   1.292193                   1.158721 
##         Reviews_and_Rating         Average_Time_Spent 
##                   1.136080                   1.076079 
## Attention_To_Advertisement 
##                   1.122102

The VIF values for 5 regression models are the same which are below 5. The VIF values below 5 indicate that there is minor or no multicollinearity between the independent variables and dependent variables. In conclusion, the 9 independent variables need not to removed from the regression models.

Next is to check on the result of model fitting functions by using the summary() function. The summary() function is used to obtain the summary of the regression models where the relevant details can be obtained like the residuals, coefficients, residual standard error, adjusted R-squared and p-value.

summary(Rmodel1)
## 
## Call:
## lm(formula = PB1 ~ Gender + Age + Ethnic + Occupation + Annual_Income + 
##     Experience + Reviews_and_Rating + Average_Time_Spent + Attention_To_Advertisement, 
##     data = df2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.51534 -0.69047  0.00048  0.67113  2.45220 
## 
## Coefficients:
##                             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                 1.994591   0.597093   3.341 0.000998 ***
## Gender                      0.345915   0.149866   2.308 0.022013 *  
## Age                        -0.004511   0.081488  -0.055 0.955904    
## Ethnic                      0.514238   0.119670   4.297  2.7e-05 ***
## Occupation                 -0.074979   0.064396  -1.164 0.245671    
## Annual_Income               0.098218   0.058545   1.678 0.094980 .  
## Experience                  0.103523   0.256599   0.403 0.687054    
## Reviews_and_Rating          0.272061   0.208789   1.303 0.194059    
## Average_Time_Spent          0.082792   0.054067   1.531 0.127276    
## Attention_To_Advertisement -0.549576   0.160473  -3.425 0.000747 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.058 on 200 degrees of freedom
## Multiple R-squared:  0.1941, Adjusted R-squared:  0.1579 
## F-statistic: 5.354 on 9 and 200 DF,  p-value: 1.467e-06
summary(Rmodel2)
## 
## Call:
## lm(formula = PB2 ~ Gender + Age + Ethnic + Occupation + Annual_Income + 
##     Experience + Reviews_and_Rating + Average_Time_Spent + Attention_To_Advertisement, 
##     data = df2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.69808 -0.72707  0.01241  0.83268  2.27090 
## 
## Coefficients:
##                              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                 2.8590821  0.6362886   4.493 1.18e-05 ***
## Gender                      0.4846155  0.1597041   3.034  0.00273 ** 
## Age                        -0.0004086  0.0868366  -0.005  0.99625    
## Ethnic                      0.3436841  0.1275252   2.695  0.00764 ** 
## Occupation                 -0.0916690  0.0686230  -1.336  0.18312    
## Annual_Income               0.0992445  0.0623885   1.591  0.11325    
## Experience                  0.0069781  0.2734429   0.026  0.97967    
## Reviews_and_Rating         -0.0456724  0.2224944  -0.205  0.83757    
## Average_Time_Spent         -0.0091844  0.0576158  -0.159  0.87351    
## Attention_To_Advertisement -0.5120595  0.1710065  -2.994  0.00310 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.127 on 200 degrees of freedom
## Multiple R-squared:  0.1451, Adjusted R-squared:  0.1066 
## F-statistic: 3.771 on 9 and 200 DF,  p-value: 0.0002083
summary(Rmodel3)
## 
## Call:
## lm(formula = PB4 ~ Gender + Age + Ethnic + Occupation + Annual_Income + 
##     Experience + Reviews_and_Rating + Average_Time_Spent + Attention_To_Advertisement, 
##     data = df2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.71352 -0.76935 -0.08105  0.86516  2.37807 
## 
## Coefficients:
##                             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                 3.198704   0.665871   4.804 3.05e-06 ***
## Gender                      0.242466   0.167129   1.451   0.1484    
## Age                        -0.003376   0.090874  -0.037   0.9704    
## Ethnic                      0.249027   0.133454   1.866   0.0635 .  
## Occupation                 -0.092931   0.071813  -1.294   0.1971    
## Annual_Income               0.065298   0.065289   1.000   0.3185    
## Experience                 -0.289290   0.286156  -1.011   0.3133    
## Reviews_and_Rating          0.105835   0.232839   0.455   0.6499    
## Average_Time_Spent          0.067358   0.060294   1.117   0.2653    
## Attention_To_Advertisement -0.308398   0.178957  -1.723   0.0864 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.18 on 200 degrees of freedom
## Multiple R-squared:  0.08611,    Adjusted R-squared:  0.04498 
## F-statistic: 2.094 on 9 and 200 DF,  p-value: 0.03164
summary(Rmodel4)
## 
## Call:
## lm(formula = ATTD4 ~ Gender + Age + Ethnic + Occupation + Annual_Income + 
##     Experience + Reviews_and_Rating + Average_Time_Spent + Attention_To_Advertisement, 
##     data = df2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.77856 -0.75298  0.06804  0.82588  2.66045 
## 
## Coefficients:
##                            Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                 3.45446    0.62551   5.523 1.03e-07 ***
## Gender                      0.37938    0.15700   2.416   0.0166 *  
## Age                        -0.08875    0.08537  -1.040   0.2998    
## Ethnic                      0.28583    0.12537   2.280   0.0237 *  
## Occupation                 -0.16030    0.06746  -2.376   0.0184 *  
## Annual_Income               0.13630    0.06133   2.222   0.0274 *  
## Experience                 -0.28360    0.26881  -1.055   0.2927    
## Reviews_and_Rating          0.05907    0.21873   0.270   0.7874    
## Average_Time_Spent          0.01678    0.05664   0.296   0.7674    
## Attention_To_Advertisement -0.47388    0.16811  -2.819   0.0053 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.108 on 200 degrees of freedom
## Multiple R-squared:  0.1654, Adjusted R-squared:  0.1279 
## F-statistic: 4.404 on 9 and 200 DF,  p-value: 2.877e-05
summary(Rmodel5)
## 
## Call:
## lm(formula = PBC1 ~ Gender + Age + Ethnic + Occupation + Annual_Income + 
##     Experience + Reviews_and_Rating + Average_Time_Spent + Attention_To_Advertisement, 
##     data = df2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.83520 -1.00533  0.03427  0.86265  3.13379 
## 
## Coefficients:
##                             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                 2.338428   0.695781   3.361 0.000931 ***
## Gender                      0.304131   0.174636   1.742 0.083131 .  
## Age                         0.016293   0.094956   0.172 0.863941    
## Ethnic                      0.495682   0.139449   3.555 0.000472 ***
## Occupation                 -0.080802   0.075039  -1.077 0.282867    
## Annual_Income               0.039991   0.068222   0.586 0.558409    
## Experience                  0.005045   0.299010   0.017 0.986556    
## Reviews_and_Rating          0.454790   0.243297   1.869 0.063046 .  
## Average_Time_Spent         -0.002848   0.063003  -0.045 0.963993    
## Attention_To_Advertisement -0.704944   0.186995  -3.770 0.000215 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.233 on 200 degrees of freedom
## Multiple R-squared:  0.1758, Adjusted R-squared:  0.1387 
## F-statistic:  4.74 on 9 and 200 DF,  p-value: 1.004e-05


Estimate

A positive estimate for a variable indicates that, on average, an increase in that variable is associated with an increase in the dependent variable while a negative indicates a decrease in the dependent variable.

The independent variables that contribute a negative estimation values are:

  • Model1: Age, Occupation, Attention_To_Advertisement

  • Model2: Age, Occupation, Reviews_and_Rating, Average_Time_Spent, Attention_To_Advertisement

  • Model3: Age, Occupation, Experience, Attention_To_Advertisement

  • Model4: Age, Occupation, Experience, Attention_To_Advertisement

  • Model5: Occupation, Average_Time_Spent, Attention_To_Advertisement

In conclusion, we can see that attention to advertisements contributes a negative estimation value to all 5 models. This indicates that the conclusion that got from the survey datasets states that if the respondent pays attention to the advertisements on social media, the respondent will become less agree with the statement of the dependent variables.

t value & Pr(>|t|)

A larger absolute t-value, along with a small p-value, suggests that the variable is likely to be statistically significant in predicting the dependent variable. If there are no asterisks it means it is not statistically significant, * is marginally significant, ** is moderately significant and *** is highly significant.

These are the variables of each regression model which is moderately significant and highly significant with a p-value less than or equal to 0.001.

  • Model 1: Intercept, Ethnic, Attention_To_Advertisement

  • Model 2: Intercept, Gender, Ethnic, Attention_To_Advertisement

  • Model 3: Intercept

  • Model 4: Intercept, Attention_To_Advertisement

  • Model 5: Intercept, Ethnic, Attention_To_Advertisement

The result shows that the independent variable of attention to advertisement is statistically significant to the dependent variables in 4 out of 5 regression models.

Adjusted R-squared

The adjusted R-squared value is the variability in the dependent variable and it is explained by the independent variables in your model, adjusted for the number of predictors. The model explains a relatively small portion of the variability in the dependent variable, adjusted for the number of predictors. The model may not be explaining a large proportion of the variation.

  • Model 1: 0.1534

  • Model 2: 0.1050

  • Model 3: 0.04381

  • Model 4: 0.1272

  • Model 5: 0.1355

F-statistics & p-value

The F-statistics value is the result of a statistical test and it needs to be compared to a critical value or calculate a p-value associated with it. suggests that the overall model is statistically significant. In other words, there is evidence that at least one predictor in the model is associated with the dependent variable. The small p-value suggests strong evidence against the null hypothesis, and would typically reject the null hypothesis. The result of the p-value of each regression model is stated below.

  • Model 1: 0.000002315

  • Model 2: 0.0002397

  • Model 3: 0.03436

  • Model 4: 0.00003056

  • Model 5: 0.00001378

6.0 Model Evaluation and Validation

6.1 Ordinal Logistic Regression

Note: The coefficients, intercepts, and model metrics presented below are approximate and may vary slightly upon refreshing or rerunning the models. The variation could stem from the sensitivity of the models to the dataset or algorithmic randomness.

ModelPB1

  • Age_Group: The positive coefficient 0.08891 suggests a slight increase in the odds of higher outcomes in PB1 with increasing age.

  • Ethnic: The negative coefficient -0.96320 indicates that higher ethnic values are associated with lower odds of higher outcomes in PB1.

  • Other Predictors: Occupation, Annual_Income_Group, and Weekly_Time_Spent_Group show weaker associations with the outcome.

ModelPB2

  • Age_Group: A larger positive coefficient 0.14681 indicates a more noticeable increase in the odds of higher outcomes with age compared to ModelPB1.

  • Ethnic: A smaller negative coefficient -0.48370 suggests a similar negative impact as ModelPB1 but not as strong.

  • Other Predictors: Similar weak associations observed for Occupation, Annual_Income_Group, and Weekly_Time_Spent_Group.

ModelPB4

  • Age_Group: The smallest positive coefficient 0.04217 among the models suggests a weaker effect of age on the outcome.

  • Ethnic: Comparable negative coefficient -0.48554 to ModelPB2, indicating a negative impact but with slight variability.

  • Other Predictors: Similar weak associations observed for Occupation, Annual_Income_Group, and Weekly_Time_Spent_Group.

Consistency: Age_Group and Ethnicity show relatively consistent directional effects across models, but the magnitude varies.
Weak Associations: Occupation, Annual_Income_Group, and Weekly_Time_Spent_Group exhibit consistently weaker associations with the ordinal outcome.

Summary:
Age and Ethnicity appear relatively more influential predictors across the models compared to other predictors.

6.2 Regression

Rmodel1

  • Model Equation: Predicts PB1 using various predictor variables.

  • Residuals: Show variation around 0 between predicted and actual

  • Coefficients: Show change in PB1 per unit change in predictors.

  • Model Fit:

    • R-squared: 19.41% of the variance in PB1 is explained by predictors.

    • Adjusted R-squared: It’s 15.79%, adjusting for predictors.

  • F-statistic: Model overall is statistically significant (p-value: 1.467e-06).

Variables like Ethnic and Attention_To_Advertisement show significant impact on PB1. Other variables lack strong evidence for their relationship with PB1.

Rmodel2

  • Model Equation: Predicts PB2 using predictor variables.

  • Residuals: Variation around 0 between predicted and actual values.

  • Coefficients: Estimates for each predictor.

  • Model Fit:

    • R-squared: 14.51% of the variance in PB2 is explained by predictors.

    • Adjusted R-squared: 10.66%, adjusting for predictors.

  • F-statistic: Model overall is statistically significant (p-value: 0.0002083).

Gender, Ethnic, and Attention_To_Advertisement significantly impact PB2. Other variables lack strong evidence for their relationship with PB2.

Rmodel3

  • Model Equation: Predicts PB4 using predictor variables.

  • Residuals: Spread of differences between predicted and actual values.

  • Coefficients: Estimates for each predictor.

  • Model Fit:

    • R-squared: 8.61% of the variance in PB4 is explained by predictors.

    • Adjusted R-squared: 4.498%, adjusting for predictors.

  • F-statistic: Model overall is statistically significant (p-value: 0.03164).

Ethnic and Attention_To_Advertisement show marginal associations with PB4. Other variables lack strong evidence for their relationship with PB4.

Rmodel4

  • Model Equation: Predicts ATTD4 using predictor variables.

  • Residuals: Spread of differences between predicted and actual values.

  • Coefficients: Estimates for each predictor.

  • Model Fit:

    • R-squared: 16.54% of the variance in ATTD4 is explained by predictors.

    • Adjusted R-squared: 12.79%, adjusting for predictors.

  • F-statistic: Model overall is statistically significant (p-value: 2.877e-05).

Gender, Ethnic, Occupation, and Annual_Income significantly impact ATTD4. Other variables lack strong evidence for their relationship with ATTD4.

Rmodel5

  • Model Equation: Predicts PBC1 using predictor variables.

  • Residuals: Spread of differences between predicted and actual values.

  • Coefficients: Estimates for each predictor.

  • Model Fit:

    • R-squared: 17.58% of the variance in PBC1 is explained by predictors.

    • Adjusted R-squared: 13.87%, adjusting for predictors.

  • F-statistic: Model overall is statistically significant (p-value: 1.004e-05).

Ethnic and Attention_To_Advertisement show significant associations with PBC1. Other variables lack strong evidence for their relationship with PBC1.

Across the five models Rmodel1 to Rmodel5, primary focusing on Ethnicity and Attention to Advertisement:

  • Ethnicity:

    • Consistent Significance: Across all models, Ethnicity emerged as a statistically significant predictor (p < 0.05) for the respective target variables (PB1, PB2, PB4, ATTD4, PBC1).

    • Interpretation: The ethnicity of individuals seems to have a discernible impact on their behavior or perceptions related to the predicted variables. This might suggest cultural or demographic influences shaping responses or attitudes toward the specific contexts represented by the target variables.

  • Attention to Advertisement:

    • Consistent Significance: Similarly, Attention to Advertisement remained consistently significant (p < 0.05) across all models predicting different target variables.

    • Interpretation: This implies that the level of attention or engagement with advertisements significantly affects various aspects or behaviors captured by the predicted variables (PB1, PB2, PB4, ATTD4, PBC1). It might indicate the importance of advertising strategies or marketing tactics in influencing perceptions or behaviors related to these variables.

  • Gender, Reviews and Rating, and Others:

    • Variable Significance Variability: While Gender and Reviews and Rating showed significance in some models, they didn’t consistently maintain significance across all models predicting different variables.

    • Interpretation: This suggests that the impact of Gender or Reviews and Rating might vary depending on the specific target variable under consideration. Other predictors (Age, Occupation, Annual Income, Experience, Average Time Spent) did not consistently exhibit significant impacts across the models. Ethnicity and Attention to Advertisement consistently emerge as influential factors across the diverse predicted variables, suggesting their pivotal role in shaping behaviors or perceptions captured by these models.

7.0 Deployment of Data Product

Data Product

Shiny URL: https://tculm6-wei0qian-lim.shinyapps.io/regression_rmodel2/

Our data product is now deployed on the R Shiny platform, providing SMEs in Malaysia with actionable insights. Upon input submission, the app utilizes Rmodel2.rds from our regression data modeling to analyze the influence of social media on purchasing decisions.It provides businesses with user-friendly interfaces and real-time data visualizations to refine marketing strategies. Our deployment is hosted on the reliable cloud service shinyapps.io, which allows for scalability. We are committed to reproducible research and continuous improvement based on user feedback. Our findings highlight that social media marketing activities and customer experience are essential in influencing consumer behavior.

8.0 Conclusion

Key Findings

  • Consistency: Ethnicity emerges consistently as a significant predictor across multiple models.

  • Attention to Advertisement: Shows consistent significance, highlighting its role in shaping consumer behavior on social media.

Based on the three objectives, it can be conclude that:

  1. Identify Key Factors: Ethnicity and Attention to Advertisement stand out as influential factors shaping consumer behavior.
  2. Understand Social Media Influence: Attention to Advertisement consistently impacts consumer behavior, emphasizing the significance of advertising strategies.
  3. Actionable Insights: Tailoring marketing strategies based on Ethnicity and enhancing advertising engagement can optimize social media marketing efforts.

Recommendations

  • Businesses should prioritize understanding diverse cultural and demographic influences (Ethnicity) and customize strategies accordingly.

  • Investment in effective advertising strategies is crucial, given the consistent significance of Attention to Advertisement.

Limitations

  • Acknowledgment of variable impacts across predictors in different contexts, suggesting the need for further nuanced exploration.

  • Suggestion for complementary qualitative research methods to enhance understanding of consumer perceptions on social media.

Conclusion

The analysis highlights Ethnicity and Attention to Advertisement as pivotal factors in understanding and predicting consumer behavior on social media. These findings provide actionable insights for businesses to refine their social media marketing strategies, emphasizing the importance of cultural relevance and effective advertising approaches.