Binary outcome Multiple membership model

Welcome to the forum for R2MLwiN users. Feel free to post your question about R2MLwiN here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to R2MLwiN: Running MLwiN from within R >> http://www.bris.ac.uk/cmm/software/r2mlwin/
dtaylor7
Posts: 9
Joined: Tue Dec 12, 2023 5:08 pm

Re: Binary outcome Multiple membership model

Post by dtaylor7 »

One last thing about the specifics of this model - my model is a binary outcome multiple membership model, with level 1 units (tests) being examined (equally weighted) by two level two units (readers), which are strictly nested within level three units (centres). Effectively like the Three-level multiple membership data structure in LEMMA C13.1.2, but without student 8 changing local authority. Does Level 2 being strictly nested within Level 3 despite being a multiple membership model require a change to the model specification, and if not does it require any different interpretation than a regular 3-level hierarchical multilevel model?
billb
Posts: 163
Joined: Fri May 21, 2010 1:21 pm

Re: Binary outcome Multiple membership model

Post by billb »

Hi,
I think the fact level 2 is nested within level 3 is fine here as for MCMC nested is simply a special case of the more general cross classified model - just need to make sure that your IDs are unique i.e. if you have a reader 1 that this is the same person throughout and if say you have a reader in the second centre they are not also numbered 1.
The only other thing that comes to mind that is relevant for all multiple membership models is that it is not so straightforward to work out things like VPCs as level 2 here will have weights involved so the variance of the random effects at this level will not translate directly into the VPC formula
For example if you had an observation with equally weighted readers 1 and 2 (weights 0.5 each) and centre 6 say then the variance for the observation
V = var(centre) + 0.5^2 var(reader1) + 0.5^2 var (reader2) + var (residual)
V = var (centre) + 0.5 var (reader) + var (residual)
Hope my rough notation makes sense here so the importance of var (reader) will be less than just comparing the variances at each level and obviously will not be constant if the weights are not equal or some observations have more than 2 readers etc.
I have probably thrown up more questions here than answers but hope it is helpful.
Bill.
dtaylor7
Posts: 9
Joined: Tue Dec 12, 2023 5:08 pm

Re: Binary outcome Multiple membership model

Post by dtaylor7 »

Thanks Bill, when writing up my results one more question of interpreting three-level multilevel models came up. If we have, for example, a level-2 unit of teachers-within-schools (with a VPC of 6%) and a level-3 unit of schools (with a variance of 4%) in a model studying a binary pass indicator, as the schools are not actually performing any physical action in marking but instead form a clustering structure for teachers would it be accurate to say that teachers form 10% of the variance, with 40% of that variance being attributable to schools?

Similarly, if I wanted to calculate a coverage interval for the probability of passing for a student being seen by a random teacher nationally and not just a random teacher in any given school, would this only include the teacher-level variance like shown in C11.2.4 of the LEMMA course? Would this even make sense to calculate?
billb
Posts: 163
Joined: Fri May 21, 2010 1:21 pm

Re: Binary outcome Multiple membership model

Post by billb »

Hi again,
So it is probably important to pay attention to my comment about the challenges with multiple membership models in using VPC but I assume here you mean a standard multilevel model. I think your logic of if the total VPC for levels 2 and 3 is 10% with 4% at level 3 then clearly 40% of the higher level variability is at level 3 and presumably one could fit just level 2 and show by how much the variance changes when level 3 is added this.
I am not sure the last question makes that much sense - presumably a random teacher will teach at some school or other so school level effects will come into play as the student will have to study in a school.
jmintyminty
Posts: 1
Joined: Fri Jan 24, 2025 9:02 pm

Re: Binary outcome Multiple membership model

Post by jmintyminty »

Hello,

I am looking for some help with a binary outcome multiple membership model. I was following the wage1 example but have run into an error which I am having trouble figuring out. When I run the model WITHOUT the pID (patient ID, these IDs are repeated in the data set, some patients are in the dataset for multiple days and sometimes a patient receives the activity the team gives them and sometimes not) variable, everything runs fine, but when I add pID to the formula as a random effect, the model only runs with IGLS (EstM =0). When I try to run the model with MCMC estimation (EstM = 1) I get the error "Error in foreign::read.dta(chainfile) : unable to open file: 'No such file or directory". Any ideas as to why this is occurring and how to fix it?

Thanks in advance!

The R syntax I'm using is:
# the formula
F_MM_Model1 <- logit(activityYesNo) ~ 1 + togetherCount + (1 | teamMember) + (1 | pID)

# the multiple memberships members
Model1_MultiMembers <- list(list(
mmvar = list("teamMember",
"teamMember2",
"teamMember3"),
weights = list("weight1",
"weight2",
"weight3")), NA)

# run the multiple membership model
MultiMemb_Test <- runMLwiN(Formula = F_MM_Model1,
D = "Binomial",
data = activity_data,
estoptions = list(EstM = 1, # use EstM = 0 for IGLS and EstM = 1 for MCMC
drop.data = FALSE,
mm = Model1_MultiMembers))
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: Binary outcome Multiple membership model

Post by ChrisCharlton »

This sounds like an error is occurring within MLwiN, so the best way to find the cause would be to add the option debugmode=TRUE to the list in estoptions.

Looking at the syntax that you provided I think that the problem may be that you need to extend the Model1_MultiMembers list with another NA. Although you cannot specify multiple membership at level-1 R2MLwIN still requires an NA in the list to represent this, so for your models the Model1_MultiMembers list will need a total of three elements, i.e.:

Code: Select all

Model1_MultiMembers <- list(list(
mmvar = list("teamMember",
"teamMember2",
"teamMember3"),
weights = list("weight1",
"weight2",
"weight3")), NA, NA)
If you still have problems after this please let us know the versions of R2MLwiN and MLwiN that you are using.
Post Reply