I have a nominal categorical predictor and a continuous dependent variable..I want to perform linear regression using lm in R. If the contrasts are such that the resulting dummy variables are uncorrelated then the regression is merely the direct linear combination of dummy variables weighted by their respective coefficients obtained from regression of continuous variable with individual dummy variable..To have this advantage what way should the categorical predictor be contrast coded?I found this method here .. It is helpful but the only problem is the order seems to be important here..The relation between only adjacent categories can be interpreted from the result of linear regression..

So my question is - for nominal categorical predictor is there anyway to get good insights about dependent variable at category level of the predictor from regression analysis.

edit :

I'd like to provide some clarifications here

Why do i need uncorrelated dummies?

bcoz in case of uncorrelated dummies i need not worry about which dummy enters the regression model first. The p value for the dummy1 is different when it enters the model second when compared to that when it enters first..By 'enters the model' i mean stepwise linear regression..So to avoid that problems i want them to be uncorrelated.

But if you see the pain vs treatment regression from the link provided by me the order certainly matters while doing contrast coding..I have no prior knowledge of the categories of my nominal category variable..so i cant order them like in pain vs treatment case. For more details - my dependent variable is Sales and category variable is product category which has 15 categories.


1 Answer 1


To answer the question in the last paragraph, yes, there is, which is to look at predictions of the dependent variable given whatever values of the predictors you're interested in. The virtue of this approach is that it's agnostic to how you coded the predictors*, so you don't have to worry about contrast coding or the interpretation of coefficients or the like.

* Well, there are some coding decisions that can actually change the model's predictions, such as whether you combine multiple distinct values into a single predictor, but whether you use contrast coding, effects coding, or dummy coding, and how you apply these methods, are not such coding decisions. Not in plain linear regression, anyway. But if you're ever unsure whether something will change the model's predictions, just try it and see.

  • $\begingroup$ like is said i want insights at category level of the nominal predictor..i.e.,something along the lines of "chairs sales is significantly higher than tables & sofas sales whereas there is no significant difference between sales of sofas and tables"..and i agree that contrast coding type doesn't exactly change the underlying statistics and that it only helps the interpretation of results..but interpretation of results is what i am worried about.. $\endgroup$
    – sadhana
    Commented May 1, 2015 at 7:04
  • $\begingroup$ The strategy described above would indeed let you look at the difference between chair sales and table sales. It is not useful for significance testing, but significance testing is not the only source of "insights". $\endgroup$ Commented May 1, 2015 at 11:28

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.