I am currently conducting mediation analyses using the mediation package in R. I usually use SAS but this approach seemed more straightforward. I am using a Poisson model (link= log). The mediation runs fine, the issue is that participants in my study contributed more than one sample (for the exposure variable), so their data is correlated. I believe that there is a way to indicate that the standard errors are clustered for a variable, but I cannot figure out how to employ it. I see that there is a ‘cluster’ option but that the ‘cluster’ should be a vector of cluster indicators. I am not quite sure how to incorporate it into the mediation. I have successfully used coeftest to get clustered standard errors for the individual models but that does not help for the mediation. Can anyone provide some clarity? Thank you in advance.