Hi,
I am calculating a multinomial (answer categories not ordered) multilevel model, with:
- 3 levels (country, grandparent, grandparent-child dyad),
- 3 possible answer categories,
- in IGL/RIGL (no, MCMC does not work; I know that it would be nicer),
- as a random intercept (random at the country-level), fixed slope model.
I now want to see the residuals for the country level.
There should be one residual per country, which means a total of 10 residuals.
However, I find 382 residuals.
I checked the dataset and the model:
- the same model specification with a different dataset works;
- a different model specification with the dataset also goes wrong.
However, I cannot find the bug in the dataset:
- the levels are specified correctly,
- all dyads have consistent information for the grandparent they are nested in,
- all grandparents have consistent information for the countries they are nested in,
- the case number are high enough.
Does anyone know what the problem could be? Where do all these weird additional residuals come from?
Kathrin
error in residuals for multinomial multilevel model
-
- Posts: 3
- Joined: Wed May 25, 2016 12:34 pm
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: error in residuals for multinomial multilevel model
Have you checked that the model is sorted correctly according the model hierarchy? You can check this by opening the Model->Hierarchy Viewer window and checking the the grouping information reported there matches what you expect.
-
- Posts: 3
- Joined: Wed May 25, 2016 12:34 pm
Re: error in residuals for multinomial multilevel model
you're right, the hierarchies are wrong. MLWin mistakes the 10 units at the country-level for 382 units.
Do you have any idea how to fix this?
I checked:
- for this categorical variable ("country"), only 10 values are specified and used in the dataset,
- I copied the values from the country-variable into a different variable and used this copy instead of the original variable: no change,
- I recoded the values from the country-variable into a different variable and used the recoded variable instead of the original one: no change,
- I checked whether the dataset is defined as "split": it is not,
- I took the original dataset from SPSS and imported it into MLWin again: no change either.
Is there anything else I could try?
Do you have any idea how to fix this?
I checked:
- for this categorical variable ("country"), only 10 values are specified and used in the dataset,
- I copied the values from the country-variable into a different variable and used this copy instead of the original variable: no change,
- I recoded the values from the country-variable into a different variable and used the recoded variable instead of the original one: no change,
- I checked whether the dataset is defined as "split": it is not,
- I took the original dataset from SPSS and imported it into MLWin again: no change either.
Is there anything else I could try?
Last edited by northernlight on Wed May 25, 2016 7:51 pm, edited 1 time in total.
-
- Posts: 18
- Joined: Thu Feb 06, 2014 9:37 am
Re: error in residuals for multinomial multilevel model
You have to use Data Manipulation -> Sort. If it is a 3-level model, specify 3 keys and enter the sorting columns in order from the highest to the lowest level (i.e., countries first, then grandparents, then children). Select all columns as an input and output in the same columns.
If this fails, my recommendation would be to use a spreadsheet to sort the variables and then import the dataset into MLwiN. I generally use MS Excel to prepare the dataset as it has a very intuitive sorting capability.
k.
If this fails, my recommendation would be to use a spreadsheet to sort the variables and then import the dataset into MLwiN. I generally use MS Excel to prepare the dataset as it has a very intuitive sorting capability.
k.
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: error in residuals for multinomial multilevel model
Apart from cross-classified models with MCMC the data needs to be sorted by the level IDs (see http://www.bristol.ac.uk/cmm/software/s ... html#order). This is because MLwiN sees a change in unit number as signifying a new unit rather than the value of the number itself. If the hierarchy window is showing a different number of units from what you expect then chances are that this is not the case for your data.
-
- Posts: 3
- Joined: Wed May 25, 2016 12:34 pm
Re: error in residuals for multinomial multilevel model
yes, that's it, now it works.
I also used to prepare the dataset in Excel first and then import it into MLWin.
However, I recently discovered that you can import it directly from SPSS, which has the advantage that you keep all the variable labels, variable descriptions, scale settings, and answer category labels. This is rather nice, because it saves you so much time when you have many categorical variables in your dataset. The downside apparently is that the levels can get messed up
anyways, problem solved, many thanks to all of you for your help!
I also used to prepare the dataset in Excel first and then import it into MLWin.
However, I recently discovered that you can import it directly from SPSS, which has the advantage that you keep all the variable labels, variable descriptions, scale settings, and answer category labels. This is rather nice, because it saves you so much time when you have many categorical variables in your dataset. The downside apparently is that the levels can get messed up

anyways, problem solved, many thanks to all of you for your help!
-
- Posts: 18
- Joined: Thu Feb 06, 2014 9:37 am
Re: error in residuals for multinomial multilevel model
Slightly OT, if you find yourself without SPSS on a particular PC, one trick that works for me is to sort as mentioned earlier in Excel, save the file as a TAB delimited .txt, open with Notepad, copy all and paste in MLwiN. That preserves the variable names.
k.
k.