I have a problem building my lmer formula to perform an analysis.
I have two groups (healthy subject and patient) and numeric values in different brain regions (8 regions of interest) with a total of 63 subjects. I want to know the difference in these brain values between healthy subjects and patients for all of the regions. Plus I have to account for genotype (two types) and sex (male/female) and also a couple of other factors (mostly numeric).
So according to a similar publication, where lmer was used, I should put group (healthy/patient) and genotype as fixed factors and region should be put as within-subject fixed factor with a diagonal covariance structure. Participant ID should be a random factor.
I tried to build the formula in several different ways after looking for solutions online but I think I need help.
With disregard to the diagonal covariance structure, I tried it like this:
lmer(lk3 ~ group + (1 |region:ID2) + genotype + (1|ID2), data = m) OR lmer(lk3 ~ group * region + (1+region*group|ID2), m) OR lmer(lk3 ~ group * region + genotype + (1|ID2) , m) It outputs this error message for the first two: "number of levels of each grouping factor must be < number of observations"
I tried several other variants according to youtube videos and online discussions I read online but nothing seems to work, or when it does work I run an anova over the model and there is no p value.
How would you build the syntax for this model?
And how can I add the diagonal covariance structure for the regions as within subject fixed factor?
my data look like this:
'data.frame': 504 obs. of 7 variables: $ ID2 : Factor w/ 63 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ... $ group : Factor w/ 2 levels "healthy","patient": 1 1 1 2 2 2 2 2 2 2 ... $ sex : Factor w/ 2 levels "0","1": 2 2 1 2 1 1 1 1 1 1 ... $ age : num 25 34 34 19.3 27 ... $ genotype: Factor w/ 2 levels "0","1": 1 1 1 2 1 1 1 1 2 2 ... $ region : Factor w/ 8 levels "ACC","amygdala",..: 5 5 5 5 5 5 5 5 5 5 ... $ lk3 : num 0.205 0.17 0.172 0.149 0.193 ... Thank you in advance, help much needed.