The file P17_05.xlsx contains data on 100 consumers who drink beer. Some of them prefer light beer, and others prefer regular beer. A major beer producer believes that the following variables might be useful in discriminating between these two groups: gender, marital status, annual income level, and age. b. Consider a new customer: male, married, income $42,000, age 47. Use the logistic regression equation to estimate the probability that this customer prefers Regular. How would you classify this person?
Individual | Gender | Married | Income | Age | Beer Preference |
1 | 1 | 0 | $37,779 | 45 | Regular |
2 | 0 | 1 | $44,955 | 53 | Regular |
3 | 1 | 0 | $36,896 | 48 | Regular |
4 | 1 | 1 | $70,981 | 45 | Light |
5 | 1 | 0 | $38,990 | 36 | Regular |
6 | 1 | 1 | $51,126 | 41 | Light |
7 | 0 | 1 | $45,133 | 51 | Light |
8 | 1 | 1 | $36,316 | 41 | Light |
9 | 1 | 1 | $40,955 | 69 | Regular |
10 | 0 | 1 | $27,280 | 55 | Regular |
11 | 0 | 1 | $33,027 | 51 | Regular |
12 | 1 | 1 | $63,555 | 62 | Light |
13 | 1 | 1 | $64,709 | 70 | Regular |
14 | 1 | 0 | $38,447 | 37 | Light |
15 | 1 | 1 | $35,282 | 59 | Regular |
16 | 0 | 1 | $43,468 | 52 | Regular |
17 | 1 | 0 | $53,768 | 34 | Light |
18 | 0 | 1 | $52,875 | 71 | Light |
19 | 1 | 0 | $29,728 | 41 | Regular |
20 | 0 | 0 | $30,587 | 36 | Regular |
21 | 0 | 1 | $49,585 | 34 | Light |
22 | 1 | 1 | $48,957 | 33 | Light |
23 | 1 | 1 | $32,739 | 50 | Regular |
24 | 1 | 0 | $41,057 | 40 | Light |
25 | 1 | 0 | $31,916 | 43 | Regular |
26 | 1 | 0 | $29,077 | 39 | Regular |
27 | 1 | 1 | $58,164 | 30 | Light |
28 | 0 | 1 | $30,784 | 52 | Regular |
29 | 1 | 1 | $25,440 | 51 | Regular |
30 | 0 | 0 | $41,779 | 39 | Light |
31 | 0 | 0 | $26,598 | 29 | Light |
32 | 1 | 1 | $30,081 | 56 | Regular |
33 | 1 | 1 | $43,194 | 47 | Light |
34 | 1 | 0 | $22,408 | 40 | Regular |
35 | 1 | 1 | $42,108 | 26 | Light |
36 | 0 | 0 | $40,456 | 42 | Light |
37 | 1 | 1 | $47,797 | 49 | Light |
38 | 1 | 0 | $43,992 | 53 | Light |
39 | 1 | 1 | $41,882 | 54 | Regular |
40 | 1 | 1 | $55,281 | 48 | Light |
41 | 1 | 1 | $47,495 | 35 | Light |
42 | 0 | 0 | $33,088 | 22 | Light |
43 | 0 | 1 | $46,890 | 36 | Light |
44 | 0 | 0 | $35,406 | 29 | Light |
45 | 0 | 1 | $59,485 | 36 | Light |
46 | 1 | 0 | $42,775 | 27 | Light |
47 | 0 | 0 | $28,094 | 39 | Regular |
48 | 1 | 0 | $26,004 | 62 | Regular |
49 | 1 | 0 | $38,671 | 44 | Light |
50 | 0 | 1 | $33,880 | 48 | Regular |
51 | 0 | 0 | $43,593 | 27 | Light |
52 | 0 | 0 | $27,078 | 45 | Regular |
53 | 1 | 0 | $37,926 | 33 | Light |
54 | 1 | 1 | $50,517 | 38 | Light |
55 | 0 | 0 | $39,370 | 28 | Light |
56 | 0 | 0 | $31,398 | 47 | Regular |
57 | 1 | 0 | $29,293 | 43 | Regular |
58 | 1 | 0 | $49,811 | 49 | Regular |
59 | 0 | 0 | $38,453 | 43 | Regular |
60 | 0 | 0 | $31,779 | 46 | Regular |
61 | 0 | 1 | $33,700 | 25 | Light |
62 | 0 | 1 | $37,263 | 49 | Regular |
63 | 0 | 1 | $44,802 | 34 | Light |
64 | 0 | 1 | $35,050 | 36 | Light |
65 | 1 | 1 | $37,606 | 37 | Light |
66 | 1 | 0 | $52,341 | 42 | Light |
67 | 1 | 1 | $45,600 | 50 | Regular |
68 | 1 | 1 | $36,030 | 55 | Regular |
69 | 0 | 1 | $44,558 | 31 | Light |
70 | 1 | 1 | $34,391 | 60 | Regular |
71 | 1 | 1 | $43,741 | 54 | Regular |
72 | 0 | 0 | $36,821 | 32 | Light |
73 | 1 | 1 | $51,578 | 45 | Light |
74 | 1 | 0 | $23,234 | 31 | Regular |
75 | 0 | 1 | $48,259 | 32 | Light |
76 | 0 | 1 | $46,273 | 56 | Light |
77 | 1 | 1 | $42,404 | 30 | Light |
78 | 0 | 0 | $41,391 | 54 | Light |
79 | 0 | 1 | $45,610 | 38 | Light |
80 | 1 | 1 | $47,667 | 87 | Regular |
81 | 1 | 1 | $40,261 | 31 | Light |
82 | 1 | 0 | $46,626 | 46 | Light |
83 | 0 | 1 | $55,608 | 43 | Light |
84 | 1 | 1 | $35,678 | 64 | Regular |
85 | 0 | 0 | $50,154 | 40 | Light |
86 | 1 | 0 | $34,575 | 57 | Regular |
87 | 0 | 0 | $30,841 | 24 | Light |
88 | 1 | 0 | $20,945 | 42 | Regular |
89 | 1 | 0 | $38,176 | 40 | Regular |
90 | 1 | 0 | $28,513 | 34 | Regular |
91 | 0 | 1 | $51,094 | 46 | Regular |
92 | 1 | 1 | $40,582 | 66 | Regular |
93 | 1 | 0 | $32,493 | 63 | Regular |
94 | 0 | 1 | $36,451 | 44 | Regular |
95 | 0 | 1 | $42,051 | 58 | Regular |
96 | 0 | 0 | $26,186 | 38 | Regular |
97 | 1 | 1 | $24,302 | 46 | Regular |
98 | 0 | 0 | $39,923 | 58 | Regular |
99 | 0 | 1 | $39,942 | 21 | Light |
100 | 1 | 0 | $33,553 | 48 | Regular |
a) I have performed the logistic regression in R. Here is the code:
R Code:
beer<-read.csv("beer.csv")
logitmod<-glm(Beer.Preference~Gender + Married + Income + Age,
family="binomial",data = beer)
summary(logitmod)
Output:
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 6.819e-01 1.931e+00 0.353 0.724
Gender 7.779e-01 7.166e-01 1.085 0.278
Married -1.697e-01 7.945e-01 -0.214 0.831
Income -2.785e-04 6.334e-05 -4.396 1.10e-05 ***
B) For prediction, R Code:
person<-data.frame(Gender=1,Married=1,Income=42000,Age=45)
predict(logitmod,person,type="response")
Output: 0.466
As the output is the probability to predict the probability of
Event '1' = 'Regular'. Hence, as p-value<0.5, we can say that
the person prefers Light beer.
Get Answers For Free
Most questions answered within 1 hours.