Carla
Carla

Reputation: 1

Continuous variable as a random effect? (lme function in R)

The hormone levels are inflated by the sample mass, even after correcting hormone levels by sample mass (its a common problem for endocrinologists).

I'm trying to determine if treatment affect hormone levels, ''correcting'' for sample mass. lme(hormone levels ~ treatment, random= list(~1|INDIVIDUAL, ~1|sample mass), na.action="na.omit", method = "ML",dados)

However, the reviewer said I cant use continuous variable as a random effect. What is the alternative?

Upvotes: 0

Views: 1919

Answers (1)

sjp
sjp

Reputation: 910

welcome to stack overflow. This question is probably more appropriate for Cross Validated, as it is more about statistics that coding. I'm going to answer anyway.

The reviewer is correct, you can't have a continuous predictor as a random effect. See some discussion about that here: https://stats.stackexchange.com/questions/105698/how-do-i-enter-a-continuous-variable-as-a-random-effect-in-a-linear-mixed-effect

To directly answer your question, the alternative is to add the predictor sample mass to the model as a fixed-effect, where it will be a covariate. This means the model will take into account both how hormone levels vary by size and the treatment. This is what user63230 has suggested, and I think it is the correct way to move forward. If you have a specific prediction about how the treatment may vary by the sample mass, you could include an interaction. If you expect the treatment to affect different individuals differently, you can fit a random slope for treatment on individual.

Upvotes: 1

Related Questions