2
$\begingroup$

I conducted a four-phases experiment in which data from two groups of subjects are extracted for each time point according to the states of the outcome variable Dur. So, this variable can be basically decomposed into four states. What I would like to see is if the two groups have different values of the dependent variable for each state. The raw data looks like the following table:

enter image description here

I then subsetted the data into four dataframe according to the phase of the experiment, and performed a linear mixed model for the single phases, like this:

1_data <- subset(df2, phase == "1")
2_data <- subset(df2, phase == "2")
3_data <- subset(df2, phase == "3")
4_data <- subset(df2, phase == "4")

model <- lmer(Dur ~ 1 + Group* state + (1|id), data = 1_data )
model <- lmer(Dur ~ 1 + Group* state + (1|id), data = 2_data )
model <- lmer(Dur ~ 1 + Group* state + (1|id), data = 3_data )
model <- lmer(Dur ~ 1 + Group* state + (1|id), data = 4_data )

Subsequently, I looked at the single contrasts, binding all of them in one table and applying the FDR and Bonferroni correction for multiple comparisons.

However, the model gives me the following warning: boundary (singular) fit: see help('isSingular')

I've read other related answers that say that this is occurring because the random effect specification is too complex. Anyway, I cannot simplify further the model.

So, my idea was instead to conduct a RM-ANOVA and then performing a post-hoc test by means of unpaired t-test.

> res.aov <- anova_test(data = baseline_data, dv = dur, wid = id, between = Group, within = state)
> get_anova_table(res.aov)
ANOVA Table (type III tests)

              Effect  DFn    DFd     F     p    p<.05     ges
1            Group     1.00  40.00 0.130 0.720       0.000123
2            state     2.87 114.97 5.617 0.001     * 0.119000
3     Subject:state    2.87 114.97 2.956 0.037     * 0.066000

Would that be better? Or, in this case, would be just the same thing as LMM? As I already confronted the results of anova(model) with that res.aov, they are quite similar but not the same.

$\endgroup$
0

1 Answer 1

3
$\begingroup$

I think you should use neither.

  1. I don't understand why you fit separate models instead of including the phase in the model.

  2. Your dependent variable looks like you should be using a GLMM with a different distribution family than the normal distribution. Your data might even be zero-inflated?

  3. You can get this warning if the variance of the random effect is basically zero. In such a case you might need to specify different starting values for the optimizer or use a fixed-effects model: https://stackoverflow.com/a/75831110/1412059

$\endgroup$
3
  • $\begingroup$ 1. I choose to fit separate models instead of including the phase ( it should be model<-lmer( Dur ~ 1 + Group*state*phase +(1|id) , data = data) ??) because I am mainly interested in calculating simple contrasts only for each state between the two groups. Otherwise, I will generate more contrasts than necessary. However, I am not aware of other possible strategies at the moment. 2. Yes, the data contains a lot of zeros. In my case, that would mean that the state is not present. 3. Indeed, the conditional R2 is zero. But the same warning occurs even when I include the phase in the model. $\endgroup$
    – Ed9012
    Mar 22 at 8:58
  • $\begingroup$ The second issue should be solved first. Look into hurdle models and similar approaches. $\endgroup$
    – Roland
    Mar 22 at 12:17
  • $\begingroup$ I solved this issue, handling zeros as missing data. That would be the correct way in this field of study. By the way, I also checked the normality of the data and I might be use a non-parametric model, which for RM-ANOVA would be a Friedman test, though it is a one-way test. I don't know what else I can apply $\endgroup$
    – Ed9012
    Mar 25 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.