I have network data (alters nested in egos) but regression output is showing 3 levels

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/
Post Reply
dcanarteg
Posts: 14
Joined: Tue Feb 05, 2019 9:30 pm

I have network data (alters nested in egos) but regression output is showing 3 levels

Post by dcanarteg »

Hello I am building a hierarchical logistic model using social network data in which 'EgoIdentifier" is level-2, and 'AlterIdentifier' is Level-1. Formula is below

############# Variance Component Model ########################
m1 <- logit(AltAnySupport) ~ 1 + (1 | EgoIdentifier) + (1 | AlterIdentifier)
(VarCompModel <- runMLwiN(Formula = m1, D = "Binomial", data = RomaAllData,
estoptions = list(EstM = 1)))

However, the regression output in the console is giving me 3 levels instead of 2???!!! See below.

The model formula:
logit(AltAnySupport) ~ 1 + (1 | EgoIdentifier) + (1 | AlterIdentifier)
Level 3: EgoIdentifier Level 2: AlterIdentifier Level 1: l1id

I am following Zhang et al. (2016) suggested in the formula 'F1 <- normexam ~ 1 + (1 | school) + (1 | student)' where 'school' is Level 2 and 'student is Level 1'. In my output, level 3 = EgoIdentifier (it should be level 2 instead), Level 2 = AlterIdentifier (it should be level 1) and 'Level 1: l1id' I have no idea where it came from. Moreover, on the output's header I can see only EgoIdentifier and AlterIdentifier with the correct number of observations respectively.

What can I do?
David
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: I have network data (alters nested in egos) but regression output is showing 3 levels

Post by ChrisCharlton »

As you can't make variables random at level-1 for discrete models R2MLwiN does not include this in the model specification (see http://www.bristol.ac.uk/cmm/media/r2ml ... CGuide10.R for example of setting up a binary model). When creating the input for MLwiN it will automatically create a level-1 identifier (l1id) and add this to the model, hence why this appears in your output. To fit the model that you are expecting you therefore just need to remove the + (1 | AlterIdentifier) from your specification.
dcanarteg
Posts: 14
Joined: Tue Feb 05, 2019 9:30 pm

Re: I have network data (alters nested in egos) but regression output is showing 3 levels

Post by dcanarteg »

Thank you very much! I will try this asap
Post Reply