In the example above we ignored the clustering of subjects within neighborhood. It is able to apply random effects models in R, for example using the function lmer
of the library lme4
, but this is beyond the scope of this course.
```{r, eval=FALSE}
library(lme4)
fit <- lmer( BMI ~ Walkability + (1|nh_id), data=BEPAS)
```
For the example with MVCP_acc
as outcome variable, we chose to perform a non-parametric test. However, there are other parametric distributions than the normal distribution. Generalized linear models can be used in R to fit a parametric model with the appropriate distribution and taking in to account the clustering of the data.