Logistic regression: Is it valid to code NA as 0? Hi I have the following problem:
I plan to do a logistic regression on web traffic data. One of my attributes is Number of days since last visit (type numeric in R). Now lots of visitors are firs-timers and I have no data for this attribute. Should I code them as NAs, or is is valid to code them as 0s?
Thank you all
 A: I would say "no". If you have this as a numeric variable, then 0 would be less than 1, indicating an even more frequent visitor; indeed, 0 has a sensible interpretation as "visited the site today". 
A: To answer the direct question, no.  As @PeterFlom points out, 0 has the interpretation "visited today."  You likely already have a lot of 0's in your data from people who did just that.
I don't know that I would call this data "missing".  The data is all there, it's just that the interpretation is a little difficult.  To make this clear, think about what would happen if you imputed the missing data--what would you impute it to?  You're stuck with the same problem.  You know what the data is, but you do not know how to model it.
Similarly, if you code it as NA, what does that mean for the model?  You still have to make a choice as to how to model it.  Row-wise deletion would work, but alter the question you are answering to, "Among previous visitors...."  
Some potential ways of modeling this:


*

*Make it a really high number (close to $\infty$)

*Create a two-part model, the first stage of which models the decision to become a "customer" of the website, the second stage is what you have now

*Create a dummy for first-time visitor (first), and interact it with the number of days since last visit variable (visit).  E.g. include first and first*visit without including visit.


Of those, the 2-part model seems the most appropriate but it's a lot more work.  The others would probably get you something reasonable in a pinch.  You could even compare across the three approaches and get a crude sensitivity analysis that way.
A: If the outcome of interest is number of days since last visit, then first-time users don't provide any information about that outcome, so it seems like leaving out first time visitors is the only thing to do. 
In any case, coding first time users as 0 reflects a belief that first time users are equivalent to a person who has visited the website before, and whose last visit was 0 days ago, which doesn't make much sense. Therefore, I'd strongly advise against coding in this way, since it would seriously damage interpretability of your results.
A: My answer is neither.  You should code them as missing,  a simple dot for missing numerical data if you use SAS.  The use of 0 is bad because the software will treat 0 as a number when the data point is actually missing.  The use of NA is no good because you have a numerical variable and you are mixing character and numerical values for the same variable.  It might work in SAS though because I think SAS will convert values that it doesn't recognize into missing.  But play it safe identify those cases as missing numerical data.  The modeling procedure should know how to deal with that.
