0
$\begingroup$

Let us say I have a dataset with 2 columns X1 and X2. X1 is dichotomous and has 2 level yes and no. X2 is numeric and is only completed when X1 = yes. Is it possible to keep the numeric column X2 as numeric? Could one impute the median of X2 for X1 = no or some other arbitrary constant? Thanks!

$\endgroup$
1
$\begingroup$

Let $X1 = 1$ if "yes" and $0$ if "no". Then, you can impute the value $X2 = 0$ for the units of observation having $X1=0$, and include in your regression the interaction term $(X1\cdot X2)$ instead of $X2$, so that the effect of $X2$ is conditional on $X1 = 1$.

$\endgroup$
1
  • $\begingroup$ guess like an interaction without including X2? Thanks. $\endgroup$ – cs0815 Aug 6 '19 at 11:16

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.