I'm using a model to simulate how tree growth rates vary with different traits, but I'm not sure how to correctly account for the non-independence in the data in my statistical tests.

I generated 100 'plants' that vary continuously in Trait A (the between-subjects variable). I then assumed each plant varied in a categorical variable Trait B. Trait B has 3 levels, so I turned it into two dummy variables, Cat 1 and Cat 2.

I want to test whether the effects of Cat 1 and Cat 2 on growth depend on the value for Trait A, but I'm not sure if my model is correctly expressing the data structure. I've found examples that I interpret as recommending either:

lmer(growth ~ traitAcat1 + traitAcat2 + (1|traitA)) or

lmer(growth ~ traitAcat1 + traitAcat2 + (1|traitA/cat1) + (1|traitA/cat2)

The second model doesn't converge, but the first model doesn't seem like enough information. Any help on how to correctly specify the random variable term would be much appreciated.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.