I am trying to translate the design information of an experiment into a mixed effects model, but I don't have any experience with mixed effects models. I was hoping someone could help me with this problem.
I have an experiment with 5 predictors:
- Animal_ID :: [Categorical, Unordered, 18 levels] --> (1, 2, ..., 18)
- Animal_Species :: [Categorical, Unordered, 2 levels] --> (Bighorn, Barbary)
- Treatment_Group :: [Categorical, Unordered, 3 levels] --> (T1, T2, T3)
- Sample_Type :: [Categorical, Unordered, 2 levels] --> (Blood, Tissue)
- Collection_Time :: [Numerical, Continuous] --> (-Inf -> +Inf)
The Animal_ID predictor is the identifier for a single animal, and these animals are randomly chosen from larger populations, therefore Animal_ID is a Random Effect Predictor. All the other predictors are Fixed Effect Predictors. Thus:
- Animal_ID --> Random
- Animal_Species --> Fixed
- Treatment_Group --> Fixed
- Sample_Type --> Fixed
- Collection_Time --> Fixed
Looking at contingency tables of the data set, I made the following Crossed/Nested observations for each pair of categorical predictors:
- Animal_ID is Nested within Animal_Species
- Animal_ID is Nested within Treatment_Group
- Animal_ID is Partially Crossed with Sample_Type (i.e. crossed but with some missing data)
- Animal_Species is Partially Crossed with Treatment_Group
- Animal_Species is Fully Crossed with Sample_Type (i.e. crossed with no missing data)
- Treatment_Group is Partially Crossed with Sample_Type
Furthermore, looking at a 3-way contingency table, Animal_ID is Nested within the Crossed predictors Animal_Species and Treatment_Group, which can be depicted in a table:
Animal_Species : Treatment_Group : Animal_IDs
Bighorn :: T1 :: 1, 2, 3, 4
Bighorn :: T2 :: 5, 6, 7, 8
Bighorn :: T3 :: 9, 10, 11, 12
Barbary :: T1 :: missing data
Barbary :: T2 :: 13, 14, 15
Barbary :: T3 :: 16, 17, 18
Before attempting to translate the design information into a mixed model, I make several assumptions:
- Since Animal_ID is Partially Crossed with Sample_Type, their 2-way interaction cannot be added to the model
- Since Animal_Species is Partially Crossed with Treatment_Group, their 2-way interaction cannot be added to the model
- Since Animal_Species is Fully Crossed with Sample_Type, their 2-way interaction can be included in the model
- Since Treatment_Group is Partially Crossed with Sample_Type, their 2-way interaction cannot be added to the model
Finally, writing a mixed model formula (in LME4 notation) based on the given assumptions, and the fact that Animal_ID is nested, I am inclined to write down something like this:
Response ~ (1|Animal_ID:Animal_Species:Treatment_Group) + Animal_Species + Treatment_Group + Sample_Type + Collection_Time + Animal_Species:Sample_Type
But this throws the error "boundary (singular) fit".
In conclusion, despite my observations of the design information, the mixed model I think should work does not, and I don't know what I'm missing. If anyone can help point me in the right direction, I would appreciate any suggestions. Thanks!
Animal_ID:Animal_Species:Treatment_Group- is this a complete 3 way cross of these three variables? If that's the case, then if an animal ID corresponds to a Bighorn, then that ID crossed with Species = Barbary can't be estimated, because it doesn't exist. How about starting with a simpler random effect like(1|AnimalID)? – Alex J Jul 06 '23 at 00:47lme4syntax, but isn't"\"the nesting operator? https://cran.r-project.org/web/packages/lme4/vignettes/lmer.pdf Table2 – Alex J Jul 06 '23 at 02:04(1|Species/ID). If Animal ID is nested within Treatment Group, there should also be(1|Treatment/ID). I am not sure why you would want to do the second though, givenTreatmentis the thing you are interested in – Alex J Jul 06 '23 at 02:06