# data representation with nominal, ordinal and continuous variables

Suppose I have data of this format:

customer, country, location, unit price, traffic, etc. (more nominal/ordinal variables)

I want to know how country affects unit price, how do I go about doing this using

a. some measures of dependence b. regression models

I'm totally confused as to how i could represent this data for fitting a model since country is nominal and there is a set of prices (with some frequencies) for every country.

Thank you.

• The hard part of this question concerns how to cope with a discrete set of values of your dependent variable, the unit prices. Could you please then tell us a little more about them? Why are these prices limited to just a few values? How many distinct values are there?
– whuber
Apr 28, 2014 at 20:41
• @whuber extremely sorry, I realised an edit: unit prices are continuous. Should I record some statistics measuring bivariate dependence on nominal variables {One way ANOVA, mutual information, Kruskal Wallis etc.} ? Would that make sense as an apriori to regression analysis? Apr 29, 2014 at 6:50

## 2 Answers

for the use of nominal data, please look up dummy variables for regression models. if you have N countries, introduce N-1 new variables. each country is represented by a dummy variable apart from 1 (because of linear dependency). If a row (sample) contains a country, the corresponding dummy variable will be 1, all the other 0. This also allows you to see which countries are relevant for your model. I hope this will help your on your way looking more into regression.

It sounds like a textbook application for multilevel models/hierarchical models/mixed models. If you have many countries, then if think about it, you do not want to include to dozens to hundreds of indicator/dummy variables for each country. If location is similarly defined you may run to many thousands of indicators variables presenting you with difficult to organize results, and a great loss of statistical power as your degrees of freedom drop with each additional variable. If each country has characteristics that may affect its effect on price, then you can really see the too many variables issue blowing up.

With a multilevel modeling approach you might instead treat each country as contributing its own unique variance to the constant/intercept term in your model, and the include country-level variables as predictors without having to interact them across dozens, hundreds or thousands of indicators variables.

For a good introductory read to orient you to these kinds of models, see Duncan, C., Jones, K., and Moon, G. (1998). Context, composition and heterogeneity: Using multilevel models in health research. Social Science & Medicine, 46(1):97–117.

• +1 Thanks, this seems like THE approach. What I was also thinking was to use some sort of tree based segmentation (CART etc.) on nominal variables and then performing a regression analysis on each segment. What do you think? Apr 29, 2014 at 6:56