Page 1 of 2

Error when fitting a multinomial logit regression with panel data

Posted: Tue Jan 12, 2021 10:54 am
by FerhatTura
Hi,
Apologies for posting this twice as I am not sure whether my previous post that I submitted under the 'Level identifiers' subject could be seen by others. So, I have a similar problem with the one posted under 'Level identifiers' subject but could not find a solution yet. If you could help me I would appreciate it.
I have a longitudinal data set (4 years repeated measures in long format) with a dependent variable (4 categories) and level 1=years (e.g. year=1,2,3,4) and level 2=individuals (e.g. id=1,1,1,1) (NOTE: not all individuals answered the questionnaires in all years). When I try to run multilevel multinomial logistic regression I get the attached error. As suggested previously, I followed the same model structure as in chapter 13 of the MLwiN User's Guide and then tried to switch the model to multinomial, but MLwiN did not let me to do so and forced me to clear the model and specify the multinomial logistic regression model from scratch. How I can sort this problem out please? Many thanks in advance.

Re: Error when fitting a multinomial logit regression with panel data

Posted: Tue Jan 12, 2021 12:15 pm
by ChrisCharlton
For multinomial models the base level needs to be an identifier indicating the unit number (e.g. 1..N). If you don't have such a column in your data this can be created using the GENE command or Generate Vector window. This will then be expanded when converting the response to multinomial.

Re: Error when fitting a multinomial logit regression with panel data

Posted: Tue Jan 12, 2021 1:26 pm
by FerhatTura
Thank you very much for your quick reply Chris. It works now but I am a bit confused re the number of my levels. Does this mean I will have three levels: the identifier indicating the unit number (e.g. 1..N), years and individuals?

Re: Error when fitting a multinomial logit regression with panel data

Posted: Tue Jan 12, 2021 2:40 pm
by billb
Hi,
So no the data is 2-levels it is just that for fitting both multivariate response models and multinomial models MLwiN expands out the data to create a dummy level of categories/responses below level 1. The reason you are getting an error message is that when you use year within individual MLwiN doesn't like the fact that for some individuals say where they only have a single year then this year variable may go say 1,2,3,4,1,1,2,3,4 with the second individual just having year 1. Now when MLwiN creates the expanded data with the dummy level for categories it gets confused by the repeated 1's here. The solution is to simply generate a vector from 1 to the size of the dataset and use that as level 1 rather than year.
Hope that helps,
Bill.

Re: Error when fitting a multinomial logit regression with panel data

Posted: Tue Jan 12, 2021 3:04 pm
by FerhatTura
Thank you very much. Really appreciated.

Re: Error when fitting a multinomial logit regression with panel data

Posted: Tue Jan 19, 2021 4:10 pm
by FerhatTura
Hi,

I am having another problem with my multilevel multinomial model, which is similar to the one posted here: https://www.cmm.bris.ac.uk/forum/viewtopic.php?t=1260 (Multinomial multilevel: numeric warning by rozemarijndreuddr Fri Dec 11, 2015 4:53 pm)

Basically, when I run my model using 1st order MQL it is fine, but when I want to switch to 2nd order PQL (as it is suggested to use 2nd order PQL or MCMC estimation in the MLwiN manual) I get this error: "IGLS/RIGLS NUMERIC WARNING. SSP matrix for fixed part has gone negative definite - a reconstruction to the nearest non-negative form has been used. Numeric warnings can be suppressed by setting an option on the Estimation Control, IGLS/RIGLS panel."

I followed what rozemarijndreuddr did but no result. I also could not run the model using MCMC. When I check my hierarchy viewer, it seems ok and could not figure out what the problem is.

Please note that my dependent variable is the number of crime types experienced (i.e. zero, one, two and three or more). Level two is individuals (id_long in the attached screenshot) and level 1 is years (baselevel_long in the attached screenshot; 4 years but some answered questionnaires only for 2 years).

Would you please advise me re what might be causing the error? Many thanks in advance.

Best wishes

Ferhat

Re: Error when fitting a multinomial logit regression with panel data

Posted: Wed Jan 20, 2021 2:15 pm
by ChrisCharlton
Would it be possible for you to provide further details regarding the errors that you get when you attempt to run this via MCMC?

Re: Error when fitting a multinomial logit regression with panel data

Posted: Thu Jan 21, 2021 8:48 am
by FerhatTura
Hi Chris,

Thanks for your reply. Please see the attached screenshot.

Re: Error when fitting a multinomial logit regression with panel data

Posted: Thu Jan 21, 2021 9:39 am
by ChrisCharlton
Thanks for this. It looks like MLwiN has been confused by the language settings on your machine (notice the 5,8 rather than 5.8). If you temporarily change the decimal separator to a . it may start working.

Re: Error when fitting a multinomial logit regression with panel data

Posted: Thu Jan 21, 2021 10:13 am
by FerhatTura
Hi Chris,

Thanks for your prompt reply. I changed the language settings so the decimal separator to a . but I got the same error with a .
I also run the model using the 2nd order PQL and got the result that you can see in the second screenshot attached (I also used another computer that I have not changed the language settings from English at all, but got the same results). Any further thoughts please?