statdivlab / corncob

Count Regression for Correlated Observations with the Beta-binomial
102 stars 22 forks source link

Random effects for individuals ? #111

Closed Harithaa-Anandakumar closed 3 years ago

Harithaa-Anandakumar commented 3 years ago

Dear Bryan,

Thank you for this great package!!

As far as I understand, there is no possibility to add random effects (for individuals measured over different time points) in the current version of corncob.

Is there a way I can add this or do you have any recommendations?

Thanks!

bryandmartin commented 3 years ago

Hi @Harithaa-Anandakumar ,

As of right now, random effects are not implemented in corncob. Depending on the details of your experimental design, my current recommendation if you want to control for an individual effect is to use something like a fixed effect for individual.

Adding this is something I want to do eventually, but it is a pretty major task. To be honest, it will be some time before this gets implemented. Still, I think with most experimental designs you can still construct a perfectly valid design matrix to capture your set up. I'm happy to talk through your thoughts here if you want!

Bryan

Harithaa-Anandakumar commented 3 years ago

Thank you for your response!

I am working with a randomised controlled trial (RCT: 2 arms/groups - one placebo/one not) and sampled at 2 time points (pre and post intervention). I want to now somehow correct for the correlation within individuals across time, and more importantly I want to see the effect controlling for the baseline (to truly leverage the design aspect of this 2 time point - RCT)

So something like: post ~ pre + group in a classical setting but (post - bacterial abundance at second time point, pre - at first time point)

equivalently bacterial abundance ~ Group + Time Point + (1|Individual) [Random effects for individual] + covariates..

Am not sure how to translate this into corncob.

bryandmartin commented 3 years ago

You are very welcome! The translation here would be to use fixed effects for the individual. Then you would have a pre/post covariate as well as an individual covariate.

There is some discussion on this point in #63 as well that might be helpful to read through as well.

Midnighter commented 3 years ago

Just to add my voice; I would find the ability to add random effects and longitudinal ones as mentioned in #63 very helpful.