In: Statistics and Probability
Consider the following data for Simmons store where it is postulated that the categorical variable Y=0,if the customer did not use the coupon and 1,if the customer used the coupon;and X= annual spending at Simmons’s store ($000s) annually. Run a logistic regression model and compute the probability for a customer using a coupon if he/she spends $5 (in $000’s) annually at Simmons store. Examine the output and evaluate the following r squared for the model.
Customer | Annual spending ($000s) | Coupon =0, if not used, 1 if used) |
1 | 2.291 | 0 |
2 | 3.215 | 0 |
3 | 2.135 | 0 |
4 | 3.924 | 1 |
5 | 2.528 | 0 |
6 | 2.473 | 0 |
7 | 2.384 | 0 |
8 | 7.026 | 1 |
9 | 1.182 | 0 |
10 | 3.345 | 1 |
11 | 2.567 | 0 |
12 | 1.892 | 0 |
13 | 3.123 | 1 |
14 | 2.678 | 0 |
15 | 1.789 | 0 |
16 | 3.456 | 1 |
17 | 3.231 | 1 |
18 | 2.456 | 0 |
19 | 3.111 | 1 |
20 | 3.556 | 1 |
21 | 2.875 | 0 |
22 | 2.124 | 0 |
Hey below is the output of logistic regression that I ran using online statistical calculator.
you can also run this in R
code for R
//
x=c(2.291,
3.215,
2.135,
3.924,
2.528,
2.473,
2.384,
7.026,
1.182,
3.345,
2.567,
1.892,
3.123,
2.678,
1.789,
3.456,
3.231,
2.456,
3.111,
3.556,
2.875,
2.124
)
coupon=c(0,
0,
0,
1,
0,
0,
0,
1,
0,
1,
0,
0,
1,
0,
0,
1,
1,
0,
1,
1,
0,
0
)
data1=data.frame(x,coupon)
model = glm(coupon~x,
data = data1,
family = binomial(link="logit"))
summary(model)
//
I hope this helps you
Thanks