What is the difference between discrete data and continuous data?
Discrete data can only take particular values. There may potentially be an infinite number of those values, but each is distinct and there's no grey area in between. Discrete data can be numeric -- like numbers of apples -- but it can also be categorical -- like red or blue, or male or female, or good or bad.
Continuous data are not restricted to defined separate values, but can occupy any value over a continuous range. Between any two continuous data values, there may be an infinite number of others. Continuous data are always essentially numeric.
It sometimes makes sense to treat discrete data as continuous and the other way around:
For example, something like height is continuous, but often we don't really care too much about tiny differences and instead group heights into a number of discrete bins -- i.e. only measuring centimetres --.
Conversely, if we're counting large amounts of some discrete entity
-- i.e. grains of rice, or termites, or pennies in the economy -- we may choose not to think of 2,000,006 and 2,000,008 as crucially
different values but instead as nearby points on an approximate
It can also sometimes be useful to treat numeric data as categorical, eg: underweight, normal, obese. This is usually just another kind of binning.
It seldom makes sense to consider categorical data as continuous.
Data is always discrete. Given a sample of
n values on a variable, the maximum number of distinct values the variable can take is equal to
n. See this quote
All actual sample spaces are discrete, and all observable random variables have discrete distributions. The continuous distribution is a mathematical construction, suitable for mathematical treatment, but not practically observable. E.J.G. Pitman (1979, p. 1).
Data on a variable are typically assumed to be drawn from a random variable. The random variable is continuous over a range if there is an infinite number of possible values that the variable can take between any two different points in the range. For example, height, weight, and time are typically assumed to be continuous. Of course, any measurement of these variables will be finitely accurate and in some sense discrete.
It is useful to distinguish between ordered (i.e., ordinal), unordered (i.e., nominal),
and binary discrete variables.
Some introductory textbooks confuse a continuous variable with a numeric variable. For example, a score on a computer game is discrete even though it is numeric.
Some introductory textbooks confuse a ratio variable with continuous variables. A count variable is a ratio variable, but it is not continuous.
In actual practice, a variable is often treated as continuous when it can take on a sufficiently large number of different values.
- Pitman, E. J. G. 1979. Some basic theory for statistical inference. London: Chapman and Hall. Note: I found the quote in the introduction of Chapter 2 of Murray Aitkin's book Statistical Inference: An Integrated Bayesian/Likelihood Approach
Temperatures are continuous. It can be 23 degrees, 23.1 degrees, 23.100004 degrees.
Sex is discrete. You can only be male or female (in classical thinking anyways). Something you could represent with a whole number like 1, 2, etc
The difference is important as many statistical and data mining algorithms can handle one type but not the other. For example in regular regression, the Y must be continuous. In logistic regression the Y is discrete.
Discrete Data can only take certain values.
Example: the number of students in a class (you can't have half a student).
Continuous Data is data that can take any value (within a range)
- A person's height: could be any value (within the range of human heights), not just certain fixed heights,
- Time in a race: you could even measure it to fractions of a second,
- A dog's weight,
- The length of a leaf,
- The weight of a person,
In the case of database, we would always store the data in discrete even the nature of the data is continuous. Why should I emphasize the nature of data? We should take the distribution of data that could help us to analyze the data. IF the nature of data is continuous, I suggest you to use them by continuous analysis.
Take an example of continuous and discrete: MP3. Even the type of "sound" is analogy, if stored by digital format. We should analyze it always in a analogy way.
On the one hand, from a practical point of view I do agree with Jeromy Anglim's answer. In the end we are most of the time dealing with discrete variables – although from a theoretical point of view they are continuous – and that has a real impact for instance for classification. Recall Strobl's paper indicating that Random Forests is biased towards variables with multiple cutting points (higher accuracy but potentially similar nature). From my personal experience probabilistic neural networks may present also a bias when variables present different accuracy unless they are of the same type (i.e., continuous). On the other hand, from a theoretical point of view the classical classification (e.g., continuous, discrete, nominal etc.) is, IMHO, right. In accordance I think that the source name of Quinlan’s paper describing the M5 algorithm, which is a ‘regressor’, is a great choice. So the definition and the implications of continuous vs. discrete are relevant depending on the ‘environment’.
Quinlan J.R. (1992). Learning with continuous classes. In: The 5th Australian Joint Conference on AI. Sydney (Australia), 343–348.
Strobl C., Boulesteix A.-L., Zeileis A., & Hothorn T. (2007). Bias in random forest variable importance measures: illustrations, sources and a solution. BMC Bioinformatics, 8, 25. doi: 10.1186/1471-2105-8-25
Discrete data can take on only integer values whereas continuous data can take on any value. For instance the number of cancer patients treated by a hospital each year is discrete but your weight is continuous. Some data are continuous but measured in a discrete way e.g. your age. It is common to report your age as say, 31.