Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A survey asked students at a university to suppose they were going to have a lar

ID: 3175246 • Letter: A

Question

A survey asked students at a university to suppose they were going to have a large two-topping pizza delivered to their residence. Then they were asked to select from either pizzeria A or another pizzeria of their choice. The price they would have to pay to get a pizza from pizzeria A varied between $8.49, $10.49, and $12.49 on the surveys. The data available below contain the responses from 25 students. The dependent variable for this study is whether or not a student will select pizzeria A (1 = selected pizzeria A, 0 = selected another pizzeria). Possible independent variables are the price and the gender of the student (1 = female, 0 = male). Complete parts (a) through (d) below.

a. Use technology to develop a logistic regression model to predict the probability that a student selects pizzeria A based on the price (X1). Is price an important indicator of pizzeria selection?

What is the logistic regression model?

Deviance statistic?

P Value for deviance statistic?

Wald statistic for X1?

P Value for Wald statstic?

b. Use technology to develop a logistic regression model to predict the probability that a student selects pizzeria A based on the price (X1) and the gender of the student (X2). Determine if price and gender are important indicators of pizzeria selection.

Use technology to find the logistic regression model, rounding to two decimal places.

Gender Price Pizzeria_A 1 8.49 1 1 8.49 1 0 10.49 1 0 12.49 0 1 8.49 1 0 12.49 1 1 10.49 0 1 8.49 1 0 12.49 0 1 8.49 0 0 10.49 1 1 8.49 1 0 12.49 0 0 8.49 1 1 12.49 0 0 10.49 0 1 8.49 1 0 10.49 1 1 12.49 0 1 10.49 1 0 12.49 0 1 10.49 0 0 8.49 1 0 12.49 0 1 10.49 1

Explanation / Answer

We shall perform the analysis in the open statisitical package R

The complete snippet is as follows

# read the data into R dataframe
data.df<- read.csv("C:\Users\586645\Downloads\Chegg\pizza.csv",header=TRUE)
str(data.df)


# fit the model Only with Price- logistic
model <- glm(Pizzeria_A ~ Price,family=binomial(link='logit'),data=data.df)

summary(model)


# fit the model - logistic
model1 <- glm(Pizzeria_A ~.,family=binomial(link='logit'),data=data.df)

summary(model1)

The results are

> summary(model)

Call:
glm(formula = Pizzeria_A ~ Price, family = binomial(link = "logit"),
data = data.df)

Deviance Residuals:
Min 1Q Median 3Q Max
-2.2017 -0.5708 0.4307 0.4307 1.9467

Coefficients:
Estimate Std. Error z value Pr(>|z|)   
(Intercept) 10.9546 4.0871 2.680 0.00736 **
Price -1.0157 0.3807 -2.668 0.00763 ** # as the p value is less than 0.05 , hence the price is signifcant in explaining the variation
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 34.296 on 24 degrees of freedom
Residual deviance: 23.072 on 23 degrees of freedom
AIC: 27.072

Number of Fisher Scoring iterations: 4

> model1 <- glm(Pizzeria_A ~.,family=binomial(link='logit'),data=data.df)
> summary(model1)

Call:
glm(formula = Pizzeria_A ~ ., family = binomial(link = "logit"),
data = data.df)

Deviance Residuals:
Min 1Q Median 3Q Max
-2.1239 -0.6383 0.2376 0.4706 1.8391

Coefficients:
Estimate Std. Error z value Pr(>|z|)   
(Intercept) 14.2512 5.4811 2.600 0.00932 **
Gender -1.4082 1.3236 -1.064 0.28738 # as p value of gender is not less than 0.05 , hence gender isnt significant
Price -1.2601 0.4732 -2.663 0.00775 ** ## as the p value is less than 0.05 , hence Price is significant in explaining the variation
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 34.296 on 24 degrees of freedom
Residual deviance: 21.775 on 22 degrees of freedom
AIC: 27.775

Number of Fisher Scoring iterations: 5

we get the wald statistics as

> library(survey)
> regTermTest(model, "Price")
Wald test for Price
in glm(formula = Pizzeria_A ~ Price, family = binomial(link = "logit"),
data = data.df)
F = 7.119481 on 1 and 23 df: p= 0.013732
> regTermTest(model1, "Price")
Wald test for Price
in glm(formula = Pizzeria_A ~ ., family = binomial(link = "logit"),
data = data.df)
F = 7.089806 on 1 and 22 df: p= 0.014219
> regTermTest(model1, "Gender")
Wald test for Gender
in glm(formula = Pizzeria_A ~ ., family = binomial(link = "logit"),
data = data.df)
F = 1.131851 on 1 and 22 df: p= 0.29892

The p values are generated as a part of the result along with the statistics

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote