IntroductionAs we said in the previous lesson, statistics aims at the collection, reduction, analysis and modeling of data. When you look for answers to a question, you are doing research. Regardless of your field, the procedure (field research or literature research) or the approach (quantitative or qualitative), data will be collected [1].The use of statisticsWhen we start a new project, we usually want to define a model to answer a question. That question could be:Should we hire this person or not?How much should we pay for a product?What disease does the patient have?We must then define what to study to answer these questions, that is, list the variables that may influence the answer. Once the variables are defined, we collect data on them. Right after collection comes reduction: we remove or correct data that are biased or do not represent what we want to measure (for example, to assess how much to pay for a football player, should we consider every match, even friendlies?). With the corrected data, we analyze each variable, for example checking whether 38 °C is far above or only slightly above normal for a sick person. Finally comes data modeling, which builds an equation (a model) that actually answers the question.VariableAs an example, imagine a doctor who wants to study a patient's heartbeat and find out whether they have a heart disease. The doctor asks 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?...These are several questions the doctor considers relevant, and the answers may be correlated with the disease being studied. Each question here represents a VARIABLE: the variable is the characteristic of the phenomenon being researched. A variable is the set of values that each type of researched data can take; a datum is the value of that variable observed in one individual (for example, the variable is "weight" and the datum is "72 kg"). The variables studied can be [1]:IndependentThe one that influences, determines or affects another variable.DependentThe one we want to explain, because it is influenced or affected by the independent variable.In the example, heart disease is the dependent variable under study, which DEPENDS on the independent variables: amount of exercise, cholesterol level, etc.Variables can also be classified by the type of value they take [3]:QualitativeCharacteristics that have no quantitative values; instead, they are defined by categories, that is, they classify the individuals.NominalThere is no order among the categories. Examples: sex, eye color, smoker/non-smoker, sick/healthy.OrdinalThere is an order among the categories. Examples: education level (primary, secondary, higher education), disease stage (initial, intermediate, terminal), month of observation (January, February, ..., December).QuantitativeCharacteristics expressed by numbers that come from counting or measuring, with which it makes sense to do arithmetic (adding, taking the mean, etc.).DiscreteCharacteristics that can take only a finite or countably infinite number of values, usually whole numbers. They generally result from counting. Examples: number of children, number of bacteria per liter of milk, number of cigarettes smoked per day.ContinuousMeasurable characteristics that take values on a continuous scale (the real line), for which fractional values make sense. They are usually measured with some instrument. Examples: weight (scale), height (ruler), time (clock), blood pressure, age.A customer database has the columns: number of purchases in the year, postal code, amount spent in dollars and satisfaction level (low, medium, high). Which option classifies all four correctly, in that order?Answer: Discrete quantitative, nominal qualitative, continuous quantitative, ordinal qualitative — purchases are counted; the postal code is a code, and it makes no sense to add or average postal codes; the amount spent is a measurement; and satisfaction has ordered categories. The trap is treating the postal code as a number just because it is written with digits.A study wants to know whether weekly study hours affect the exam grade. Which is the dependent variable?Answer: The exam grade — it is what we want to explain; the study hours are the independent variable, the one that supposedly influences the grade.SummaryThe distinctions are less rigid than the description above suggests. A variable that is originally quantitative can be collected in a qualitative way. For example, age measured in completed years is quantitative; but if only the age group is reported (0 to 5 years, 6 to 10 years, etc.), it becomes qualitative (ordinal). Another example is the weight of boxers: it is a quantitative (continuous) variable if we work with the value read on the scale, but qualitative (ordinal) if we classify it into boxing weight classes (featherweight, lightweight, heavyweight, etc.) [3].Another important point is that not every variable represented by numbers is quantitative.A person's phone number, house number and ID number are examples. Sometimes a person's sex is recorded in the spreadsheet as 1 for male and 2 for female. That does not make sex a quantitative variable: the "mean" of these codes has no meaning at all [3].The diagram below summarizes the types of variable (in the figure: Variável = variable, Qualitativa = qualitative, Quantitativa = quantitative, Discreta = discrete, Contínua = continuous):Transforming ordinal qualitative variables into quantitative onesWhen we deal with ordinal qualitative variables, such as "education level", "satisfaction level" or "disease stage", we know there is an order, but not necessarily the size of the difference between categories. To apply quantitative models, we can use 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 approach: we assign increasing integers following the order of the categories.SatisfactionCodeVery poor1Poor2Fair3Good4Very good5Advantage: easy to apply.Disadvantage: it implicitly assumes that the distances between categories are equal (going from "Very poor" to "Poor" would be the same jump as from "Good" to "Very good"), which is usually not true.2. Polynomial contrasts (for statistical models)Used in regression models and ANOVA, they encode ordinal categories so that the order is respected and let us test whether the effect of the variable is linear, quadratic, etc. across the categories.R does this automatically for ordered factors (contr.poly), and in Python statsmodels accepts the formula C(x, Poly).Advantage: keeps the order and suits statistical models.Disadvantage: less intuitive, and requires knowledge of regression.3. Scaling: scores from experts or from dataYou can assign weights based on prior knowledge or on real data. For example, suppose a doctor scores the stages of a disease according to their average impact on health:Disease stageAverage weight (score)Mild1.5Moderate3.0Severe4.8These values can come from analysis of real data (e.g. average number of hospital admissions per stage), from expert opinion or from Likert-type scales with weights derived from the answers. Notice that the distances are no longer equal: the jump from "Moderate" to "Severe" (1.8) is larger than from "Mild" to "Moderate" (1.5).4. Categorical principal component analysis (CATPCA)An extension of PCA (principal component analysis) to qualitative variables. CATPCA looks for the optimal numeric values to represent ordinal categories (so-called optimal scaling), preserving most of the variance in the data.Advantage: a sophisticated statistical method, more faithful to the data.Disadvantage: requires statistical software (for example, SPSS's Categories module or the princals function of the Gifi package in R).5. Multidimensional scaling and correspondence analysisThey represent ordinal (and even nominal) variables in numeric spaces, respecting the relationships between categories based on the distances or associations observed in the data.Comparative summary of the methodsMethodPreserves order?Uses the data?Needs software?Simple ordinal coding✅❌❌ (by hand or Excel)Polynomial contrasts✅❌Helps (R, Python with statsmodels)Scores from experts or data✅Depends (✅ if the weights come from the data)❌ (by hand or Excel)CATPCA / optimal scaling✅✅✅ (SPSS, R)Multidimensional scaling / correspondence analysisNot necessarily✅✅ (R, Python, SPSS)A survey codes satisfaction as 1 = poor, 2 = fair, 3 = good and computes a mean of 2.0. What is the main caution when interpreting this number?Answer: The coding assumes the distance from poor to fair equals the distance from fair to good, which may not be true — that is the drawback of simple ordinal coding. Methods such as expert scoring or CATPCA look for more realistic distances.ChartsFor human beings, the visual form is usually the most efficient way to convey information:“Graphs are an effective method of communication, since they make effective use of cognitive mechanisms, particularly perception. The preference for graphs in communicating information, over other non-pictorial forms (tables of numbers, lists of propositions, etc.), can be explained by the fact that pictorial presentation is visually more pleasing.”- CAZORLA et al., 2002 [5]That is why it is worth studying different types of charts, to communicate better and understand how each variable behaves. The best-known types are:Bar chartA bar chart shows each category (or value) as a separate bar whose height represents the frequency or amount. It is widely used with qualitative variables precisely because it separates each category.Pie chartIt represents the composition of a whole, usually in percentages: each slice is one part. For this reason it is also used with qualitative variables.HistogramA histogram represents quantitative data grouped into frequency classes (intervals), with vertical bars touching one another. The difference between a histogram and a bar chart is that each bar of a histogram corresponds to an interval of values, while in a bar chart each bar corresponds to a single category or value of the variable [6]. Because it represents intervals, it is widely used with continuous quantitative variables. In the example below (axis labels in Portuguese: 'Número de Antas' is the count and 'Altura (metros)' is the height in meters), each bar counts how many cases have a height within a 20 cm range.Scatter plotA scatter plot uses Cartesian coordinates to show the values of two variables at once: each observation is a point. That is why it is used with quantitative variables, mainly to see whether one is related to the other.More charts with examples can be seen hereYou measured the delivery time, in minutes, of 500 orders and want to show how these times are distributed. Which chart is most suitable?Answer: A histogram with the times grouped into ranges — time is a continuous quantitative variable, and the histogram shows how many orders fall into each range (0 to 10 min, 10 to 20 min...). Pie and bar charts work for a few categories; with 500 slices or bars, nothing can be read.Exercise1) Classify the following variables:lifetime of a motherboard;blood type;race;production of shock absorbers by a factory (in units) over a two-year period;minutes;honey production of the hives in an apiary;religion;marital status;number of people in a bank queue;number of producers in a cooperative.AnswersContinuous quantitativeNominal qualitativeNominal qualitativeDiscrete quantitativeContinuous quantitative (as a measure of time)Continuous quantitativeNominal qualitativeNominal qualitativeDiscrete quantitativeDiscrete quantitativeReferences[1] RODRIGUES, William Costa et al. Metodologia científica (Scientific methodology). Faetec/IST. Paracambi, p. 2-20, 2007.[2] BUSSAB, Wilton de O.; MORETTIN, Pedro A. Estatística básica (Basic Statistics). Saraiva, 2017.[3] http://leg.ufpr.br/~silvia/CE055/node8.html[4] CENTRO UNIVERSITÁRIO CESUMAR. Estatística: conceitos, importância e tipos de variáveis (Statistics: concepts, importance and types of variables). Course material, p. 30.[5] CAZORLA, Irene Mauricio et al. A relação entre a habilidade viso-pictórica e o domínio de conceitos estatísticos na leitura de gráficos (The relationship between visual-pictorial ability and mastery of statistical concepts in reading graphs). 2002.[6] http://wiki.ued.ipleiria.pt/wikiEducacao/index.php/Histograma
ردود الفعل
0
0 تعليقات
كن أول من يعلق
لا شيء هنا بعد.