8 Poisson regression and others GLMs

8.1 Outline

library(pacman)

p_load(tidyverse, here, janitor, purrr, viridis, brms, tidybayes, bayesplot)

theme_set(theme_bw())

8.2 Poisson distribution

#df <- tibble(x = seq(from = 0, to = 20, by = 1)) %>%
#  mutate(lambda_01 = dpois(x, lambda = 0.1))
#
#df %>%
#  gather(key = 'key', value = 'value', -x) %>% 
#  separate(key, c('type', 'scale')) %>%
#  mutate(scale = factor(scale, levels = sort(order(scale)))) %>%
#  ggplot(aes(x = x, y = value, colour = scale)) +
#  geom_line(size = 2) +
#  scale_y_continuous(NULL, breaks = NULL) +
#  scale_colour_viridis(discrete = TRUE) +
#  labs(colour = 'Scale') +
#  NULL