Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The first variable is 'SMOKE' that indicate if the person is a smoker or not. The second variable 'Daily' is related to the first by an If condition: If the person is a smoker then does he smoke daily or not.

How can I put these two variables in my model?

Thanks in advance,

EDIT: (1)I prefer to exploit the evident ordering from non-smoking to smoker to daily smoker. (If this will be significant in my model)

(2) Smoking is an independant variable in my model (In fact, It's a risk factor for a disease)

share|improve this question
Whether any suggested solution is appropriate will depend on two things, which I hope you can clarify in an edit to your question: (1) Do you hope to exploit the evident ordering from non-smoking to smoker to daily smoker? (2) Will this variable be used as an independent variable or dependent (response) variable in the model? – whuber Apr 29 '14 at 15:54
Thank you, I have edited my question, how can I choose the appropriate method then? – user42987 Apr 29 '14 at 16:20

I would simply encode the 'product' of the variables, so instead of:


You would then have:


Ultimately resulting in interaction variables. The advantage is, that you can now also include additional categories such as monthly by adding one variable. Also, you don't lose the semantic of each category and it will be easy to inspect the outcoming models.

As to your edit, if you want to preserve order (which order?), you might want to make a continuous variable with different frequency levels (for instance: daily = 1/1, weekly = 1/7, ..., non-smoker = 0).

share|improve this answer

Code the variable 'SMOKE' as 0 (for non smoker) and 1 (for smoker). The variable 'Daily' should be coded as 1 for daily smoker and 0 for all other cases. Multiply the two together to get an interaction variable.

share|improve this answer
Please, how can I interpret the interaction between these two variable? Thanks ! – user42987 May 2 '14 at 17:12
You need both the SMOKE and interaction variables in your model, but not the Daily variable. The parameter associated with the interaction variable is interpreted as the effect of daily smoking (in addition to just smoking). Don't get hung up on the interaction bit, the multiplication is just an implementation of the IF condition you want, (which incidentally is what interactions is) – user1593755 May 9 '14 at 13:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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