Statistical data type


In statistics, data can have any of various types. Statistical data types include categorical, directional, count, or real intervals.
The data type is a fundamental concept in statistics and controls what sorts of probability distributions can logically be used to describe the variable, the permissible operations on the variable, the type of regression analysis used to predict the variable, etc. The concept of data type is similar to the concept of level of measurement, but more specific. For example, count data requires a different distribution than non-negative real-valued data require, but both fall under the same level of measurement.
Various attempts have been made to produce a taxonomy of levels of measurement. The psychophysicist Stanley Smith Stevens defined nominal, ordinal, interval, and ratio scales. Nominal measurements do not have meaningful rank order among values, and permit any one-to-one transformation. Ordinal measurements have imprecise differences between consecutive values, but have a meaningful order to those values, and permit any order-preserving transformation. Interval measurements have meaningful distances between measurements defined, but the zero value is arbitrary, and permit any linear transformation. Ratio measurements have both a meaningful zero value and the distances between different measurements defined, and permit any rescaling transformation.
Because variables conforming only to nominal or ordinal measurements cannot be reasonably measured numerically, sometimes they are grouped together as categorical variables, whereas ratio and interval measurements are grouped together as quantitative variables, which can be either discrete or continuous, due to their numerical nature. Such distinctions can often be loosely correlated with data type in computer science, in that dichotomous categorical variables may be represented with the Boolean data type, polytomous categorical variables with arbitrarily assigned integers in the integral data type, and continuous variables with the real data type involving floating point computation. But the mapping of computer science data types to statistical data types depends on which categorization of the latter is being implemented.
Other categorizations have been proposed. For example, Mosteller and Tukey distinguished grades, ranks, counted fractions, counts, amounts, and balances. Nelder described continuous counts, continuous ratios, count ratios, and categorical modes of data. See also Chrisman, van den Berg.
The issue of whether or not it is appropriate to apply different kinds of statistical methods to data obtained from different kinds of measurement procedures is complicated by issues concerning the transformation of variables and the precise interpretation of research questions. "The relationship between the data and what they describe merely reflects the fact that certain kinds of statistical statements may have truth values which are not invariant under some transformations. Whether or not a transformation is sensible to contemplate depends on the question one is trying to answer".

Simple data types

The following table classifies the various simple data types, associated distributions, permissible operations, etc. Regardless of the logical possible values, all of these data types are generally coded using real numbers, because the theory of random variables often explicitly assumes that they hold real numbers.
Possible valuesExample usageCommon
Distributions
! Permissible statisticsCommon model
0, 1 binary outcome rowspan=2 Bernoullirowspan=2 mode, chi-squaredlogistic, probit
"name1", "name2", "name3",... "nameK" categorical outcome with names or places like "Rome", "Amsterdam", "Madrid", "London", "Washington" categoricalmultinomial logit, multinomial probit-mode, chi-squared-
ordering categories or integer or real number Ordering adverbs like "Small", "Medium", "Large", relative score, significant only for creating a rankingcategoricalordinal regression
0, 1,..., Nnumber of successes out of N possiblebinomial, beta-binomialmean, median, mode, standard deviation, correlationbinomial regression
nonnegative integers number of items in given interval/area/volumePoisson, binomial distribution|negative binomial]All statistics permitted for interval scales plus the following: geometric mean, harmonic mean, coefficient of variationPoisson, negative binomial regression
real numbertemperature in degree Celsius or degree Fahrenheit, relative distance, location parameter, etc. normal, etc. mean, median, mode, standard deviation, correlationstandard linear regression
positive real numbertemperature in kelvin, price, income, size, scale parameter, etc. log-normal, gamma, exponential, etc. All statistics permitted for interval scales plus the following: geometric mean, harmonic mean, coefficient of variationgeneralized linear model with logarithmic link

Multivariate data types

Data that cannot be described using a single number are often shoehorned into random vectors of real-valued random variables, although there is an increasing tendency to treat them on their own. Some examples:
These concepts originate in various scientific fields and frequently overlap in usage. As a result, it is very often the case that multiple concepts could potentially be applied to the same problem.

Comparison to programming data types

Most data types in statistics have comparable types in computer programming, and vice versa, as shown in the following table:
StatisticsProgramming
real-valued floating-point
real-valued floating-point
count data integer
binary dataBoolean
categorical dataenumerated type
random vectorlist or array
random matrixtwo-dimensional array
random treetree