Statistical test on gender: as factor or numeric?

I need to run a statistical test on gender (to compare to population as a whole and to compare among independent blocks in my survey). My question is:

. should I convert gender variable from factor (1-=female, 2=male, 3=binary, 4=other) to numeric and run a test based on some mean percentage in the pop?
.. OR ..
should I keep as factor and calculate percentages in each category to compare to pop?

(follow up: is the answer affected by the fact that i dont just have “female/male” but rather “female, male, binary, other”?)


Are you trying to compare if an outcome is different between genders or that gender is different between some other group? Either way, you can't treat gender as numeric. Please share some more details on what you want to test.

What is your outcome variable? What is your independent variable?

Thx, sorry for lack of clarity.

I want to:

  1. see if my sample is statistically different than the surveyed population when it comes to gender (I know that 50.5% of the surveyed population is female)*
  2. see if an outcome (acceptance of a policy) differs across gender (the independent variable). Acceptance is an dependent categorical variable that ranges from 1 to 5 -- 1 being completely reject and 5 being completely accept)
  • I saw an example where they kept gender numeric to do this test, but it was hard for me to understand, therefore my question 1 above.


Maybe the infer R Package can help you decide what is best.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.