1 year ago

#363554

test-img

oregaymi

linear mixed models: (in)appropriate factor level setup? + rank deficient matrix warning

I'm trying to run a mixed-effects model to look at the effects of three treatments on weight in two different groups. I have two questions - I'm really sorry if they're stupid ones. I have next to no experience using R; my supervisor said that I should use RStudio and gave me some code (which...he didn't write either, so he can't really help me with it...and nor can anybody else in my lab.), and I'm uncertain about whether it's doing what I need it to be doing. I'd really appreciate some help.

The first question is about the way my factor levels function in the analysis. My groups and factor levels are set up as follows:

GT<- as.factor(data$GT)
AT <- as.factor(data$AT)
FM <- as.factor(data$FM)
batch <- as.factor(data$BOX)

data$GT<-factor(data$GT,levels = c("WT", "m5"))
data$AT<-factor(data$AT,levels = c("no","yes"))
data$FM<-factor(data$FM,levels = c("no","yes"))

Notably, everyone in FM is also in AT. (i.e. for both WT and M5, there's ATno/FMno, ATyes/FMno, and ATyes/FMyes, but no ATno/FMyes treatments)

This is the code I've been given:

Weight<- data[,53:58]
Weight.new <- organise_data(data = Weight, groups = group.info, 
                                new_var_name = 'Time')
Weight.new$Time <- factor(Weight.new$Time, 
                              levels = c('Weight_W8','Weight_W9','Weight_W10',
                                'Weight_W11','Weight_W12', 'Weight_W13'))
Weight.new$Time = as.numeric(Weight.new$Time)
Weight.lmm <- lmer(value ~ GT + AT + FM + Time + GT*FM + AT*FM + GT*AT*FM + (1|BOX), na.action=na.omit,
                      data = Weight.new)
summary(Weight.lmm)

Will this mean that results for ATyes include both ATyesFMTno and ATyesFMTyes? If so, given ATyesFMTno and ATyesFMTyes are different treatment groups they should be looked at separately, right? How should I do this?

Second, two of the interactions (AT * FM and GT * AT * FM) are always dropped with the following warning:

fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients

I understand there can be a number of reasons for this, and that it's not necessarily a fatal kind of thing, but here I'm worried that it's because I'm using the model inappropriately, or have incorrectly specified some terms or something. Is this an appropriate way to have structured things? Again, I'm sorry if this is completely obvious, I'm just a bit inexperienced and overwhelmed and there's nobody else I can ask. Any advice would be extremely appreciated.

r

statistics

mixed-models

0 Answers

Your Answer

Accepted video resources