Lesson 02 / 09
Types of Analytics
The 16 questions put to the same subscriber table are split into descriptive, diagnostic, predictive, and prescriptive, and the number of answerable questions moves between 2 and 7 depending on two decisions. Counting derived fields as present opens 5 questions, and raising the history depth required for a predictive question from 3 periods to 12 closes 2 questions. The four questions of the prescriptive type open under none of the four decision combinations, because the table holds a record of what happened and no record of what was tried.
Published Updated
In this lesson
- Separates the four types of analytics by the question they ask and the data they require
- Counts how many questions of each type in a question set can be answered with the data at hand
- Prints side by side how the number of answerable questions moves when the data decision changes
- Justifies the difference between the type that no decision opens and the type that does open
Contents
The previous lesson made a single question measurable: how many active subscribers there are in the network. The question itself was not questioned. Yet the questions that can be put to the same table are not of one kind, and when the kind changes, what is required of the table changes too. “How many subscribers are there” summarizes what stands in the record; “why did the subscriber count fall” asks for a cause; “how many subscribers will there be next month” asks for a forecast; “which subscriber should be visited first” asks for the result of an action.
This lesson separates the four kinds and measures which data each kind requires. The number measured is the count of questions in a question set that can be answered with the data at hand. That number also has a definition, and the definition depends on two decisions; when the two decisions change, the number of answers over the same 16 questions moves between 2 and 7.
- AC7. The data at hand is the subscriber table of the previous lesson; next to it, a four-month summary of the meter readings has been added. The history depth is four periods. Both the dataset and the questions are fiction.
- AC8. The question set consists of 16 questions, four from each type.
- AC9. A question counts as answerable when every field it requires either stands in the dataset or is derivable, and the history depth it requires is on hand. Whether the answer is correct is a separate question; what is measured here is the sufficiency of the data, not the quality of the answer.
- AC10. A derivable field does not stand on disk but is computed from fields that do. The computation requires a decision: the previous lesson’s question “which subscribers go into the denominator” comes up again in every derivation.
- AC11. Two decisions are measured. The first: whether a derivable field counts as “present” (strict reading) or does not (loose reading). The second: how many periods of history are required at minimum for a predictive question to count as answerable, 3 or 12.
Four Kinds of Questions
The four types correspond to four different tenses.
Descriptive analytics asks what happened. It summarizes what stands in the record: it counts, sums, takes ratios, breaks down. All of the work in the previous lesson was descriptive. The data it requires is the thing standing in the record itself; this makes its data request the lightest of the four types.
Diagnostic analytics asks why it happened. It asks for a cause, and if the cause does not stand in the record as a field, it asks for a comparison that can tell the cause apart. If the reason for closure was not recorded, comparing the subscribers who closed with those who did not yields an association; saying that the association is the cause is a separate decision and does not come out of the data.
Predictive analytics asks what will happen. It rests on the assumption that a pattern observed in the past will continue, and therefore it requires enough history to see the pattern. The question “how many periods are enough” has no answer that comes from the data; it is a threshold decision, and it is the second measure of this lesson.
Prescriptive analytics asks what should be done. It requires the result of an action: what happens if a discount is given, what changes if a visit is made. If the action was never tried, its result is not in the record; if it was tried but the result was not recorded, it is not there either.
The Data at Hand and the Question Set
// inventory.mjs — the data at hand and a question set; each question is a type and a data request. // A MODEL: both the fields and the questions come from the fiction of the regional measurement network. export const DEPTH = 4; // how many periods (monthly) of history are on hand export const HAVE = new Set(["subscriber id", "region", "tariff tier", "connection day", "closure day", "contract status", "last reading day", "monthly consumption", "monthly fee", "support request count"]); // A derivable field does not stand on disk but is computed from fields that do; the computation requires a decision. export const DERIVABLE = new Map([ ["subscriber age", "connection day"], ["closure rate", "closure day + contract status"], ["consumption per subscriber", "monthly consumption + subscriber id"], ["consumption change rate", "monthly consumption (four periods)"], ]); export const QUESTIONS = [ { s: "how many subscribers sent readings in the last 30 days", t: "descriptive", f: ["last reading day"], d: 1 }, { s: "which region has high consumption per subscriber", t: "descriptive", f: ["region", "consumption per subscriber"], d: 1 }, { s: "subscriber distribution by tariff tier", t: "descriptive", f: ["tariff tier"], d: 1 }, { s: "how did total consumption change over four months", t: "descriptive", f: ["consumption change rate"], d: 4 }, { s: "why did subscribers close their contracts", t: "diagnostic", f: ["closure reason"], d: 1 }, { s: "did the drop in readings come from an outage", t: "diagnostic", f: ["outage record"], d: 1 }, { s: "is the rise in support due to a tariff change", t: "diagnostic", f: ["support request count", "tariff change history"], d: 1 }, { s: "does the closure rate vary by tariff tier", t: "diagnostic", f: ["closure rate", "tariff tier"], d: 1 }, { s: "how many subscribers will close next month", t: "predictive", f: ["closure rate"], d: 1 }, { s: "what will total consumption be next quarter", t: "predictive", f: ["consumption change rate"], d: 4 }, { s: "which subscriber's meter will go silent next month", t: "predictive", f: ["reading history"], d: 1 }, { s: "what will the support request count be next month", t: "predictive", f: ["support history"], d: 1 }, { s: "which subscriber should get a field visit first", t: "prescriptive", f: ["intervention and outcome"], d: 1 }, { s: "will changing the tier reduce closures", t: "prescriptive", f: ["intervention and outcome", "tariff change history"], d: 1 }, { s: "which region should get the meter renewal budget", t: "prescriptive", f: ["intervention and outcome"], d: 1 }, { s: "should a closing subscriber be offered a discount", t: "prescriptive", f: ["intervention and outcome"], d: 1 }, ]; export const TYPES = ["descriptive", "diagnostic", "predictive", "prescriptive"]; // Two decisions: whether a derived field counts as "present", and how many periods of history a predictive question requires. export function missing(question, loose) { return question.f.filter((x) => !HAVE.has(x) && !(loose && DERIVABLE.has(x))); } export function answerable(question, loose, forecastDepth) { const required = question.t === "predictive" ? Math.max(question.d, forecastDepth) : question.d; return missing(question, loose).length === 0 && required <= DEPTH; } const gen = (B) => (h) => h.map((v, j) => (j ? String(v).padStart(B[j]) : String(v).padEnd(B[0]))).join(""); if (import.meta.url === `file://${process.argv[1]}`) { console.log(`${HAVE.size} fields and ${DEPTH} periods of history on hand; ` + `${DERIVABLE.size} fields are derivable\n`); const y = gen([55, 14, 9]); console.log(y(["question", "type", "periods"]) + " missing field (strict reading)"); for (const q of QUESTIONS) { const e = missing(q, false); console.log(y([q.s, q.t, q.d]) + " " + (e.length ? e.join(", ") : "-")); } }
10 fields and 4 periods of history on hand; 4 fields are derivable question type periods missing field (strict reading) how many subscribers sent readings in the last 30 days descriptive 1 - which region has high consumption per subscriber descriptive 1 consumption per subscriber subscriber distribution by tariff tier descriptive 1 - how did total consumption change over four months descriptive 4 consumption change rate why did subscribers close their contracts diagnostic 1 closure reason did the drop in readings come from an outage diagnostic 1 outage record is the rise in support due to a tariff change diagnostic 1 tariff change history does the closure rate vary by tariff tier diagnostic 1 closure rate how many subscribers will close next month predictive 1 closure rate what will total consumption be next quarter predictive 4 consumption change rate which subscriber's meter will go silent next month predictive 1 reading history what will the support request count be next month predictive 1 support history which subscriber should get a field visit first prescriptive 1 intervention and outcome will changing the tier reduce closures prescriptive 1 intervention and outcome, tariff change history which region should get the meter renewal budget prescriptive 1 intervention and outcome should a closing subscriber be offered a discount prescriptive 1 intervention and outcome
The last column splits the missing items into two groups. One group is derivable fields: consumption per subscriber, closure rate, consumption change rate. They do not stand on disk but are computed from fields that do. The other group is the fields that are not there at all: closure reason, outage record, reading history, support history, tariff change history, intervention and outcome. These cannot be produced by calculation, because they were not recorded at the source.
The distinction matters, because the first group is open to a decision and the second is not. Whether a derivable field counts as “present” is a reading preference. There is no such preference as counting a field that does not exist at all as present; until that data is collected, the question is unanswered.
Two Decisions, Two Numbers
// decision.mjs — the same 16 questions, the same table, two decisions: the answerable counts side by side. import { QUESTIONS, TYPES, DEPTH, answerable, missing } from "./inventory.mjs"; const COMBOS = [ { name: "strict / 3 periods", g: false, o: 3 }, { name: "loose / 3 periods", g: true, o: 3 }, { name: "strict / 12 periods", g: false, o: 12 }, { name: "loose / 12 periods", g: true, o: 12 }, ]; const gen = (B) => (h) => h.map((v, j) => (j ? String(v).padStart(B[j]) : String(v).padEnd(B[0]))).join(""); const y = gen([20, 13, 12, 12, 14, 8]); console.log(`${DEPTH} periods of history on hand; the numbers below are counts of answerable questions\n`); console.log(y(["decision combo", ...TYPES, "total"])); const totals = COMBOS.map((b) => { const c = TYPES.map((t) => QUESTIONS.filter((q) => q.t === t && answerable(q, b.g, b.o)).length); console.log(y([b.name, ...c, c.reduce((x, v) => x + v, 0)])); return c.reduce((x, v) => x + v, 0); }); console.log(`\nsame 16 questions: lowest ${Math.min(...totals)}, highest ${Math.max(...totals)} ` + `answers; difference ${Math.max(...totals) - Math.min(...totals)} questions`); const opened = QUESTIONS.filter((q) => !answerable(q, false, 3) && answerable(q, true, 3)); console.log(`when derived fields count as present, ${opened.length} questions open: ` + opened.map((q) => q.t).join(", ")); for (const t of TYPES) { const none = QUESTIONS.filter((q) => q.t === t) .every((q) => COMBOS.every((b) => !answerable(q, b.g, b.o))); if (none) { const n = QUESTIONS.filter((q) => q.t === t); const shared = [...new Set(n.flatMap((q) => missing(q, true)))]; console.log(`\n${t} type opens under none of the four decisions: ${n.length} questions, 0 answers`); console.log(`missing fields that no decision closes: ${shared.join(", ")}`); } }
4 periods of history on hand; the numbers below are counts of answerable questions decision combo descriptive diagnostic predictive prescriptive total strict / 3 periods 2 0 0 0 2 loose / 3 periods 4 1 2 0 7 strict / 12 periods 2 0 0 0 2 loose / 12 periods 4 1 0 0 5 same 16 questions: lowest 2, highest 7 answers; difference 5 questions when derived fields count as present, 5 questions open: descriptive, descriptive, diagnostic, predictive, predictive prescriptive type opens under none of the four decisions: 4 questions, 0 answers missing fields that no decision closes: intervention and outcome, tariff change history
Same table, same 16 questions; the number of answerable questions is between 2 and 7. The difference is 5 questions, nearly a third of the set. Neither of the two decisions touched the data; both changed the answer to the question “what do we have.”
The first decision alone has the largest effect. Counting derived fields as present opens 5 questions: two descriptive, one diagnostic, two predictive. This decision is not free. If the closure rate is to be derived, a denominator must be chosen, and the previous lesson showed that the denominator has three defensible values. So saying “the derivable field exists” means adding a new definition decision to the answer to the question. The loose reading opens the question but increases the number of decisions that must be written down along with it.
The second decision moves only the predictive row: when the depth requirement goes from 3 to 12, two predictive questions close and the total falls from 7 to 5. Four periods of history are on hand; this passes the requirement of 3 and fails the requirement of 12. The requirement itself is not read from the data. It is possible to argue that four periods will not show a yearly fluctuation, and it is also possible to argue that four periods are enough for a monthly forecast. What needs to be written in the report is which one was chosen.
The diagnostic row rises to 1 at most under the four decisions. The question that opens is whether the closure rate varies by tariff tier, and what it yields is an association: at which tier closure is more frequent. The conclusion that the tier is the cause of closure does not come out of this table. What could tell the cause apart is either a record of the closure reason or a comparison that changes the cause alone; the dataset has neither. That a diagnostic question counts as answerable does not mean the answer will be a cause.
The Gap That Does Not Close
The prescriptive column is zero in all four rows. This is the most robust number of the lesson, because it is not sensitive to any decision. The shared missing fields are two, and one of them is decisive: intervention and outcome.
The table is a record of what happened. Which subscriber’s contract closed, when it closed, how much the subscriber consumed before closing: all of it is written. What is not written is this: whether anything was done to that subscriber, and if so what was done, and what happened after it was done. Whether a discount offer reduces closures can be read only from a setup in which some subscribers were given the offer and some were not, and the outcomes of the two groups were recorded separately. If no such setup was built, this question stays unanswered however large the dataset grows.
The rule that follows is this: collecting data is an analysis decision, and it is made before the analysis. A network that answers prescriptive questions is a network that keeps intervention records knowing it will ask those questions. The type of record on hand determines which questions can be asked; when the question set grows, the record does not grow by itself.
Summary
- The four types of analytics ask four different questions: what happened (descriptive), why it happened (diagnostic), what will happen (predictive), what should be done (prescriptive). A change in type changes the data required from the table.
- Over the same 16 questions and the same table, the number of answerable questions moves between 2 and 7; two decisions produce this difference without touching the data at all.
- Counting a derived field as present opens 5 questions but every derivation adds a new definition decision; when the predictive depth requirement goes from 3 to 12, two questions close.
- A diagnostic question that counts as answerable yields an association; the record or comparison that could tell the cause apart is not in the dataset.
- The four questions of the prescriptive type open under none of the four decision combinations, because the dataset has no record of intervention and outcome; the decision to collect data is made before the analysis.
Next Step
This lesson and the previous one together may leave an impression: first a question is chosen, then its type is determined, then one checks whether the data is enough, then the calculation is done. It looks like a sequential list. In reality this list does not run once from start to finish. The window decision in the previous lesson became defensible only after the data was looked at; the depth requirement in this lesson gained a number only after the question set was written. In both, something learned in a later step changed a decision written in an earlier step. The next lesson builds the analysis workflow in five steps and counts how many times the workflow turns back.
To keep your progress and take notes, Log in
My notes
Log in to take notes.