Skip to content
Prev 247073 / 398503 Next

A question on dummy variable

You are not offering example of real codings but are rather showing  
something1 that you think looks like something2 (in R) that looks like  
something3 (in a textbook?). My guess is that the something2 might be  
contrast matrices or model matrices.

If you want a contrast matrix whose columns sum to zero (which is one  
possible situation that some people might call "centered" then look at  
the documentation for sum and poly contrasts. If you want to see a  
situation where model matrices are constructed which compare to the  
overall mean (another possible interpretation of "centered"), then  
look at the documentation for model.matrix and run the examples on  
that page with a -1 in the formula.