Skip to main content
2 of 2
added 6 characters in body
  1. If the variable is categorical and not ordered, it may make sense to create a new category 'not_married' to represent the missing values. This would allow you to keep the information about marital status and avoid imputing values that don't make sense (e.g., 0 for a newly married person).

  2. If the variable is categorical and ordered (e.g., 0 = not married, 1 = newly married, 2 = married for 1 year, etc.), imputing a value of -1 for the missing values could make sense. This acknowledges that the missing values represent a previous state (not married) and allows you to preserve the ordering of the categories. However, this approach does sacrifice some granularity in the data.

  3. If the variable is continuous, imputing a value of 0 may not be appropriate since it assumes that all missing values correspond to newly married individuals. One idea is to use a flag variable to indicate whether someone is married or not, and let the model learn the relationship between this variable and 'years_married'. Another option (that doesn´t reflect reality but may make this variable value less relevant to the model) is to impute values using a more complex approach, such as a regression model that predicts 'years_married' based on other variables in the dataset.

  4. It's important to consider the context of the dataset and the modeling approach when deciding how to handle missing values. You could try different methods (e.g., imputing -1 vs. creating a 'not_married' category) and compare their performance in terms of how well they explain the variability in the outcome variable.