4. Poisson Regression (Review from Homework 6). The following code will read in and create a data
set related to the number of awards that undergraduate mathematics majors obtain over the course of
their undergraduate degree.
data <- read.csv("https://stats.idre.ucla.edu/stat/data/poisson_sim.csv")
head(data)
num.awards<-data$num_awards
plan.gs<-rep(0,nrow(data))
plan.gs[data$prog==2]<-1
exam.score<-data$math
## plotting the data
plot(exam.score,num.awards, xlab="Final Exam Score", ylab="Number of Awards")
plot(plan.gs,num.awards, xlab="Planning on Grad School?", ylab="Number of Awards")
Here "num.awards" is the number of awards each student obtains, "plan.gs" is a variable that is "1"
if the student plans to go to graduate school and "0" if they do NOT plan to go to graduate school,
and "exam.score" is the student's score on a final examination in a capstone mathematics class. Your
goal is to understand whether or not planning to go to graduate school is correlated with the number
of awards a student earns. This might point to a bias in how awards are given, if students who plan to
go to graduate school get more awards than similarly strong students not planning to go to graduate
school.
STAT 415 Homework 7
To do so, you will fit a Poisson regression model, as follows
$ \lambda_i = exp(\mu + a + plan.gs_i + b \times exam.score_i) $
num.awards ~ Pois($\lambda_i$)
(a) Provide MLEs for "a" and "b".
(b) Conduct a Wald test of the null hypothesis that a=0
(c) What can you conclude from the result of this test about the effect that planning to go to graduate
school has on a student's expected number of awards?