4
$\begingroup$

The questionnaire for the data is here

The first question takes multiple entry for the same question, I want to reduce this to a single variable. How do I do it?

The clean data is available here. NB: The Column CompuPlat has missing values.

part of dataset

CMFam CMHobb CMNone CMOther CMPol CMProf CMRel 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 1 Community Membership_Family Community Membership_Hobbies Community Membership_None Community Membership_Other Community Membership_Political Community Membership_Professional Community Membership_Religious Community Membership_Support I want to club all of them in a variable CM

$\endgroup$
  • $\begingroup$ Could you paste the head of the cleaned data in the question itself? Also, what do you mean by reducing this to a single variable? If you can, please provide some more context. Examples might help too. $\endgroup$ – Nitesh Nov 18 '14 at 10:03
  • $\begingroup$ Say I have put up a question to get replies for 5 disabilities, a respondent has 3 disabilities and there are multiple cases like this. How do I club all of them in a single categorical variable representing these disabilities? $\endgroup$ – Ankit Haldar Nov 18 '14 at 10:07
2
$\begingroup$

The variable represents the answer to the first question.

One straightforward way is to allow for all possible categories in this variable. For example, if there are 5 options in this answer, you will have to treat it as a categorical variable with 2^5 = 32 categories.

However, the number of categories increase exponentially with the number of options (check boxes) provided for the answer. In that case, it might be better to restrict the number of categories to, for example, 5. This can be done by leaving the top 4 choices/ options (by count) as they are and treating every other choice as "other".

$\endgroup$
  • 1
    $\begingroup$ The issue becomes bigger when I have 11 such variables $\endgroup$ – Ankit Haldar Nov 18 '14 at 10:21
  • $\begingroup$ Agreed. It becomes more and more complicated as the number of choices/ options increase. But you choose to restrict the number of categories to, for example, 5. This can be done by using the top 4 choices/ options as they are and treating everything else as "other". $\endgroup$ – Nitesh Nov 18 '14 at 10:23
  • $\begingroup$ Any other way out? $\endgroup$ – Ankit Haldar Nov 18 '14 at 10:23
  • $\begingroup$ I will probably edit my answer with the above comment. $\endgroup$ – Nitesh Nov 18 '14 at 10:25
  • $\begingroup$ How do I figure out the top 4 choices? $\endgroup$ – Ankit Haldar Nov 18 '14 at 10:31
1
$\begingroup$

If I've understood your question correctly, one easy solution would be to concatenate the bits together and make a 7-bit binary sequence then convert it to integer. So, for your sample dataset quoted in the question you would get:

CM 16 0 98 8 6 67

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.