1
$\begingroup$

In a data set, there is a variable previous_contact which captures how many days have passed since last contact was made. It takes values like 0,1,2 ... 50. And for records when no contact was made earlier, it is NULL.

I am trying to build a logistic regression and previous_contact is an independent variable in the model. How to capture the NULL in the variable?

One idea which I had was to code NULL as a large number like 9999. It will mean if the person was not contacted before, it is equivalent to him being contacted a very long time back.

I was wondering if there is a better way to do this, because won't the result change if we code NULL as 9999 or 99999 or something else?


Frequency of NA is ~95% in the data

$\endgroup$

2 Answers 2

2
$\begingroup$

Code the missing values as zero and construct a new predictor which is one if the value is missing and zero otherwise. Then make sure you always include them both together in the model and test them together.

$\endgroup$
0
$\begingroup$

Depends on where you NULLs are coming from.

If NULL means that no previous contact was made, it makes sense to assign it a value like 1000, which assumes that in the three years that you have been tracking, no contact was made. You can decide this value as suits your case.

In Case NULL means data is unavailable, I'll suggest replacing NULLs with the average 'previous_contact' value.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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