STAT 311 Programming

Programming Assignment 8

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

  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值