Variables and their roles
◈ 5 cardsCategorical or quantitative; discrete or continuous; response or explanatory — the classification that chooses the tool.
Two types, two subtypes each
A variable is what is recorded on each unit. Its type decides every later choice — which plot, which summary, which row of the cheat sheet.
Categorical (qualitative) — the value is a label. Nominal if the labels have no order (payment channel: cheque / e-transfer / card); ordinal if they do (credit rating 1–5, satisfaction poor / fair / good). Summarise with counts and proportions; the parameter is .
Quantitative (numerical) — the value is a number you can average. Discrete if it comes from counting (number of late invoices this month: 0, 1, 2, …); continuous if it comes from measuring and could take any value in an interval (days to pay, HST charged, hours of overtime). Summarise with a mean and SD; the parameter is .
The trap is a numeric code for a category. A channel coded 1 / 2 / 3 is still nominal; its average is meaningless. A rating of 1–5 is ordinal: the gap between 4 and 5 is not known to equal the gap between 1 and 2, and the paper will accept a median but query a mean.
Worked example — eight variables from an invoice file
A Waterloo distributor's invoice extract has eight columns. Classify each.
| Variable | Type |
|---|---|
| Days to pay | quantitative, continuous |
| Invoice amount ($) | quantitative, continuous |
| HST charged ($) | quantitative, continuous |
| Number of line items | quantitative, discrete |
| Payment channel (cheque / e-transfer / card) | categorical, nominal |
| Customer credit rating (1–5) | categorical, ordinal |
| Paid late? (yes / no) | categorical, nominal (binary) |
| Province of customer | categorical, nominal |
Dollar amounts are treated as continuous even though they are recorded to the cent — the scale is fine enough that averaging is meaningful and the distribution is modelled as continuous.
Roles come from the question, not the data
For a question of the form "does A affect B?", the variable being explained is the response () and the variable doing the explaining is the explanatory variable (). Does payment channel affect days to pay? — response: days to pay; explanatory: channel. The same variable can swap roles under a different question: Do slow payers get downgraded ratings? — now days to pay is explanatory and credit rating is the response.
Roles are assigned by the research question; they do not imply causation. Whether "affects" is a causal claim or merely an association is the subject of Lesson 2.6.