Difference between data and variable and their types

00Comment iconComment iconComment iconComment icon

The variation field of each type of data to be researched is called a variable. What types of variables can we study?

Writer image

Translated byEditorial

Writer image

Revised byEditorial

Edit Article

Introduction

As already mentioned in the previous lesson, statistics aims at the collection, reduction, analysis, and modeling of data. When looking for answers to a proposed question, you conduct research. Regardless of your field or the research procedure (field research or paper-based source) or even your approach (quantitative or qualitative), data will be collected. [1]

The use of statistics

When we start a new project, we generally want to define a model to answer a question. This question can be:

- Hire a person or not?

- What is the amount we should pay for a product?

- What disease does the patient have?

We must then define what we should study to answer these questions. In this case, we will look at all the possible variables that will influence the answer. Based on the definition of the variables, we will collect data about them. Right after collection, we can remove biased data (for example, if we are going to evaluate how much we should pay for a football player, should we consider all matches, including friendlies, to evaluate them?). With these now corrected data, we will analyze each variable, for example, checking whether 38° is considered much above normal or a little for a sick person. Finally, we have data modeling, which will create an equation that actually answers the question.

Image content of the Website

Variable

To illustrate, imagine that at this moment a doctor would like to study a patient's heartbeats and would like to know whether they have a disease or not. They ask a series of questions:

- Do you exercise regularly?

- What is your cholesterol level?

- How many children do you have?

- How much do you weigh?

- What do you usually eat for lunch?

- ...

There are several questions that each doctor considers relevant, and their answers may represent correlations with the disease being studied. Each question in this case represents a VARIABLE; the variable refers to the phenomenon to be researched. A variable is defined as the range of variation of each type of data to be researched. The variables studied can be: [1]

Independent

It is the one that influences, determines, or affects a variable.

Dependent

It is the one that will be explained, as it is influenced or affected by the independent variable.

In the example, heart disease is the dependent variable studied that DEPENDS on the following independent variables: amount of exercise, cholesterol level, etc.

Variables can also be classified as: [3]

Qualitative

These are characteristics that do not have quantitative values but, instead, are defined by various categories, that is, they represent a classification of individuals.

Nominal

There is no ordering among the categories. Examples: sex, eye color, smoker/non-smoker, sick/healthy;

Ordinal

There is an ordering among the categories. Examples: education level (primary, secondary, tertiary), stage of the disease (initial, intermediate, terminal), month of observation (January, February,..., December).

Quantitative

Translates opinions and information into numbers so they can be classified and analyzed.

Discrete

Measurable characteristics that can assume only a finite or countably infinite number of values and, therefore, only integer values make sense. They are generally the result of counts. Examples: number of children, number of bacteria per liter of milk, number of cigarettes smoked per day;

Continuous

Measurable characteristics that assume values on a continuous scale (on the real line), for which fractional values make sense. They should usually be measured using some instrument. Examples: weight (scale), height (ruler), time (clock), blood pressure, age.

Summary

The distinctions are less rigid than the description above suggests. A variable originally quantitative can be collected in a qualitative way. For example, age, measured in completed years, is quantitative (continuous); but if only the age range is reported (0 to 5 years, 6 to 10 years, etc.), it is qualitative (ordinal). Another example is the weight of boxers, a quantitative (continuous) variable if we work with the value obtained on the scale, but qualitative (ordinal) if we classify it into boxing categories (featherweight, lightweight, heavyweight, etc.). [3]

Another important point is that a variable represented by numbers is not always quantitative.

A person's phone number, house number, identity number. Sometimes an individual's sex is recorded in the data spreadsheet as 1 if male and 2 if female, for example. This does not mean that the sex variable has become quantitative! [3]

The scheme below serves as a summary for understanding a variable:

Image content of the Website

Transforming ordinal qualitative variables into quantitative ones

When dealing with ordinal qualitative variables, such as "education level," "degree of satisfaction," or "stage of the disease," we know that there is an order, but we do not necessarily know the size of the difference between categories. To apply quantitative models, we can use statistical methods that respect this characteristic.

Below are the main methods for transforming ordinal variables into quantitative ones:

1. Simple ordinal coding (numeric labels)

This is the most basic form: we assign increasing whole numbers according to the order of the categories.

SatisfactionCode
Very bad1
Bad2
Fair3
Good4
Very good5

Advantages: easy to apply.

Disadvantages: implicitly assumes that the distances between categories are equal, which is generally not true.

2. Polynomial contrast (for statistical models)

