[R-sig-ME] Modeling group-level effects with unequal #s of "subgroups"
jonnations
jonn@t|on@ @end|ng |rom gm@||@com
Wed Jul 10 04:38:01 CEST 2019
Hi list,
I am working on what may be a simple problem, but I can’t quite wrap my
head around it. I have spent time searching for a solution to a problem
like this, but I must not be using the correct terminology in my searches.
I am trying to construct a simple linear model with one response, one
predictor, and a group level factor (3 islands in this case). The hard part
is that one of the 3 “islands” is composed of multiple smaller islands.
Here is a small fake data set:
size <- c(5,6,4,5,3,5,6,6,4,3,2)
age <- c(5,10,2,5,10,3,10,3,3,10,3)
island <- c("A", "A", "B", "B", "B", "C", "C", "C", "C", "C" , "C")
sub-island <- c(NA, NA, NA, NA, NA, "C1", "C1" , "C1", "C2", "C2", "C2")
df_test <- data.frame(size, age, island, sub-island)
Writing a simple model such as
`size ~ 1 + age + (age | island)`
ignores the hierarchical structure of group C, which is important in my
case. However, modeling
`size ~ 1 + age + (age | island) + (age | sub-island)`
would not work as islands A and B do not have this sub-structure. One
alternative may be to assign the other "sub-island" groups to single groups
(i.e. "A1 for all "A's", etc) but I'm not sure if this is appropriate or
not.
If anyone provide some useful information on how to construct this model I
would be very grateful. I am used to modeling in brms, which uses basically
the same syntax as lme4. Alternatively, if anyone could tell me what this
type of data structure is called, then I could better search for options on
my own.
Thank you for helping this beginner,
Jon
--
Jonathan A. Nations
PhD Candidate
Esselstyn Lab <https://esselstyn.github.io/>
Museum of Natural Sciences <https://www.lsu.edu/mns/>
Louisiana State University
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list