The objective of this study is to predict the number of times a person has had contact with police in the past 30 days based on a set of predictor variables. The study design is longitudinal with 4 measurement occasions, and the outcome variable is a count of police contacts. Since the study is observational and there is no intervention, our analysis will focus on how predictors influence the count of police contacts over time.
Given that the data is longitudinal with repeated measures and the outcome variable is a count, a suitable approach is a generalized linear mixed-effects model (GLMM) with a Poisson or negative binomial distribution.
For a Poisson GLMM, the model can be specified as:
\[ \text{log}(\text{Expected Count}_{ij}) = \beta_0 + \beta_1 \text{Predictor}_{ij} + u_{j} \]
where:
For a negative binomial GLMM, the model is similar but includes an additional parameter for overdispersion.
# Load necessary libraries
# library(lme4)
# library(MASS)
# Fit a Poisson GLMM
# poisson_model <- glmer(count ~ predictor1 + predictor2 + (1 | occasion),
# family = poisson, data = your_data)
# If overdispersion is a concern, fit a Negative Binomial GLMM
# negbin_model <- glmer.nb(count ~ predictor1 + predictor2 + (1 | occasion),
# data = your_data)
# Summary of the model
# summary(poisson_model)
# summary(negbin_model)