Ok to use 0 and 1 for a varaible in a linear regression? Ok this is a simple quesion that's been bugging me. The question is how to encode a linear model variable with only two possible values and avoid any trouble introduced by using zero.
Say you have a linear model:
outcomeVariable ~ DayOrNight

How should you properly encode DayOrNight? There are only two choices and they're unordered. You could say DayOrNight is categorical independent variable.
Now, is it bad to fill the variable with entries of 0 or 1 as integers? It feels like an entry of zero would mean that term will always contribute zero to the outcomeVariable, no matter the beta coefficient. So will Beta only be meaningful when DayorNight=1?
If you choose -1 vs 1, or 1 vs 2, then your fit parameters and pvalues change. That troubles me.  
If you force that variable to be categorical in statsmodels or R, it's just like using 0 or 1. So maybe I'm paranoid and people have thought about this before and it's ok.
 A: Not only is it okay to code it as 0/1, it's common to do so.

It feels like an entry of zero would mean that term will always contribute zero to the outcomeVariable, no matter the beta coefficient.

Correct. This is not a problem. The intercept has the mean for the 0 category, and the coefficient for the 0/1 variable has the difference in means between the two categories.

So will Beta only be meaningful when DayorNight=1? If you choose -1 vs 1, or 1 vs 2, then your fit parameters and pvalues change. That troubles me.

The p-value for this variable shouldn't change from such recoding. The estimated coefficient will change, of course, and the coefficient (and p-value) for the intercept will change, because such recoding changes the meaning of the intercept.

If you force that variable to be categorical in statsmodels or R, it's just like using 0 or 1. 

It doesn't matter whether it's numeric or a factor. In R, if you use a two level factor (Say with levels Day and Night), it simply creates a 0/1 variable itself. You can see this by calling model.matrix on the RHS of your model formula.
