Using adonis to include a random effect
1
0
Entering edit mode
7 months ago
leranwangcs ▴ 150

Hi,

I'm trying to fit a mixed model with distance matrix. I'm trying adonis. And based on their vignette FAQ page:

Can I have random effects in constrained ordination or in adonis?

No. Strictly speaking, this is impossible. However, you can define models that respond to similar goals as random effects models, although they strictly speaking use only fixed effects.
....... Function adonis2 can evaluate terms sequentially. In a model with right-hand-side ~ A + B the effects of A are evaluated first, and the effects of B after removing the effects of A.

The patient_ID is the random variable, so based on the vignette FAQ page, I should fit a model like this:

 adonis2(formula = UC.CD.dist ~ patient_ID + diagnosis_mod, data = Sample.UC.CD)

But I'm confused why the result doesn't include variable "diagnosis_mod"

                Df SumOfSqs      R2      F Pr(>F)    
    patient_ID 217   33.466 0.68547 6.1867  0.001 ***
    Residual   616   15.356 0.31453                  
    Total      833   48.821 1.00000                  

And if I revise the order of patient_ID and diagnosis_mod like this:

adonis2(formula = UC.CD.dist ~ diagnosis_mod + patient_ID , data = Sample.UC.CD)

And this time the result include both diagnosis and patient_ID:

               Df SumOfSqs      R2       F Pr(>F)    
diagnosis_mod   1    0.739 0.01513 29.6324  0.001 ***
patient_ID    216   32.727 0.67034  6.0781  0.001 ***
Residual      616   15.356 0.31453                   
Total         833   48.821 1.00000        

My question is:

  1. why the first model doesn't have stats for both variables?
  2. if the first model does give stats for both variables, can I interpret it as "with random variable patient_ID, the fix variable diagnosis_mod has the p-value of xxx"?

Thanks!

Leran

mixed-model adonis • 696 views
ADD COMMENT
0
Entering edit mode
7 months ago
LChart 4.5k

why the first model doesn't have stats for both variables?

Your variables are multicollinear. This will always be true if you have multiple spanning indicators.

Look carefully. Your "model" includes 218 total variables (1 for each patient_ID plus diagnosis_mod). In both model 1 and model 2, only 217 variables are evaluated. As is standard for indicator variables, the last variable is dropped to make the model well-specified. This is diagnosis_mod in the first model, and whatever Patient_ID is last for the second model.

if the first model does give stats for both variables, can I interpret it as "with random variable patient_ID, the fix variable diagnosis_mod has the p-value of xxx"?

No. This model uses fixed effects only. What adonis2 is doing is the equivalent of regressing out patient_ID, and fitting a linear model to the residuals; as such this would be removing the "mean" effect patient_ID - however the variance may still stratify by patient.

ADD COMMENT

Login before adding your answer.

Traffic: 2557 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6