Memplot regresi Poisson

Model Linear Tergeneralisasi di R

Richard Erickson

Instructor

Kapan memakai geom_smooth dengan Poisson

  • Paling cocok untuk variabel prediktor kontinu
  • mis., dosis meningkat dan jumlah sel kanker per cm$^2$
  • Jika tidak, gunakan boxplot atau alat plot lain
Model Linear Tergeneralisasi di R

Studi dosis sel kanker

  • Simulasikan data
  • Respon dosis
    • x: Dosis
    • y: Jumlah sel kanker per cm$^2$
Model Linear Tergeneralisasi di R

Plot titik

ggplot(data = dat, aes(x = dose, y = cells)) +
    geom_point()

ggplot dengan titik

Model Linear Tergeneralisasi di R

Jitter titik

ggplot(data = dat, aes(x = dose, y = cells)) +
   geom_jitter(width = 0.05, height = 0.05)

Contoh titik jitter dengan ggplot2.

Model Linear Tergeneralisasi di R

geom_smooth()

ggplot(data = dat, aes(x = dose, y = cells)) +
   geom_jitter(width = 0.05, height = 0.05)
   geom_smooth()

Contoh geom_smooth() default di atas titik jitter

Model Linear Tergeneralisasi di R

GLM dengan geom_smooth()

ggplot(data = dat, aes(x = dose, y = cells)) +
   geom_jitter(width = 0.05, height = 0.05)
   geom_smooth(method = 'glm')

Contoh GLM dengan geom_smooth() dan GLM default, yaitu LM

Model Linear Tergeneralisasi di R

GLM Poisson dengan geom_smooth()

ggplot(data = dat, aes(x = dose, y = cells)) +
   geom_jitter(width = 0.05, height = 0.05) +
   geom_smooth(method = 'glm', method.args = list(family = 'poisson'))

Contoh plot regresi Poisson

Model Linear Tergeneralisasi di R

Ringkasan langkah

  • Plot titik tidak tumpang tindih
  • Tambahkan garis tren Poisson
  • Poles grafik (tidak dilakukan di sini)
Model Linear Tergeneralisasi di R

Ayo berlatih!

Model Linear Tergeneralisasi di R

Preparing Video For Download...