เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Fitting a Poisson regression in R

In this exercise, you will fit a Poisson regression using glm(). GLMs in R use the same formula notation as linear models: response ~ predictor. However, the model also requires the error or distribution family to be specified with the family = ... argument. To fit a Poisson regression, set family equal to "poisson" (make sure to include the quotes " around poisson).

You will use a simulated dataset with a predictor variable time and response count.

A real dataset could be number of points scored, clicks on a webpage, or birds you see out your window.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Generalized Linear Models in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Using data.frame dat, fit a Poisson regression where count is predicted by time with the poisson family. Save the model as poisson_out.
  • Print poisson_out to the screen.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# fit y predicted by x with data.frame dat using the poisson family
poisson_out <- ___

# print the output
print(___)
แก้ไขและรันโค้ด