Error when fitting a multinomial logit regression with panel data

 Posts: 12
 Joined: Thu Oct 15, 2020 2:17 pm
Error when fitting a multinomial logit regression with panel data
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.
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.
 Attachments

 Screenshot (2).png (32.71 KiB) Viewed 842 times

 Posts: 1245
 Joined: Mon Oct 19, 2009 10:34 am
Re: Error when fitting a multinomial logit regression with panel data
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.

 Posts: 12
 Joined: Thu Oct 15, 2020 2:17 pm
Re: Error when fitting a multinomial logit regression with panel data
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
Hi,
So no the data is 2levels 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.
So no the data is 2levels 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.

 Posts: 12
 Joined: Thu Oct 15, 2020 2:17 pm
Re: Error when fitting a multinomial logit regression with panel data
Thank you very much. Really appreciated.

 Posts: 12
 Joined: Thu Oct 15, 2020 2:17 pm
Re: Error when fitting a multinomial logit regression with panel data
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 nonnegative 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
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 nonnegative 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
 Attachments

 Screenshot.png (52.32 KiB) Viewed 782 times

 Posts: 1245
 Joined: Mon Oct 19, 2009 10:34 am
Re: Error when fitting a multinomial logit regression with panel data
Would it be possible for you to provide further details regarding the errors that you get when you attempt to run this via MCMC?

 Posts: 12
 Joined: Thu Oct 15, 2020 2:17 pm
Re: Error when fitting a multinomial logit regression with panel data
Hi Chris,
Thanks for your reply. Please see the attached screenshot.
Thanks for your reply. Please see the attached screenshot.
 Attachments

 Screenshot (2).png (7.04 KiB) Viewed 755 times

 Posts: 1245
 Joined: Mon Oct 19, 2009 10:34 am
Re: Error when fitting a multinomial logit regression with panel data
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.

 Posts: 12
 Joined: Thu Oct 15, 2020 2:17 pm
Re: Error when fitting a multinomial logit regression with panel data
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?
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?
 Attachments

 Screenshot (2).png (45.6 KiB) Viewed 748 times

 Screenshot (1).png (6.07 KiB) Viewed 748 times