Types of variables
Statistics 101
Duke University
Mine Çetinkaya-Rundel
Learning objective(s):
Identify variables as numerical and categorical.
If variable is numerical, further classify as continuous or discrete
based on whether or not the variable can take on an infinite
number of values or only whole numbers, respectively.
If variable is categorical, determine if it is ordinal based on
whether or not the levels have a natural ordering.
Figure: Figure 1.7, OpenIntro Statistics
all variables
categorical
numerical
continuous
Statistics 101 (Duke University)
discrete
regular
categorical
Types of variables
ordinal
Mine Çetinkaya-Rundel
1/4
Example: class survey
Students in an introductory statistics course were asked the following
questions as part of a class survey:
1
What is your gender, male or female?
2
Are you introverted or extraverted?
3
On average, how many hours of sleep do you get per night?
4
What is your bedtime: 8pm-10pm, 10pm-12am, 12am-2am, later
than 2am?
5
How many countries have you visited?
6
On a scale of 1 (very little) - 5 (a lot), how much do you dread
this semester?
Statistics 101 (Duke University)
Types of variables
Mine Çetinkaya-Rundel
2/4
Data
The data matrix below sample of responses shows a sample of
responses.
Columns represent variables.
Rows represent observations.
variable
data ⇒
matrix
Stu.
1
2
3
4
..
.
86
↓
gender
intro extra
male
female
female
female
male
..
.
Statistics 101 (Duke University)
dread
extravert
extravert
introvert
extravert
..
.
···
···
···
···
···
..
.
extravert
···
3
Types of variables
3
2
4
2
..
.
←
observation
Mine Çetinkaya-Rundel
3/4
Variable types
1
2
3
4
5
6
gender
sleep
bedtime
countries
dread
male
female
female
female
female
female
5
7
5
7
3
3
12-2
10-12
12-2
12-2
12-2
12-2
13
7
1
3
2
4
2
3
4
1
9
gender: categorical
no inherent order between male and female, therefore gender is not ordinal
sleep: numerical, continuous
even though data is reported as whole numbers, sleep is measured on a
continuous scale, people just tend to round their responses in surveys
bedtime: categorical, ordinal
there is an inherent ordering in these time intervals
countries: numerical, discrete
data are counted, and can only take on whole numbers
dread: categorical, ordinal, could also be used as numerical
categories have an inherent ordering
Statistics 101 (Duke University)
Types of variables
Mine Çetinkaya-Rundel
4/4