Load library
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
Read the data
artea<-read.csv("~/Desktop/R/Artea_tran.csv",header=T,sep=',')
Baseline model
# create the linear model
result<-lm(revenue_after~ test_coupon + channel_facebook +channel_instagram +channel_referral +channel_other +num_past_purch +spent_last_purchase +weeks_since_visit +browsing_minutes+shopping_cart,data=artea)
# review the results
summary(result)
##
## Call:
## lm(formula = revenue_after ~ test_coupon + channel_facebook +
## channel_instagram + channel_referral + channel_other + num_past_purch +
## spent_last_purchase + weeks_since_visit + browsing_minutes +
## shopping_cart, data = artea)
##
## Residuals:
## Min 1Q Median 3Q Max
## -74.072 -10.128 -3.944 1.662 219.027
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -2.888538 1.031453 -2.800 0.005123 **
## test_coupon -0.282455 0.609365 -0.464 0.643009
## channel_facebook 6.044806 0.816559 7.403 1.56e-13 ***
## channel_instagram 5.976560 0.730055 8.186 3.39e-16 ***
## channel_referral 6.656827 1.477178 4.506 6.74e-06 ***
## channel_other 8.695892 2.055831 4.230 2.38e-05 ***
## num_past_purch 3.172673 0.131133 24.194 < 2e-16 ***
## spent_last_purchase -0.014413 0.006052 -2.382 0.017279 *
## weeks_since_visit -1.112759 0.134906 -8.248 < 2e-16 ***
## browsing_minutes 0.160609 0.044640 3.598 0.000324 ***
## shopping_cart 9.308647 0.677930 13.731 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 21.53 on 4989 degrees of freedom
## Multiple R-squared: 0.1712, Adjusted R-squared: 0.1695
## F-statistic: 103.1 on 10 and 4989 DF, p-value: < 2.2e-16
# check the residual plot
plot(result$residuals)

comment: customers from diifrent channels are not heterogeneous in response to coupon