This document contains the regression and mediation statistics for the research paper “Social media marketing: Impact of social media marketing activities on consumer perception towards brand loyalty and purchase intention”.
library(readxl)
library(tidyverse)
library(performance)
library(mediation)
library(robmed)
library(car)
library(see)
library(janitor)
setwd("/cloud/project/new_destination_folder")
mdata <- read_excel('RESEARCH QUESTIONNAIRE RESPONSES.xlsx', sheet = 'Constructs')
glimpse(mdata)
## Rows: 366
## Columns: 6
## $ Gender <chr> "Male", "Female", "Female", "Male", "…
## $ Age <chr> "18-25", "Above 25", "18-25", "18-25"…
## $ `PURCHASE INTENTION` <dbl> 4.2, 3.6, 3.4, 1.0, 2.6, 2.2, 4.2, 4.…
## $ `BRAND TRUST` <dbl> 4.166667, 5.000000, 4.166667, 1.00000…
## $ `ONLINE BASED - BRAND COMMUNITY` <dbl> 5.000000, 5.000000, 4.666667, 1.00000…
## $ `BRAND LOYALTY` <dbl> 4.2, 3.6, 4.0, 1.0, 3.2, 4.2, 4.2, 5.…
head(mdata)
## # A tibble: 6 Ă— 6
## Gender Age `PURCHASE INTENTION` `BRAND TRUST` ONLINE BASED - BRAND COMM…¹
## <chr> <chr> <dbl> <dbl> <dbl>
## 1 Male 18-25 4.2 4.17 5
## 2 Female Above 25 3.6 5 5
## 3 Female 18-25 3.4 4.17 4.67
## 4 Male 18-25 1 1 1
## 5 Female 18-25 2.6 3.5 2.67
## 6 Female 18-25 2.2 4.33 2.67
## # ℹ abbreviated name: ¹​`ONLINE BASED - BRAND COMMUNITY`
## # ℹ 1 more variable: `BRAND LOYALTY` <dbl>
tail(mdata)
## # A tibble: 6 Ă— 6
## Gender Age `PURCHASE INTENTION` `BRAND TRUST` ONLINE BASED - BRAND COMM…¹
## <chr> <chr> <dbl> <dbl> <dbl>
## 1 Male 18-25 4 4 4
## 2 Female Above 25 2 4 3.33
## 3 Female 18-25 4.6 4.17 5
## 4 Female 18-25 4 4 4
## 5 Female 18-25 2.4 4.17 3.33
## 6 Female 18-25 5 5 5
## # ℹ abbreviated name: ¹​`ONLINE BASED - BRAND COMMUNITY`
## # ℹ 1 more variable: `BRAND LOYALTY` <dbl>
# Selecting the 4 constructs of interest to be analyzed.
mdata <- mdata %>% clean_names() %>%
dplyr::select(online_based_brand_community, brand_trust, brand_loyalty, purchase_intention) %>%
round(1)
glimpse(mdata)
## Rows: 366
## Columns: 4
## $ online_based_brand_community <dbl> 5.0, 5.0, 4.7, 1.0, 2.7, 2.7, 3.3, 5.0, 4…
## $ brand_trust <dbl> 4.2, 5.0, 4.2, 1.0, 3.5, 4.3, 4.7, 4.8, 4…
## $ brand_loyalty <dbl> 4.2, 3.6, 4.0, 1.0, 3.2, 4.2, 4.2, 5.0, 4…
## $ purchase_intention <dbl> 4.2, 3.6, 3.4, 1.0, 2.6, 2.2, 4.2, 4.8, 4…
head(mdata)
## # A tibble: 6 Ă— 4
## online_based_brand_community brand_trust brand_loyalty purchase_intention
## <dbl> <dbl> <dbl> <dbl>
## 1 5 4.2 4.2 4.2
## 2 5 5 3.6 3.6
## 3 4.7 4.2 4 3.4
## 4 1 1 1 1
## 5 2.7 3.5 3.2 2.6
## 6 2.7 4.3 4.2 2.2
# Based on Barron and Kenny's traditional method, mediation analysis is comprised of three sets of regression, in the case of our analysis: (1) BC → BL, (2) BC → BT, and (3) BC + BT → BL.
# BC (online_based_brand_community)
# BT (brand trust)
# BL (brand loyalty)
# building the 3 regression sets
model.1 <- lm(formula = brand_loyalty ~ online_based_brand_community, data = mdata)
model.2 <- lm(formula = brand_trust ~ online_based_brand_community, data = mdata)
model.3 <- lm(formula = brand_loyalty ~ online_based_brand_community + brand_trust, data = mdata)
# printing the results of the 3 regression sets
summary(model.1)
##
## Call:
## lm(formula = brand_loyalty ~ online_based_brand_community, data = mdata)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.28501 -0.34389 0.05611 0.25739 1.28619
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.67060 0.12230 13.66 <2e-16 ***
## online_based_brand_community 0.61440 0.03016 20.37 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4915 on 364 degrees of freedom
## Multiple R-squared: 0.5328, Adjusted R-squared: 0.5315
## F-statistic: 415 on 1 and 364 DF, p-value: < 2.2e-16
summary(model.2)
##
## Call:
## lm(formula = brand_trust ~ online_based_brand_community, data = mdata)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.7521 -0.3722 0.1177 0.3281 1.3274
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.67359 0.13491 12.40 <2e-16 ***
## online_based_brand_community 0.59966 0.03327 18.03 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5422 on 364 degrees of freedom
## Multiple R-squared: 0.4716, Adjusted R-squared: 0.4702
## F-statistic: 324.9 on 1 and 364 DF, p-value: < 2.2e-16
summary(model.3)
##
## Call:
## lm(formula = brand_loyalty ~ online_based_brand_community + brand_trust,
## data = mdata)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.28308 -0.31151 0.08164 0.24535 1.03113
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.95416 0.12877 7.410 8.95e-13 ***
## online_based_brand_community 0.35769 0.03662 9.767 < 2e-16 ***
## brand_trust 0.42809 0.04194 10.207 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4339 on 363 degrees of freedom
## Multiple R-squared: 0.6369, Adjusted R-squared: 0.6349
## F-statistic: 318.4 on 2 and 363 DF, p-value: < 2.2e-16
# We use the mediate() function from the mediation package to test the relationships between online brand communities, brand trust, and brand loyalty.
mediation <- mediate(model.2, model.3, treat = 'online_based_brand_community',
mediator = 'brand_trust')
summary(mediation)
##
## Causal Mediation Analysis
##
## Quasi-Bayesian Confidence Intervals
##
## Estimate 95% CI Lower 95% CI Upper p-value
## ACME 0.257 0.197 0.32 <2e-16 ***
## ADE 0.358 0.287 0.43 <2e-16 ***
## Total Effect 0.615 0.552 0.67 <2e-16 ***
## Prop. Mediated 0.420 0.327 0.51 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Sample Size Used: 366
##
##
## Simulations: 1000
# The mediation results show that there is a significant direct effect for online brand communities (BC) on brand loyalty (BL) (ADE = 0.358), the results also show that brand trust (BT) acts as a mediator (ACME = 0.256). The p-values are also significant. Next, we will assess the regression model sets that were used for mediation analysis, and see if they respect the normality assumptions.
# The previous regression sets need to meet normality assumptions before accepting the results of the mediation analysis, and in the case of unmet assumptions, alternative solutions need to be considered.
check_model(model.1)
check_model(model.2)
check_model(model.3)
# After checking, the graphs show that some normality assumptions are violated. Notably, the normality of residuals is not achieved in all 3 regression sets.
# So, the alternative solution is to use the robust bootstrapping method outlined by Alfons et al. (2022). This method does not require meeting normality assumptions.
model <- brand_loyalty ~ m(brand_trust) + online_based_brand_community
robust_bootstrap_mediation <- test_mediation(model, data = mdata, robust = TRUE)
summary(robust_bootstrap_mediation)
## Robust bootstrap test for indirect effect via regression
##
## x = online_based_brand_community
## y = brand_loyalty
## m = brand_trust
##
## Sample size: 366
## ---
## Outcome variable: brand_trust
##
## Coefficients:
## Data Boot Std. Error z value Pr(>|z|)
## (Intercept) 0.95671 0.96346 0.33402 2.884 0.00392 **
## online_based_brand_community 0.77818 0.77669 0.07535 10.307 < 2e-16 ***
##
## Robust residual standard error: 0.3962 on 364 degrees of freedom
## Robust R-squared: 0.6941, Adjusted robust R-squared: 0.6933
## Robust F-statistic: 372.4 on 1 and Inf DF, p-value: < 2.2e-16
##
## Robustness weights:
## 19 observations are potential outliers with weight <= 0:
## [1] 13 14 21 35 105 120 121 128 142 212 227 228 235 249 319 334 335 342 356
## ---
## Outcome variable: brand_loyalty
##
## Coefficients:
## Data Boot Std. Error z value Pr(>|z|)
## (Intercept) 0.58439 0.59627 0.16562 3.600 0.000318 ***
## brand_trust 0.47762 0.47743 0.05531 8.632 < 2e-16 ***
## online_based_brand_community 0.40134 0.39863 0.05355 7.444 9.79e-14 ***
##
## Robust residual standard error: 0.3705 on 363 degrees of freedom
## Robust R-squared: 0.7162, Adjusted robust R-squared: 0.7147
## Robust F-statistic: 105.4 on 2 and Inf DF, p-value: < 2.2e-16
##
## Robustness weights:
## 4 observations are potential outliers with weight <= 0:
## [1] 2 109 216 323
## ---
## Total effect of x on y:
## Data Boot Std. Error z value Pr(>|z|)
## online_based_brand_community 0.77302 0.77015 0.05691 13.53 <2e-16 ***
##
## Direct effect of x on y:
## Data Boot Std. Error z value Pr(>|z|)
## online_based_brand_community 0.40134 0.39863 0.05355 7.444 9.79e-14 ***
##
## Indirect effect of x on y:
## Data Boot Lower Upper
## brand_trust 0.3717 0.3715 0.2645 0.5006
## ---
## Level of confidence: 95 %
##
## Number of bootstrap replicates: 5000
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Now we can see that the effects are even stronger after bootstrapping, the coefficient for the direct effect of online brand communities (BC) on brand loyalty (BL) is 0.77302, and the coefficient for the indirect effect with brand trust (BT) as a mediator is 0.3699. Next, we will assess the effect of brand loyalty (BL) on purchase intention (PI) using a simple linear regression model.
# We check the effect of brand loyalty on purchase intention with simple linear regression, and also check if the model respects normality assumptions. If it doesn't, we will use bootstrapping for regression analysis.
model.4 <- lm(formula = purchase_intention ~ brand_loyalty, data = mdata)
summary(model.4)
##
## Call:
## lm(formula = purchase_intention ~ brand_loyalty, data = mdata)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.2132 -0.4622 0.2136 0.6136 1.3690
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.39086 0.24920 -1.568 0.118
## brand_loyalty 0.95546 0.05978 15.983 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.8201 on 364 degrees of freedom
## Multiple R-squared: 0.4124, Adjusted R-squared: 0.4108
## F-statistic: 255.5 on 1 and 364 DF, p-value: < 2.2e-16
check_model(model.4)
# Again, the residual distribution is far from normal as the dots do not fall along the line. So next we will use robust bootstrapped regression.
robust_bootstrap_regression <- Boot(model.4, R = 5000)
summary(robust_bootstrap_regression)
##
## Number of bootstrap replications R = 5000
## original bootBias bootSE bootMed
## (Intercept) -0.39086 -0.00512936 0.187725 -0.38913
## brand_loyalty 0.95546 0.00099834 0.044735 0.95503
confint(robust_bootstrap_regression)
## Bootstrap bca confidence intervals
##
## 2.5 % 97.5 %
## (Intercept) -0.7703792 -0.04368293
## brand_loyalty 0.8704768 1.04672668
# The bootstrapped linear regression result is similar to that of the simple linear regression. Brand loyalty has a significant effect on purchase intention with a coefficient of 0.95546.
Note: the 95% confidence intervals for the coefficients may not be symmetrical because the data isn’t perfectly normal.