A simulated dataset giving the number of infections recorded for 100 patients over a one-year follow-up in a placebo-controlled study. It is designed for teaching Poisson regression of a count outcome on a treatment group and a continuous covariate.

data("infections")

Format

A data frame with 100 rows and 4 columns.

id

patient identifier (1 to 100).

treatment

the treatment group, "placebo" or "treated".

age

the patient's age, in years.

count

the number of infections recorded during the one-year follow-up (a count outcome).

Source

A simulated dataset created for teaching Poisson regression. The counts were generated as count ~ Poisson(mu) with log(mu) = 1.6 - 0.8 * (treatment == "treated") + 0.25 * ((age - 40) / 10) (see data-raw/infections.R), so the treated group has a lower infection rate.

Examples

data(infections)
head(infections)
#>   id treatment age count
#> 1  1   placebo  32     4
#> 2  2   placebo  52     5
#> 3  3   placebo  36     4
#> 4  4   placebo  55    12
#> 5  5   placebo  58     7
#> 6  6   placebo  22     5

# Poisson regression of the infection count on treatment and age
fit <- glm(count ~ treatment + age, family = poisson, data = infections)
summary(fit)
#> 
#> Call:
#> glm(formula = count ~ treatment + age, family = poisson, data = infections)
#> 
#> Coefficients:
#>                   Estimate Std. Error z value Pr(>|z|)    
#> (Intercept)       0.668071   0.210448   3.175   0.0015 ** 
#> treatmenttreated -0.831754   0.112840  -7.371 1.69e-13 ***
#> age               0.023955   0.004568   5.244 1.57e-07 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> (Dispersion parameter for poisson family taken to be 1)
#> 
#>     Null deviance: 171.273  on 99  degrees of freedom
#> Residual deviance:  75.838  on 97  degrees of freedom
#> AIC: 383.19
#> 
#> Number of Fisher Scoring iterations: 4
#>