Used in regressions (such as ANOVA or linear regression), this method codes ordinal categories in a way that respects the order, but also allows testing linear and quadratic effects of the categories.

For example, R or Python (with statsmodels) can automatically generate orthogonal contrasts for ordinal variables.

Advantages: preserves the order and is suitable for statistical models.

Disadvantages: less intuitive, and it requires knowledge of regression.

3. Scaling - Scoring by experts or data

You can assign weights based on prior knowledge or real data. For example, suppose a doctor classifies the stages of a disease based on average impact on health:

Stage of the diseaseAverage weight (score)
Mild1.5
Moderate3.0
Severe4.8

These values can come from: Analysis of real data (e.g., average number of hospitalizations by stage); Expert opinion; Likert-type scaling with weights derived from responses.

4. Categorical Principal Components Analysis (CATPCA)

It is an extension of PCA (principal components analysis) for qualitative variables. CATPCA tries to find ideal numerical values to represent ordinal categories, preserving most of the data variance.

Advantages: sophisticated and more faithful statistical method.

Disadvantages: requires statistical software (SPSS, R, Python with prince, quantification, etc.)

5. Multidimensional scaling or correspondence factor analysis

It makes it possible to represent ordinal (and even nominal) variables in numerical spaces, respecting relationships between categories based on data distance.

Comparative Summary of the Methods

MethodPreserves Order?Uses Data?Needs Software?
Polynomial Contrasts❌ (Excel or manual)
CATPCA / Optimal Scaling✅ (R, Python, SPSS)
Conditional Expectation❌ (Excel, R, Python)

Graphs

For human beings, the best way to convey information is visually.

> Graphs are an effective method of communication, since they effectively take advantage of cognitive mechanisms, particularly perception. The preference for graphs in the communication of information, as opposed to other non-pictorial forms (tables of numbers, lists of propositions, etc.), can be explained by the fact that pictorial presentation is visually more pleasurable. [5]

For the reasons mentioned above, different kinds of graphs should be studied so that we can communicate and better understand how each variable behaves. The best-known types of graphs are:

Bar chart

A bar chart displays data with discrete bars. The height represents the amount of data. It is widely used with qualitative variables because it separates each element.

Image content of the Website

Pie chart

It is intended to represent the composition, usually as a percentage, of parts of a whole. For this reason, it is also used for qualitative variables

Image content of the Website

Histogram

A histogram is a tool for analyzing and representing quantitative data; it is usually a vertical bar chart, grouped into frequency classes of a set of measurements. The difference between a histogram and a bar chart is that the bars in a histogram are intervals, while the bars in a bar chart can have only one variable value per bar. [6] Because it can represent intervals, it is widely used for quantitative variables.

Image content of the Website

Scatter plot

The scatter plot uses Cartesian coordinates to display values from a data set. The data are displayed as a collection of points. For this reason, it is used for quantitative variables.

Image content of the Website

More graphs with examples can be seen herelink outside website

Exercise

1) Classify the following variables

  1. lifetime of a motherboard.
  2. blood type
  3. race
  4. production of shock absorbers from an industry over a two-year period
  5. minutes
  6. honey production from the boxes of an apiary
  7. religion
  8. marital status
  9. number of people in line at a bank
  10. number of producers associated with a cooperative

Answers

  1. Continuous Quantitative
  2. Nominal Qualitative
  3. Nominal Qualitative
  4. Discrete Quantitative
  5. Continuous Quantitative
  6. Continuous Quantitative
  7. Nominal Qualitative
  8. Nominal Qualitative
  9. Discrete Quantitative
  10. Discrete Quantitative

References

[1] RODRIGUES, William Costa et al. Scientific methodology. Faetec/IST. Paracambi, p. 2-20, 2007.

[2] BUSSAB, Wilton de O.; MORETTIN, Pedro A. Basic statistics. Saraiva, 2017.

[3] http://leg.ufpr.br/~silvia/CE055/node8.html

[4] OF STATISTICS, CONCEPTS AND. IMPORTANCE. TYPES OF VARIABLES. Each one of us has a great responsibility: the choices we make for ourselves and for those around us will make a big difference in the future. With this vision, the Cesumar University Center assumes the commitment to democratize know, p. 30.

[5] CAZORLA, Irene Mauricio et al. The relationship between visuo-pictorial ability and mastery of statistical concepts in reading graphs. 2002.

[6] http://wiki.ued.ipleiria.pt/wikiEducacao/index.php/Histograma