Section 13.16

Raw data versus derived data

Definition

Raw data are observations as an instrument or a program first recorded them, kept unchanged at a declared point of capture, together with the facts about how they were captured. Derived data are anything computed from raw data by later steps, such as decoding, unit conversion, filtering, grouping or estimation. The difference that matters is this: derived data can be recomputed from the raw data and a record of the steps, while raw data cannot be recomputed from anything, so losing them loses the evidence for good.

The idea

A plot reports that an operation took 5.5 ms. The instrument never measured milliseconds. It recorded two readings of a hardware counter, a small storage location in a chip that adds one at every tick of a clock: one reading at the start and one at the end. Between those readings and the plotted number lie several steps: decoding bytes into numbers, subtracting with the rule for a counter that passed its largest value and restarted at zero, converting ticks to milliseconds, deciding which attempts count, and averaging. Each step adds an assumption that can be wrong. If only the table of milliseconds survives, a wrong step cannot be found. If the two readings survive, every step can be checked and redone.

A photographer’s raw file is a fair picture. Every edited picture can be produced again from the raw file with different settings, but no edited picture can be turned back into the raw file. The picture stops being accurate in one respect, and the point carries over: even the raw file was shaped by the sensor and the electronics of the camera, as raw data are shaped by the instrument. Raw does not mean free of error. It means that no later step of the analysis has changed the data.

How it works

Keeping derived data traceable to raw data takes these steps.

  1. Declare the capture boundary: the exact point at which data count as raw, for example the bytes that a logging program wrote to a file as it received them from a device. Anything the device did before that point, such as converting readings to milliseconds itself, belongs to the instrument and is recorded as part of it.

  2. Store the raw data unchanged, together with the capture context: the instrument, its settings, the clock, the time of capture and the program that wrote the file. Identify each raw file by a digest, a short value that a cryptographic hash function §5.1 computes from the bytes, so that any later change is detectable.

  3. Make every transformation a recorded program. Each step from the raw data toward the plot is a program with a version and explicit parameters, such as the counter width, the tick rate and the eligibility rule. A transformation is deterministic when the same inputs and parameters always give the same output. A step that uses randomness, such as resampling (drawing random samples from the data), records its seed, the starting value of its random number generator.

  4. Record each derivation: for every derived file, the digests of its inputs, and the program version and parameters that produced it.

  5. Keep problems visible. Records that fail to decode, are missing or are excluded are counted and listed with a reason, not dropped silently.

  6. Never edit derived data by hand. Fix the program or the parameter, and compute again.

The chain of recorded derivations, followed from the plot back to the raw files, is the data lineage §13.18 of the plot.

Worked example

An 8-bit counter holds the values 0 to 255 and returns to 0 after 255; this is called counter wraparound §6.21. The raw data of one attempt are two bytes, the start reading 0xfa and the end reading 0x05, written in hexadecimal notation. A calibration §11.42 of the counter against a reference clock found 2 ticks per millisecond.

  1. Decode. 0xfa is 15×16+10=25015 \times 16 + 10 = 250, and 0x05 is 5.

  2. Subtract with wraparound. Plain subtraction gives 5−250=−2455 - 250 = -245 ticks, an impossible negative duration. The counter passed 255 and restarted at 0, so add 256: −245+256=11-245 + 256 = 11 ticks. This step is correct only if fewer than 256 ticks elapsed. With 256 or more, the true count could be 267, 523 or any other number that leaves the remainder 11 when divided by 256.

  3. Convert. 11/2=5.511 / 2 = 5.5 ms.

  4. Select and summarize. The eligibility rule keeps the attempt, and its 5.5 ms enters the plotted mean.

Now suppose the decoding program had wrongly assumed a 16-bit counter. Step 2 would add 65,536 instead of 256 and give −245+65,536=65,291-245 + 65{,}536 = 65{,}291 ticks, which is 65,291/2=32,645.565{,}291 / 2 = 32{,}645.5 ms. A plotted value of 32,645.5 ms does not show which counter width was assumed, and a plotted value of 5.5 ms does not show it either. With the two raw bytes and the recorded parameters, a reviewer recomputes each step and finds the wrong premise.

Stated precisely

Let RR be the raw data, the bytes stored at the capture boundary. A derived dataset DD is the result of a chain of kk transformations, D=fk(…f2(f1(R,p1),p2)…,pk),D = f_k(\dots f_2(f_1(R, p_1), p_2) \dots, p_k), where fjf_j is the program of step jj and pjp_j its parameters. DD is traceable when RR, every fjf_j with its version and every pjp_j are recorded, and every fjf_j is deterministic. Then anyone can recompute DD exactly from the record. Changing one fjf_j or one pjp_j can change DD while RR stays the same.

For the counter example, let ww be the counter width in bits, ss and ee the start and end readings, and rr the tick rate in ticks per millisecond. Write xmodmx \bmod m for the remainder of xx after division by mm, taken between 0 and m−1m - 1. The duration in milliseconds is d=(e−s)mod2wr.d = \frac{(e - s) \bmod 2^{w}}{r}. The formula rests on two assumptions: fewer than 2w2^{w} ticks elapsed between the two readings, and the tick rate equaled rr throughout the interval. With w=8w = 8, s=250s = 250, e=5e = 5 and r=2r = 2, the numerator is (5−250)mod256=11(5 - 250) \bmod 256 = 11 and d=11/2=5.5d = 11 / 2 = 5.5 ms.

Limits and common mistakes

Raw is not the same as true. An instrument can miss events, delay them, round them, or change the behavior it measures, which is called measurement perturbation §13.30. Keeping raw data preserves the evidence as it was captured; it does not make the capture correct.

Raw is relative to the capture boundary. If a device converts readings to milliseconds before the logging program sees them, the logged milliseconds are raw for the analysis but already contain the conversion, whose assumptions must be recorded.

A clean derived table does not replace raw data: a mean of 5.5 ms cannot be turned back into the readings that produced it.

Correct final arithmetic can hide a wrong earlier step, as the 16-bit decoding shows.

Derived data edited by hand, or produced with an unrecorded parameter or an unrecorded random seed, cannot be recomputed and therefore cannot be checked.

Deleting or overwriting raw data after deriving from them makes every later correction impossible. Raw data should be kept as immutable evidence §13.12, stored so that nobody can change them after capture.

Questions answered

Can a reviewer trace a plotted summary back through each deterministic transformation?

To reproduce a plotted value from the raw observations, retain the observations as captured and record each transformation, its program version and parameters, and which input and output bytes it used. Digests are one way to identify those bytes. A record can document the steps used even if an input has since been lost, but then that record alone cannot replay the whole calculation. A digest is a short value computed from the bytes of a file; in practice, any change to the bytes changes the digest. The reviewer starts at the plotted number, finds the derived file and the step that produced it, recomputes that step from its recorded inputs, checks that the output matches exactly, and repeats until reaching the raw data.

Each transformation must be deterministic, giving the same output for the same inputs and parameters; a step that uses randomness must have its seed recorded. Tracing stops at the first missing link: a hand edit, an unrecorded parameter or exclusion, or deleted raw data. A correct final average can hide a wrong earlier step, such as subtracting counter readings with the wrong counter width, which is why every step must be traceable.

Related entries: Chain of custody (§13.5), Data lineage (§13.18), Clock domain (§13.29), Counter quantization (§11.35), Counter wraparound (§6.21), Calibration (§11.42), Immutable evidence (§13.12).