Most variables in a data set can be classified into one of two major types.
Numerical variables
The values of a numerical variable are numbers. They can be further classified into discrete and continuous variables.
Statistical methods that can be used for continuous variables are not always appropriate for discrete variables.
The distinction between discrete and continuous variables is important.
A discrete variable can usually be identified as being a count, whereas a continuous variable is some other kind of measurement.
Categorical variables
The values of a categorical variable are selected from a small group of categories. Examples are gender (male or female) and marital status (never married, married, divorced or widowed).
Categorical variables can be further categorised into ordinal and nominal variables.
Most statistical methods for categorical data can be applied to both ordinal and nominal variables.
We rarely distinguish between ordinal and nominal variables in CAST.
Labels
In some data sets, each individual has a unique 'name' that can be used to identify it. We call such a variable a label variable. The labels may help us to identify unusual observations in the data set.
Warning!
Sometimes categorical variables are coded as numbers when the data are recorded (e.g. gender may be coded as 0 for males and 1 for females). The variable is still categorical, despite the use of numbers.
In a similar way, the individuals in a survey may be coded with a number that uniquely identifies them (perhaps to avoid storing names in the data for confidentiality). This is really a label variable and may be simply the row number in the data matrix.
When you see a column of numbers in your data matrix, do not assume that it is a numerical variable.
Characteristics of prostate cancer patients
Consider the following data set that describes characteristics of a group of patients on admission to hospital.
Name | Age | Marital status | PSA in blood | Smoking | Tumor size |
---|---|---|---|---|---|
John Smith | 54 | married | 45 | never smoked | small |
Mark Brown | 65 | widowed | 37 | current smoker | medium |
Adam Jones | 52 | divorced | 66 | former smoker | medium |
Stuart Robertson | 71 | married | 97 | never smoked | large |
... | ... | ... | ... | ... |
European countries
The diagram below shows some data about countries in Europe.
Membership of EU | Distinguishes between countries that joined the EU before 2000, those that joined from 2000 to 2004, between 2005 and 2014, were candidates in 2014, and others. |
---|---|
Lifetime | Male life expectancy in 2011. |
Fertility | Fertility rate per woman in 2012. |
BP | Mean systolic blood pressure for males aged 25+ in 2009. |
Measles | % of children aged 1 immunised in 2012. |
The data were obtained from the World Health Organisation (http://www3.who.int/whosis/menu.cfm).
The first of these variables is a nominal categorical variable and the others are continuous numerical ones. A map of Europe is coloured to represent the values of the variables.
Use the pop-up menu to select the variable to display on the map and investigate its distribution through Europe.
Click on a row of the data matrix or a country on the map to highlight it in both parts of the diagram.
Note that the some values are unknown (shaded in grey on the map).