# What to do with categorical data when calculating standardized z-scores?

I have numerous environmental variables I'd like to correlate to some tree species data. The environmental variables vary greatly in scale, so I'd like to standardize each by calculating standard z-scores (mean=0, SD=1) for each variable. However, The environmental data consist of a mix of continuous, integer, ordinal, and nominal variables. I'm not sure how to go about standardizing for categorical data.

My main two questions:

1. Are ordinal data treated the same as continuous data when calculating standardized z-scores?

2. How do I approach nominal variables when calculating standardized z-scores?

• #2 is easiest. z-scores make no sense for nominal data; the negative part of the definition of nominal data is that numerical coding is completely arbitrary so long as distinct values are coded distinctly. Ordinal data are sometimes treated as if they were measurements: purists regard that as unjustified and some pragmatists will argue that it is better than nothing. But the biggest question of all is why do you think you need standardize every variable? Correlations remain defined or undefined regardless of whether you standardize. – Nick Cox Dec 17 '15 at 19:31
• I am standardizing because the scale of my variables differ by orders of magnitude, and numerical analyses of these data will be dominated by whatever the biggest numbers are. – theforestecologist Dec 17 '15 at 21:16
• Also, I understand that it doesn't make sense to standardize nominal data. But How do I utilize it with all the other data? In my specific case, I am trying to run a series of partial Mantel tests with all of these variables. Do I simply just leave my nominal variable as is and not worry that it's values (though meaningless) are much higher than my standardized vales? – theforestecologist Dec 17 '15 at 21:19
• Good to hear that about nominal data; that's not the impression I had from your question. I am not well informed on partial Mantel tests. I'd suggest that to be a different question. – Nick Cox Dec 17 '15 at 22:11
• Possible duplicate of whether to rescale indicator / binary / dummy predictors for LASSO – kjetil b halvorsen May 21 '17 at 11:04

Are ordinal data treated the same as continuous data when calculating standardized z-scores?

No, they are not: When dealing with data on different measurement scales it is important that your analysis should not use mathematical operations that are not meaningful within that measurement scale. For ordinal data, only the ranking of the values in the scale is meaningful, and so you should only use operations that are invariant to all changes in the numbering of values that preserve rank-order. This counts out any operation that uses the arithmetic operations $$+$$, $$-$$, $$\times$$ and $$\div$$.

For ordinal data, the sample mean and sample standard deviation are not invariant to all changes in the numbering of values that preserve rank-order. This means that the sample mean and sample standard deviation are meaningless for ordinal data. Consequently, the z-score is also meaningless.

(Note: In some cases researchers treat apparently ordinal data as if it were interval or ratio data, which amounts to asserting that the differences/ratios in the ordered categories are meaningful. In this case there is often some argument over whether it is justifiable to treat data on a higher measurement level.)

How do I approach nominal variables when calculating standardized z-scores?

Nominal and ordinal variables do not allow use of the arithmetic operations $$+$$, $$-$$, $$\times$$ and $$\div$$, so the z-score for these variables is meaningless. For a nominal variable the only meaningful measures are those that count frequencies/relative frequencies of the categories and use the operations $$=$$ and $$\neq$$. For ordinal variables you also have meaningful measures for cumulative frequencies/relative frequencies using the operations $$<$$ and $$>$$ (taken in the order for the ordinal variable).

what is performed across a particular feature should be performed across all features to make sure they have a common scale in that sense what is done to a particular featuere has to be done to all the features is that right.

otherwise is it ok to find out a value that represents a feature typically

mean for a normally distributed curve, mode for a categorical feature , median in case of some outliers and so on and then centre the variables is that fine

• Hi. Welcome to Stats.SE. Could you please provide support o back up your answer. Thank you. – theforestecologist Aug 30 '18 at 2:18

You state that you need to standardise because otherwise some variables will dominate others. This seems surprising if what you want to do is to calculate correlations or do regression (which from your question seems likely). Similarly if you want to do variable reduction with principal component analysis. If you leave the variables in the original format it is much easier to interpret coefficients as they will be on the natural scale for you. Standardising converts them into an unnatural scale of standard deviations and makes them dependent on how much variability you have.