Consumer behavior is important to any business firm that wishes to sell goods or services to consumers. Research on consumer behavior helps firms to understand which type of customers are more likely to buy their products. Identifying target market is the key to achieving sales objectives.
Black Friday is one of the biggest shopping day of the year in United States. Companies strive for insights into consumer on this day. Understanding which group of people buy what is extremely important for firms in order to maximize profit. In this assignment, I will study a dataset published by ABC retail company on kaggle.com. I will build an ordered logit model that predicts the total purchase amount of customers during Black Friday sales across various demographic characteristics of customers.
Importing Necessary Packages
library(Zelig)
library(ZeligChoice)
## Warning: package 'ZeligChoice' was built under R version 3.5.3
library(faraway)
## Warning: package 'faraway' was built under R version 3.5.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.5.3
library(tidyr)
library(survival)
Importing and Previewing Dataset
library(readr)
BF3 <- read_csv("C:/Users/Nusrat/Desktop/MA - 3rd semester, Spring 19/SOC 712 - Advanced Analytics (R)/Assignment 7 - Ordered Logit Model/BF3.csv")
## Parsed with column specification:
## cols(
## User_ID = col_double(),
## Product_ID = col_character(),
## Gender = col_character(),
## GenderOrd = col_double(),
## Age = col_character(),
## Occupation = col_double(),
## City_Category = col_character(),
## Stay_In_Current_City_Years = col_character(),
## Marital_Status = col_double(),
## Product_Category_1 = col_double(),
## Product_Category_2 = col_double(),
## Product_Category_3 = col_double(),
## Purchase = col_double(),
## PGrp = col_character(),
## POrd = col_double(),
## Max = col_double(),
## Min = col_double()
## )
head(BF3)
## # A tibble: 6 x 17
## User_ID Product_ID Gender GenderOrd Age Occupation City_Category
## <dbl> <chr> <chr> <dbl> <chr> <dbl> <chr>
## 1 1000001 P00069042 F 1 0-17 10 A
## 2 1000001 P00248942 F 1 0-17 10 A
## 3 1000001 P00087842 F 1 0-17 10 A
## 4 1000001 P00085442 F 1 0-17 10 A
## 5 1000002 P00285442 M 0 55+ 16 C
## 6 1000003 P00193542 M 0 26-35 15 A
## # ... with 10 more variables: Stay_In_Current_City_Years <chr>,
## # Marital_Status <dbl>, Product_Category_1 <dbl>,
## # Product_Category_2 <dbl>, Product_Category_3 <dbl>, Purchase <dbl>,
## # PGrp <chr>, POrd <dbl>, Max <dbl>, Min <dbl>
Ordering the Dependent Variable
BF3$POrd <- factor(BF3$POrd, ordered = TRUE,
levels = c(1, 2, 3))
BF3$POrd <- as.factor(BF3$POrd)
BF3$GenderOrd <- as.factor(BF3$GenderOrd)
BF3$Occupation <- as.factor(BF3$Occupation)
Generating a Simple Ordered Logit Model with Gender and Age
z.ord <- zelig(POrd ~ GenderOrd + Age, model = "ologit", data = BF3, cite = F)
summary(z.ord)
## Model:
## Call:
## z5$zelig(formula = POrd ~ GenderOrd + Age, data = BF3)
##
## Coefficients:
## Value Std. Error t value
## GenderOrd1 -0.29082 0.01655 -17.5669
## Age18-25 0.08946 0.04713 1.8983
## Age26-35 0.11260 0.04557 2.4707
## Age36-45 0.12028 0.04691 2.5641
## Age46-50 0.08992 0.05051 1.7801
## Age51-55 0.17342 0.05162 3.3597
## Age55+ 0.02347 0.05681 0.4132
##
## Intercepts:
## Value Std. Error t value
## 1|2 -2.5705 0.0460 -55.8230
## 2|3 0.6825 0.0446 15.3188
##
## Residual Deviance: 137808.43
## AIC: 137826.43
## Next step: Use 'setx' method
Adding Explanatory Variables: Marital Status and Occupation
z.ord1 <- zelig(POrd ~ GenderOrd + Age + Marital_Status + Occupation, model = "ologit", data = BF3, cite = F)
summary(z.ord1)
## Model:
## Call:
## z5$zelig(formula = POrd ~ GenderOrd + Age + Marital_Status +
## Occupation, data = BF3)
##
## Coefficients:
## Value Std. Error t value
## GenderOrd1 -0.264843 0.01721 -15.39175
## Age18-25 0.072133 0.07269 0.99232
## Age26-35 0.081009 0.07245 1.11806
## Age36-45 0.079897 0.07355 1.08634
## Age46-50 0.052777 0.07659 0.68908
## Age51-55 0.143739 0.07745 1.85593
## Age55+ -0.003116 0.08169 -0.03815
## Marital_Status 0.006384 0.01534 0.41606
## Occupation1 -0.043782 0.03143 -1.39320
## Occupation2 -0.081817 0.03801 -2.15225
## Occupation3 0.112172 0.04390 2.55503
## Occupation4 0.044253 0.03009 1.47058
## Occupation5 0.127290 0.05225 2.43631
## Occupation6 0.109498 0.04241 2.58201
## Occupation7 0.097141 0.02966 3.27523
## Occupation8 0.310416 0.13508 2.29809
## Occupation9 0.062940 0.07032 0.89511
## Occupation10 0.031197 0.07810 0.39942
## Occupation11 -0.102965 0.05322 -1.93475
## Occupation12 0.206327 0.03573 5.77432
## Occupation13 0.017991 0.06647 0.27065
## Occupation14 0.110327 0.03732 2.95657
## Occupation15 0.136477 0.05054 2.70014
## Occupation16 0.093895 0.03881 2.41921
## Occupation17 0.245462 0.03283 7.47667
## Occupation18 0.066849 0.06701 0.99753
## Occupation19 -0.106345 0.06140 -1.73193
## Occupation20 -0.189187 0.03524 -5.36798
##
## Intercepts:
## Value Std. Error t value
## 1|2 -2.5473 0.0733 -34.7298
## 2|3 0.7124 0.0724 9.8357
##
## Residual Deviance: 137577.54
## AIC: 137637.54
## Next step: Use 'setx' method
z.ord2 <- zelig(POrd ~ Age + GenderOrd*Marital_Status + Occupation, model="ologit", data = BF3, cite = F)
summary (z.ord2)
## Model:
## Call:
## z5$zelig(formula = POrd ~ Age + GenderOrd * Marital_Status +
## Occupation, data = BF3)
##
## Coefficients:
## Value Std. Error t value
## Age18-25 0.0707409 0.07271 0.97292
## Age26-35 0.0802250 0.07246 1.10714
## Age36-45 0.0793611 0.07355 1.07902
## Age46-50 0.0514598 0.07661 0.67175
## Age51-55 0.1439014 0.07745 1.85802
## Age55+ -0.0032361 0.08169 -0.03961
## GenderOrd1 -0.2770080 0.02226 -12.44563
## Marital_Status -0.0006649 0.01739 -0.03824
## Occupation1 -0.0436716 0.03143 -1.38966
## Occupation2 -0.0819282 0.03801 -2.15519
## Occupation3 0.1122089 0.04390 2.55588
## Occupation4 0.0452005 0.03011 1.50108
## Occupation5 0.1275923 0.05225 2.44200
## Occupation6 0.1090343 0.04241 2.57089
## Occupation7 0.0970813 0.02966 3.27325
## Occupation8 0.3145064 0.13517 2.32682
## Occupation9 0.0623718 0.07032 0.88698
## Occupation10 0.0317102 0.07811 0.40598
## Occupation11 -0.1029961 0.05322 -1.93532
## Occupation12 0.2068237 0.03574 5.78745
## Occupation13 0.0167740 0.06649 0.25229
## Occupation14 0.1100187 0.03732 2.94818
## Occupation15 0.1359760 0.05055 2.69009
## Occupation16 0.0931203 0.03882 2.39862
## Occupation17 0.2451802 0.03283 7.46776
## Occupation18 0.0671771 0.06702 1.00241
## Occupation19 -0.1070537 0.06141 -1.74327
## Occupation20 -0.1896652 0.03525 -5.38087
## GenderOrd1:Marital_Status 0.0289876 0.03362 0.86229
##
## Intercepts:
## Value Std. Error t value
## 1|2 -2.5509 0.0735 -34.7213
## 2|3 0.7088 0.0725 9.7692
##
## Residual Deviance: 137576.79
## AIC: 137638.79
## Next step: Use 'setx' method
z.ord3 <- zelig(POrd ~ Age + GenderOrd*Occupation + Marital_Status, model="ologit", data = BF3, cite = F)
summary (z.ord3)
## Model:
## Call:
## z5$zelig(formula = POrd ~ Age + GenderOrd * Occupation + Marital_Status,
## data = BF3)
##
## Coefficients:
## Value Std. Error t value
## Age18-25 0.058585 0.07321 0.80020
## Age26-35 0.064317 0.07293 0.88191
## Age36-45 0.063891 0.07405 0.86287
## Age46-50 0.038068 0.07705 0.49409
## Age51-55 0.128378 0.07795 1.64697
## Age55+ -0.013617 0.08217 -0.16572
## GenderOrd1 -0.224750 0.04549 -4.94117
## Occupation1 -0.049037 0.03836 -1.27833
## Occupation2 -0.040495 0.04547 -0.89062
## Occupation3 0.048130 0.05724 0.84079
## Occupation4 0.075167 0.03393 2.21517
## Occupation5 0.170359 0.05844 2.91513
## Occupation6 0.023113 0.05288 0.43711
## Occupation7 0.099328 0.03329 2.98351
## Occupation8 0.241493 0.15368 1.57138
## Occupation9 0.233773 0.21326 1.09618
## Occupation10 0.077152 0.08284 0.93132
## Occupation11 -0.142779 0.05821 -2.45282
## Occupation12 0.224468 0.03888 5.77401
## Occupation13 0.079843 0.07291 1.09504
## Occupation14 0.162099 0.04313 3.75851
## Occupation15 0.125157 0.05619 2.22720
## Occupation16 0.112045 0.04288 2.61311
## Occupation17 0.252888 0.03571 7.08145
## Occupation18 0.075951 0.06866 1.10616
## Occupation19 -0.157096 0.07028 -2.23515
## Occupation20 -0.154817 0.04081 -3.79383
## Marital_Status 0.006231 0.01541 0.40423
## GenderOrd1:Occupation1 0.001285 0.06727 0.01911
## GenderOrd1:Occupation2 -0.136524 0.08308 -1.64333
## GenderOrd1:Occupation3 0.128135 0.09060 1.41434
## GenderOrd1:Occupation4 -0.132292 0.06472 -2.04401
## GenderOrd1:Occupation5 -0.206913 0.13112 -1.57805
## GenderOrd1:Occupation6 0.211372 0.08846 2.38933
## GenderOrd1:Occupation7 0.012417 0.07373 0.16841
## GenderOrd1:Occupation8 0.311598 0.32249 0.96622
## GenderOrd1:Occupation9 -0.217617 0.22756 -0.95630
## GenderOrd1:Occupation10 -0.205089 0.11509 -1.78193
## GenderOrd1:Occupation11 0.307737 0.14563 2.11320
## GenderOrd1:Occupation12 -0.108175 0.10578 -1.02261
## GenderOrd1:Occupation13 -0.325266 0.15542 -2.09281
## GenderOrd1:Occupation14 -0.203997 0.08596 -2.37312
## GenderOrd1:Occupation15 0.085104 0.12915 0.65897
## GenderOrd1:Occupation16 -0.089685 0.10146 -0.88394
## GenderOrd1:Occupation17 -0.004371 0.09982 -0.04379
## GenderOrd1:Occupation18 0.019901 0.41837 0.04757
## GenderOrd1:Occupation19 0.217841 0.14395 1.51332
## GenderOrd1:Occupation20 -0.133007 0.08056 -1.65094
##
## Intercepts:
## Value Std. Error t value
## 1|2 -2.5538 0.0748 -34.1505
## 2|3 0.7077 0.0739 9.5797
##
## Residual Deviance: 137525.01
## AIC: 137625.01
## Next step: Use 'setx' method
library(texreg)
## Warning: package 'texreg' was built under R version 3.5.3
## Version: 1.36.23
## Date: 2017-03-03
## Author: Philip Leifeld (University of Glasgow)
##
## Please cite the JSS article in your publications -- see citation("texreg").
##
## Attaching package: 'texreg'
## The following object is masked from 'package:tidyr':
##
## extract
htmlreg(list(z.ord,z.ord1,z.ord2,z.ord3),doctype = FALSE)
| Model 1 | Model 2 | Model 3 | Model 4 | ||
|---|---|---|---|---|---|
| GenderOrd1 | -0.29*** | -0.26*** | -0.28*** | -0.22*** | |
| (0.02) | (0.02) | (0.02) | (0.05) | ||
| Age18-25 | 0.09 | 0.07 | 0.07 | 0.06 | |
| (0.05) | (0.07) | (0.07) | (0.07) | ||
| Age26-35 | 0.11* | 0.08 | 0.08 | 0.06 | |
| (0.05) | (0.07) | (0.07) | (0.07) | ||
| Age36-45 | 0.12* | 0.08 | 0.08 | 0.06 | |
| (0.05) | (0.07) | (0.07) | (0.07) | ||
| Age46-50 | 0.09 | 0.05 | 0.05 | 0.04 | |
| (0.05) | (0.08) | (0.08) | (0.08) | ||
| Age51-55 | 0.17*** | 0.14 | 0.14 | 0.13 | |
| (0.05) | (0.08) | (0.08) | (0.08) | ||
| Age55+ | 0.02 | -0.00 | -0.00 | -0.01 | |
| (0.06) | (0.08) | (0.08) | (0.08) | ||
| Marital_Status | 0.01 | -0.00 | 0.01 | ||
| (0.02) | (0.02) | (0.02) | |||
| Occupation1 | -0.04 | -0.04 | -0.05 | ||
| (0.03) | (0.03) | (0.04) | |||
| Occupation2 | -0.08* | -0.08* | -0.04 | ||
| (0.04) | (0.04) | (0.05) | |||
| Occupation3 | 0.11* | 0.11* | 0.05 | ||
| (0.04) | (0.04) | (0.06) | |||
| Occupation4 | 0.04 | 0.05 | 0.08* | ||
| (0.03) | (0.03) | (0.03) | |||
| Occupation5 | 0.13* | 0.13* | 0.17** | ||
| (0.05) | (0.05) | (0.06) | |||
| Occupation6 | 0.11** | 0.11* | 0.02 | ||
| (0.04) | (0.04) | (0.05) | |||
| Occupation7 | 0.10** | 0.10** | 0.10** | ||
| (0.03) | (0.03) | (0.03) | |||
| Occupation8 | 0.31* | 0.31* | 0.24 | ||
| (0.14) | (0.14) | (0.15) | |||
| Occupation9 | 0.06 | 0.06 | 0.23 | ||
| (0.07) | (0.07) | (0.21) | |||
| Occupation10 | 0.03 | 0.03 | 0.08 | ||
| (0.08) | (0.08) | (0.08) | |||
| Occupation11 | -0.10 | -0.10 | -0.14* | ||
| (0.05) | (0.05) | (0.06) | |||
| Occupation12 | 0.21*** | 0.21*** | 0.22*** | ||
| (0.04) | (0.04) | (0.04) | |||
| Occupation13 | 0.02 | 0.02 | 0.08 | ||
| (0.07) | (0.07) | (0.07) | |||
| Occupation14 | 0.11** | 0.11** | 0.16*** | ||
| (0.04) | (0.04) | (0.04) | |||
| Occupation15 | 0.14** | 0.14** | 0.13* | ||
| (0.05) | (0.05) | (0.06) | |||
| Occupation16 | 0.09* | 0.09* | 0.11** | ||
| (0.04) | (0.04) | (0.04) | |||
| Occupation17 | 0.25*** | 0.25*** | 0.25*** | ||
| (0.03) | (0.03) | (0.04) | |||
| Occupation18 | 0.07 | 0.07 | 0.08 | ||
| (0.07) | (0.07) | (0.07) | |||
| Occupation19 | -0.11 | -0.11 | -0.16* | ||
| (0.06) | (0.06) | (0.07) | |||
| Occupation20 | -0.19*** | -0.19*** | -0.15*** | ||
| (0.04) | (0.04) | (0.04) | |||
| GenderOrd1:Marital_Status | 0.03 | ||||
| (0.03) | |||||
| GenderOrd1:Occupation1 | 0.00 | ||||
| (0.07) | |||||
| GenderOrd1:Occupation2 | -0.14 | ||||
| (0.08) | |||||
| GenderOrd1:Occupation3 | 0.13 | ||||
| (0.09) | |||||
| GenderOrd1:Occupation4 | -0.13* | ||||
| (0.06) | |||||
| GenderOrd1:Occupation5 | -0.21 | ||||
| (0.13) | |||||
| GenderOrd1:Occupation6 | 0.21* | ||||
| (0.09) | |||||
| GenderOrd1:Occupation7 | 0.01 | ||||
| (0.07) | |||||
| GenderOrd1:Occupation8 | 0.31 | ||||
| (0.32) | |||||
| GenderOrd1:Occupation9 | -0.22 | ||||
| (0.23) | |||||
| GenderOrd1:Occupation10 | -0.21 | ||||
| (0.12) | |||||
| GenderOrd1:Occupation11 | 0.31* | ||||
| (0.15) | |||||
| GenderOrd1:Occupation12 | -0.11 | ||||
| (0.11) | |||||
| GenderOrd1:Occupation13 | -0.33* | ||||
| (0.16) | |||||
| GenderOrd1:Occupation14 | -0.20* | ||||
| (0.09) | |||||
| GenderOrd1:Occupation15 | 0.09 | ||||
| (0.13) | |||||
| GenderOrd1:Occupation16 | -0.09 | ||||
| (0.10) | |||||
| GenderOrd1:Occupation17 | -0.00 | ||||
| (0.10) | |||||
| GenderOrd1:Occupation18 | 0.02 | ||||
| (0.42) | |||||
| GenderOrd1:Occupation19 | 0.22 | ||||
| (0.14) | |||||
| GenderOrd1:Occupation20 | -0.13 | ||||
| (0.08) | |||||
| AIC | 137826.43 | 137637.54 | 137638.79 | 137625.01 | |
| BIC | 137910.03 | 137916.17 | 137926.72 | 138089.41 | |
| Log Likelihood | -68904.22 | -68788.77 | -68788.40 | -68762.51 | |
| Deviance | 137808.43 | 137577.54 | 137576.79 | 137525.01 | |
| Num. obs. | 79854 | 79854 | 79854 | 79854 | |
| p < 0.001, p < 0.01, p < 0.05 | |||||
The table above suggest that Model 3 is the best fit for the current dataset. The AIC is lowest for this model, at 137625.01.
library(ggplot2)
##
## Attaching package: 'ggplot2'
## The following object is masked from 'package:Zelig':
##
## stat
ggplot(data = BF3, aes(x=POrd, y=Age, fill=Age))+
geom_bar(stat = "identity")+
xlab("Purchase Group Low Purchase Group Medium Purchase Group High")+
ylab("Age")+
theme(axis.text.x = element_blank())+
theme(legend.position = "right")
The bar plot of purchase groups by age suggest that majority customers spent between $3000 and $10000. Customers with the highest frequency was twenty-six to thirty-five years old. The next largest group was customers between thirty-six and forty-five years old. Therefore, it can be said that primary customers of that Black Friday sale was middle-aged. On the other hand, compared to others, those aging over fifty-five years came for the sale the lowest.
library(ggplot2)
ggplot(data = BF3, aes(x=POrd, y=Gender, fill=Gender))+
geom_bar(stat = "identity")+
xlab("Purchase Group Low Purchase Group Medium Purchase Group High")+
ylab("Gender")+
theme(axis.text.x = element_blank())+
theme(legend.position = "right")
The bar plot of purchase groups by gender suggest that there were male customers more than female customers.Therefore, male were the primary customers of that sale.
z.ord6 <- zelig(as.factor(POrd) ~ GenderOrd + Marital_Status + Occupation, model="ologit", data = BF3, cite = F)
x.out <- setx(z.ord6)
s.ord <- sim(z.ord6, x = x.out)
summary(s.ord)
##
## sim x :
## -----
## ev
## mean sd 50% 2.5% 97.5%
## 1 0.0647996 0.00139243 0.06480828 0.0619690 0.06741233
## 2 0.5789302 0.01611074 0.57819446 0.5473042 0.60969892
## 3 0.3562702 0.01641772 0.35706555 0.3252152 0.38854174
## pv
## mean sd 50% 2.5% 97.5%
## [1,] 2.296 0.5785488 2 1 3
I ran my model through simulation after setting the values for gender, marital Status and occupation to their mode to control for any bias that may be present in the model.
z.ord6 <- zelig(as.factor(POrd) ~ GenderOrd + Marital_Status + Occupation, model = "ologit", data = BF3)
## How to cite this model in Zelig:
## William N. Venables, and Brian D. Ripley. 2011.
## ologit: Ordinal Logit Regression for Ordered Categorical Dependent Variables
## in Christine Choirat, Christopher Gandrud, James Honaker, Kosuke Imai, Gary King, and Olivia Lau,
## "Zelig: Everyone's Statistical Software," http://zeligproject.org/
x.male <- setx(z.ord6, GenderOrd = 0)
x.female <- setx(z.ord6, GenderOrd = 1)
s.ord2<- sim(z.ord6, x = x.male, x1 = x.female)
fd <- s.ord2$get_qi(xvalue="x1", qi="fd")
summary(fd)
## 1 2 3
## Min. :0.01395 Min. :0.03065 Min. :-0.07241
## 1st Qu.:0.01713 1st Qu.:0.03796 1st Qu.:-0.06109
## Median :0.01807 Median :0.04041 Median :-0.05841
## Mean :0.01806 Mean :0.04020 Mean :-0.05826
## 3rd Qu.:0.01896 3rd Qu.:0.04228 3rd Qu.:-0.05524
## Max. :0.02298 Max. :0.05015 Max. :-0.04555
The analysis above shows the difference between male and female customers across three purchase groups. It suggests that the biggest difference (-0.058) is among customers who purchased products worth more than $10,000 in total. Female customers spent 0.058 lower than male customers. The lowest difference (0.018) is among customers who spent less than $3000.
Unmarried Customers
z.mstat0 <- zelig(as.factor(POrd) ~ GenderOrd + Marital_Status + Occupation, model = "ologit", data = BF3)
## How to cite this model in Zelig:
## William N. Venables, and Brian D. Ripley. 2011.
## ologit: Ordinal Logit Regression for Ordered Categorical Dependent Variables
## in Christine Choirat, Christopher Gandrud, James Honaker, Kosuke Imai, Gary King, and Olivia Lau,
## "Zelig: Everyone's Statistical Software," http://zeligproject.org/
z.mstat0$setx(GenderOrd = 0, Marital_Status = 0)
z.mstat0$setx1(GenderOrd = 1, Marital_Status = 0)
z.mstat0$sim()
summary(z.mstat0)
##
## sim x :
## -----
## ev
## mean sd 50% 2.5% 97.5%
## 1 0.06512638 0.001420975 0.06511903 0.06221009 0.06790774
## 2 0.57936230 0.016586370 0.58028003 0.54729054 0.61116989
## 3 0.35551132 0.016995627 0.35429743 0.32371678 0.38878381
## pv
## mean sd 50% 2.5% 97.5%
## [1,] 2.273 0.5803515 2 1 3
##
## sim x1 :
## -----
## ev
## mean sd 50% 2.5% 97.5%
## 1 0.08335178 0.001944278 0.08330399 0.0795218 0.08707495
## 2 0.61952686 0.014657948 0.62042720 0.5912197 0.64721558
## 3 0.29712136 0.015008771 0.29624360 0.2694375 0.32595701
## pv
## mean sd 50% 2.5% 97.5%
## [1,] 2.223 0.5861865 2 1 3
## fd
## mean sd 50% 2.5% 97.5%
## 1 0.01822540 0.001277407 0.01817282 0.01579199 0.02078597
## 2 0.04016457 0.003170148 0.04016657 0.03393377 0.04650723
## 3 -0.05838997 0.004228668 -0.05831769 -0.06654412 -0.05010871
Married Customers
z.mstat1 <- zelig(as.factor(POrd) ~ GenderOrd + Marital_Status + Occupation, model = "ologit", data = BF3)
## How to cite this model in Zelig:
## William N. Venables, and Brian D. Ripley. 2011.
## ologit: Ordinal Logit Regression for Ordered Categorical Dependent Variables
## in Christine Choirat, Christopher Gandrud, James Honaker, Kosuke Imai, Gary King, and Olivia Lau,
## "Zelig: Everyone's Statistical Software," http://zeligproject.org/
z.mstat1$setx(GenderOrd = 0, Marital_Status = 1)
z.mstat1$setx1(GenderOrd = 1, Marital_Status = 1)
z.mstat1$sim()
summary(z.mstat1)
##
## sim x :
## -----
## ev
## mean sd 50% 2.5% 97.5%
## 1 0.06443428 0.001542907 0.06445433 0.06157184 0.06740231
## 2 0.57777158 0.016144042 0.57751468 0.54691520 0.60875720
## 3 0.35779414 0.016410133 0.35781220 0.32631837 0.38958652
## pv
## mean sd 50% 2.5% 97.5%
## [1,] 2.296 0.5819989 2 1 3
##
## sim x1 :
## -----
## ev
## mean sd 50% 2.5% 97.5%
## 1 0.08245299 0.002064834 0.08247503 0.07851004 0.08661061
## 2 0.61826516 0.014336197 0.61824590 0.59085916 0.64640816
## 3 0.29928185 0.014503940 0.29906280 0.27127154 0.32698936
## pv
## mean sd 50% 2.5% 97.5%
## [1,] 2.237 0.5684665 2 1 3
## fd
## mean sd 50% 2.5% 97.5%
## 1 0.01801871 0.001263015 0.01801109 0.01559557 0.02055291
## 2 0.04049358 0.003126770 0.04048498 0.03440653 0.04693858
## 3 -0.05851229 0.004182859 -0.05847104 -0.06756095 -0.05060464
The analysis of difference in difference suggest that mean gender difference of total spending among “unmarried” people is -0.058, i.e. unmarried female customers spent 0.058 less than unmarried male customers, on average. Mean gender difference of spending among “married” people is -0.058, i.e. married female customers spent 0.058 less than married male customers, on average. Although there is a difference in mean expected value among married and unmarried customers across gender, the value of first difference is the same. Hence, it can be concluded that there is no difference in total purchase of goods among married and unmarried consumers based on their gender. Perhaps firms can target customers who are male and in their mid-twenties to mid-forties in order to maximize sales revenue during black friday sale.