2.10 About Data Types 45
cles. However, there are vibrant and ongoing discussions and disagreements,
e.g., Veleman and Wilkinson (1993). Nominal data, such as race, gender, po-
litical affiliation, names, etc., cannot be ordered. For example, the counties
in northern Georgia, Cherokee, Clayton, Cobb, DeCalb, Douglas, Fulton, and
Gwinnett, cannot be ordered except that there is a nonessential alphabetical
order of their names. Of course, numerical attributes of these counties, such
as size, area, revenue, etc., can be ordered.
Ordinal data could be ordered and sometimes assigned numbers, although
the numbers would not convey their relative standing. For example, data on
the Likert scale have five levels of agreement: (1) Strongly Disagree, (2) Dis-
agree, (3) Neutral, (4) Agree, and (5) Strongly Agree; the numbers 1 to 5 are
assigned to the degree of agreement and have no quantitative meaning. The
difference between Agree and Neutral is not equal to the difference between
Disagree and Strongly Disagree. Other examples are the attributes “Low” and
“High” or student grades A, B, C, D, and F. It is an error to treat ordinal data
as numerical. Unfortunately this is a common mistake (e.g., GPA). Sometimes
T-shirt-size attributes, such as “small,” “medium,” “large,” and “x-large,” may
falsely enter the model as if they were measurements 1, 2, 3, and 4.
Nominal and ordinal data are examples of categorical data since the values
fall into categories.
Interval data refers to numerical data for which the differences can be well
interpreted. However, for this type of data, the origin is not defined in a nat-
ural way so the ratios would not make sense. Temperature is a good example.
We cannot say that a day in July with a temperature of 100
◦
F is twice as hot
as a day in November with a temperature of 50
◦
F. Test scores are another ex-
ample of interval data as a student who scores 100 on a midterm may not be
twice as good as a student who scores 50.
Ratio data are at the highest level; these are usually standard numerical
values for which ratios make sense and the origin is absolute. Length, weight,
and age are all examples of ratio data.
Interval and ratio data are examples of numerical data.
MATLAB provides a way to keep such heterogeneous data in a single struc-
ture array with a syntax resembling C language.
Structures are arrays comprised of structure elements and are accessed by
named fields. The fields (data containers) can contain any type of data. Storage
in the structure is allocated dynamically. The general syntax for a structure
format in MATLAB is
structurename(recordnumber).fieldname=data
For example,
patient.name = ’John Doe’;
patient.agegroup = 3;
patient.billing = 127.00;
patient.test = [79 75 73; 180 178 177.5; 220 210 205];
patient
%To expand the structure array, add subscripts.
patient(2).name = ’Ann Lane’;