unneeded dummy variable

Welcome to the forum for MLwiN users. Feel free to post your question about MLwiN software 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!

Remember to check out our extensive software FAQs which may answer your question: http://www.bristol.ac.uk/cmm/software/s ... port-faqs/
Post Reply
Williambert
Posts: 6
Joined: Thu Nov 09, 2017 11:14 am

unneeded dummy variable

Post by Williambert »

How do I get rid of an unneeded dummy variable/ response category?I entered a categorical variable into my model as an explanatory variable, and although there are no observations in one of the categories of this variable, a dummy variable for this category was still included in the model. How can I remove it ?
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: unneeded dummy variable

Post by ChrisCharlton »

If you highlight the column in the names window and click the regenerate button then it will remove any categories that do not have any associated data and add categories if there are values that do not have a label. Note that you will need to remove the variable from the model before doing this, and then add it back again afterwards.
Kurthens
Posts: 1
Joined: Mon Nov 27, 2017 11:00 am

Re: unneeded dummy variable

Post by Kurthens »

Williamrbert wrote: Fri Nov 10, 2017 9:02 am If you highlight the column in the names window and click the regenerate button then it will remove any categories that do not have any associated data and add categories if there are values that do not have a label. Note that you will need to remove the variable from the model before doing this, and then add it back again afterwards.
Hi Chris, could this somehow be added as a feature, so it automatically does this?
Last edited by Kurthens on Thu Nov 04, 2021 3:30 pm, edited 3 times in total.
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: unneeded dummy variable

Post by ChrisCharlton »

Unfortunately this wouldn't be very practical as this would require all the categories to be checked against the data every time the data in the column changed. It would also mean potentially losing category labelling that had been entered by the user, as once categories are removed there would be no way to know what their text was previously.

One possible change that might work however is to only include categories that actually have data associated when adding dummies to the model. Doing this could however still have complications related to missing data, as it may be that the variable has data for a category but this is excluded from the model as the associated rows have data missing in other variables.
Post Reply