# How to code values for males when they're only meaningful for females? [duplicate]

I'm building a predictive model for a medical condition that happens in both men and women. Physicians have reported that in some cases for women, their menstrual history seems to be a risk factor, though epidemiologists haven't been able to verify this claim. My data includes information about female subjects' menstrual history. My goal is to build a logistic regression model that determines the probability of the existence of this condition. Here's my problem: I'd like to build a model that includes gender and includes menstrual history questions for female subjects, but how do I assign values for male subjects for things like "number of months since last pregnancy"? Is there a general method to deal with this kind of problem?

• create dummy for variable, which is 1 for females, then include female specific variables multiplied by this dummy y ~ x + is.female:nmonths Nov 17 '12 at 9:09
• Thanks! It's a simple and brilliant solution: create an interaction term. It's really an elegant solution. Thank you again! Nov 17 '12 at 18:12
• In canada the gender is not a binary variable, not even categorical, but a continuous one :) Jul 9 '18 at 13:57

Answered in comments: Create dummy, which is 1 for females, 0 for males, then include female specific variables multiplied by this dummy y ~ x + is.female:nmonths – jem77bfp