Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
STAT 311
Please complete the following problems and submit a file named STAT311-HW8 .R to Gradescope. You should start from the provided STAT311-HW8 .R file on Canvas.
Overview
Address each of the following questions. As always, you should start from the provided skeleton code. Each question should utilize the model associated with the question group.
All questions here utilize the Berkeley acceptance data in BerkeleyData .csv.
Students who intend to use the predict( . . .) function for these problems are advised to consult the docu- mentation in ?predict .glm to determine how it is used for different types of predictions in the context of logistic regression.
Note for autograder: When fitting models, you must fit using the format glm(var1~var2+ . . . , data=BerkeleyData); do not rename variables in the data frame.
Question 1 - (7 points total, 1 hidden)
Fit a logistic regression model that predicts acceptance based on the sex of the applicant. Save the model as model.q1
a) What are the log-odds of being accepted for a male applicant? Save your answer in the variable q 1 .a
b) What are the odds of being accepted for a female applicant? Save your answer in the variable q1 .b
c) What is the probability of being accepted for a male applicant? Save your answer in the variable q1 .c
d) What is the probability of being accepted for a female applicant? Save your answer in the variable q1 .d
e) (Hidden answer) Based on this model, without considering other variables, does it appear that there is a statistically significant gender disparity in the admissions of Berkeley? Answer TRUE or FALSE. Save your answer in the variable q1 .e
Question 2 - (10 points total, 3 hidden)
Fit a logistic regression model that predicts acceptance based on the sex of the applicant and department, with no interactions. Save the model as model.q2
a) What is the change in log-odds of being accepted for someone applying to department E? Save your answer in the variable q2 .a
b) What is the log-odds of a female applicant being accepted into department C? Save your answer in the variable q2 .b
c) What is the multiplicative change in odds for a female applicant? Save your answer in the variable q2 .c
d) What is the probability of being accepted to department A for a male applicant? Save your answer in the variable q2 .d
e) What is the probability of being accepted to department A for a female applicant? Save your answer in the variable q2 .e
f) (Hidden answer) Which department appears to be the most difficult to be admitted to? Your answer should be in the form ”A”, ”B”, ..., or ”F”. Save your answer in the variable q2 .f
g) (Hidden answer) Which department appears to be the easiest to be admitted to? Your answer should be in the form ”A”, ”B”, ..., or ”F”. Save your answer in the variable q2.g
h) (Hidden answer) Based on this model, without considering other variables, does it appear that there is a statistically significant gender disparity in the admissions of Berkeley? Answer TRUE or FALSE. Save your answer in the variable q2 .h
Question 3 - (9 points total, 1 hidden)
Fit a logistic regression model that predicts acceptance based on the sex of the applicant and department, including an interaction between the two variables. Save the model as model.q3
a) What is the multiplicative odds impact of a male applicant to department C compared to a male applicant to department A? Save your answer in the variable q3 .a
b) What is the multiplicative odds impact of a female applicant to department C compared to a male applicant to department A? Save your answer in the variable q3 .b
c) What is the multiplicative odds impact of a female applicant to department E compared to a male applicant to department E? Save your answer in the variable q3 .c
d) What is the multiplicative odds impact of a female applicant to department F compared to a male applicant to department F? Save your answer in the variable q3 .d
e) What is the probability of acceptance for a male applicant to department B? Save your answer in the variable q3 .e
f) What is the probability of acceptance for a female applicant to department B? Save your answer in the variable q3 .f
g) (Hidden answer) The model coefficient femaleTRUE has a p-value of 6.21 × 10 −5 . (Assuming you fit things correctly, hint I guess) TRUE or FALSE: This indicates a statistically significant difference of admissions for female applicants to Berkeley. Answer TRUE or FALSE. Save your answer in the variable q3.g