I am fitting a model with both nested and non-nested factors. I would really appreciate any comments on what is the correct code to fit the model with lmer.

The data structure is a bit complicated. My unit of analysis is the village-organization-dyad. The outcome is observed at the level of the dyad, not of one or both of its members (for example number of interactions between the village and the organization). I have measures over time for each dyad. Organizations and villages are crossed. In addition, villages are nested within counties. I am unsure about the syntax for the model using lmer. I do have unique ids for each dyad, organization, village and municipality, so I don't have issues with inner grouping. I want random intercepts only, not random slopes. Is this the correct syntax?

Int is the continuous dependent variable
X is a matrix of independent variables
dyad_id is the dyad id
vill_id is the village id
org_id is the organization id
count_id is the county id
year is the year (1 measurement per year)

m1 <- lmer(int ~ X + (year|dyad_id) + (1|org_id) + (1|vill_id) + (1|count_id), data1)

Is this capturing that (i) year is nested within dyad, (ii) dyad is cross-classified by organization, village and county, and (iii) locality is nested within county? I don't have any problem running the model but I want to make sure the code is right for the model I want to estimate.

Here is the description of the identifiers in the data:
> str(data1)
'data.frame': 1208 obs. of  15 variables:
 $ dyad_id         : int  1 1 2 2 3 3 3 4 4 4 ...
 $ vill_id         : int  1 1 1 1 2 2 2 3 3 3 ...
 $ org_id         : int  2 2 3 3 6 6 6 6 6 6 ...
 $ count_id       : int  1 1 1 1 5 5 5 10 10 10 ...
 $ year           : int  2002 2001 2001 2000 2005 2003 2004 1996 1999 1994 ...

Thank you,
Ana


	[[alternative HTML version deleted]]

