myles-lewis / glmmSeq

Gene-level general linear mixed model
https://myles-lewis.github.io/glmmSeq/
Other
18 stars 10 forks source link

Can glmmseq be used in non-longitudinal data? #30

Closed Leran10 closed 3 months ago

Leran10 commented 1 year ago

Hi,

I'm trying to use glmmseq to analyze some dataset in which each patient contributed multiple samples. I want to consider patient ID as random factor and the diagnosis as fixed factor. So my formula would be like:

glmmSeq(~ diagnosis + (1 | patient_ID), countdata = OTU.table, metadata = Sample.table, dispersion = disp, progress = TRUE)

As you can see, I don't have a "Timepoint" variable in this model.

Based on glmmseq manual, glmmseq is "Designed for longitudinal analysis..." If I don't have Timepoint can I still use this model?

Thanks very much! Leran

myles-lewis commented 1 year ago

Hi Leran,

Sorry for slow reply - I just saw your message now.

Technically you can try it. glmmSeq() is largely a wrapper around lme4::glmer(). So a simple way to check if this is going to work is to take 1 row of your count data (i.e. 1 gene), apply log2+1 so that it's more gaussian. Then apply a mixed model using your formula:

lme4::lmer(geneA ~ diagnosis + (1 | id), data = dat)

I just tried it myself and it will fit a model provided you have enough individuals. But since the primary purpose of a mixed model is regression where at least 1 variable on the RHS is continuous (e.g. time, but doesn't have to be time could be another continuous variable that varies across individuals). Since you don't have a continuous variable I'm not sure there's anything linear for the model to fit to, so the random effect becomes pointless.

I think if you have multiple samples for each individual, these are more akin to technical replicates. DESeq2 offers a way to collapse these and might be more suitable for analysing your data (assuming it is RNA-Seq). Limma can also include technical replicates so you could try limma voom if it is RNA-Seq data.

Regards, Myles