Fits a count-response regression model via glm(family = poisson()),
with optional stepwise selection.
Usage
reg_poisson(
formula,
data,
step = FALSE,
direction = c("both", "forward", "backward"),
...
)Value
A named list analogous to reg_lm(), plus:
- dispersion
Dispersion ratio (should be near 1).
- residuals
Tibble with observed, fitted, Pearson residual.
Examples
set.seed(42)
x1 = rnorm(100)
mu = exp(1 + 0.3*x1)
y = rpois(100, mu)
res = reg_poisson(y ~ x1, data = data.frame(y, x1))
res$coefficient
#> # A tibble: 2 × 7
#> term estimate std.error statistic p.value conf.low conf.high
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 (Intercept) 0.848 0.0687 12.3 5.32e-35 0.712 0.985
#> 2 x1 0.423 0.0664 6.37 1.92e-10 0.291 0.554