Problem: In statistics, Poisson regression is a generalized linear model form of regression analysis used to model count data. In Poisson regression, the dependent variable Y is an observed count that follows the Poisson distribution. The rate A is determined by a set of predictors X. Here, we focus on simple Poisson regression model log A = Bo + B1X. Solving for A, we have A = e^(Bo + B1X).
For each data point, we have a predictor Xi and an observed count Yi. Then the likelihood function is L(Bo, B1) = e^(-e^(Bo + B1Xi)) * e^(Bo + B1Xi)^(Yi) / Yi!. Our goal for the problem is obtaining the parameter estimates of Poisson regression. Load the dataset uploaded in the course Elearning: (Hint: to import a txt file into R, use the read.table() function and you may also need the header = T argument inside the function.)
Use Newton's method with an initial value Bo = 0 and B1 = 0 to find the maximum likelihood estimator of Bo and B1.
When we want to run Poisson regression in R, we use the glm() function with the family argument set to "poisson". Compare your parameter estimation results in 2 to the glm() output.