Scientific Computing and Reproducible Workflows, TMP-SCI-204. These solutions explain mathematical and computational expectations for fictional data. They do not establish learner execution. Accept equivalent exact forms and justified interpretations; do not accept a correct final number as a substitute for naming its population and denominator.
Quiz totals 30 and project 40 formative points. These are separate groups, not a calibrated course grade or qualification. Q5 reserves one point for actual execution; P2 reserves five. Trace-only work cannot earn those six points. Preserve first attempts, revised policies and corrections rather than replacing the evidence of how a result was obtained.
Readiness
R1
The sum is 24 and there are four observed values, giving mean 6. Zero is a measured concentration in this exercise, so it contributes one observation to the denominator even though it adds nothing to the sum. Dropping it gives 24/3=8, a different and unjustified summary of the stated list. Missing and zero are different data states.
R2
Not generally. The pooled mean weights the first site's mean by four observations and the second by two. Averaging site means gives each site equal weight. These can coincide if the site means are equal or if the counts are equal, but neither condition holds automatically. Name the unit receiving equal weight before choosing an average.
R3
Null does not establish any numerical concentration. A reliable observation record showing a measured zero, under the stated measurement/quality process, could justify a zero value. A missing instrument reading, a failed export or a desire for a complete numeric column does not. A hypothetical zero may be examined as a labelled scenario, but must not be relabelled measured evidence.
R4
No. Distinct samples can produce the same numerical value. Identity, acquisition records and the row contract determine whether a row is a duplicate. Dropping rows merely because their values match can selectively remove legitimate observations. Conversely, different numerical values with a reused sample ID violate this packet's one-result-per-slot contract and require investigation rather than automatic acceptance.
Guided practice
G1
Site-table site_id is the unique metadata key; label is its human-readable name. Sample-table sample_id uniquely identifies the planned physical slot; site_id is the reference linking that slot to its site. value_ug_l represents a concentration in micrograms per litre, with null meaning unavailable, and qc provides the accepted/flagged status used by the explicit inclusion policy.
The site_id field appears in both tables, so six field-name occurrences across the two schemas involve five distinct names. A learner need not memorize that counting detail, but must explain both roles of site_id. Units determine which quantities can meaningfully be combined. Row meaning determines whether six rows are six physical samples, repeated assays or something else. Neither is supplied by JSON syntax alone.
G2
All three are refused. Duplicate metadata key A makes a sample-to-label match ambiguous and can multiply rows under naive expansion. An unknown X has no declared metadata match; silently dropping B3 would alter planned/eligible counts. Reusing A1 for different physical samples makes identity ambiguous. Validation covers the entire packet before QC exclusions, so flagged rows cannot hide these structural defects. Preserve the original and investigate source evidence; do not invent keys, overwrite the old packet or treat deletion as scientific correction.
G3
A1–A4 are included, A5 is flagged, B1–B2 are included, B3 is missing. Planned=8, excluded_flagged=1, eligible=7, excluded_missing=1, included=6. Thus 8=1+7 and 7=1+6, or equivalently 8=1+1+6. The two exclusion categories are disjoint primary decisions under the specified ordering.
If A5 is flagged and null, its default primary reason remains flagged. If flagged rows are permitted, it becomes eligible but is then excluded as missing. In that alternative, flagged exclusion count is zero and missing exclusion count is two. Counting every raw null and every raw flagged attribute independently and adding them would double-count A5. The audit makes the ordering visible.
G4
Pooled row mean=(24+28)/(4+2)=52/6=26/3. Equivalently (4×6+2×14)/6=26/3. Mean of observed-site means=(6+14)/2=10, giving A and B equal site weights rather than observation-count weights. A contributes twice as many observations as B to the pooled result, but equal weight to the site-balanced result.
C has no observations and an undefined observed mean. Its zero arithmetic sum is an empty-sum identity, not a zero measurement. The site-balanced summary therefore covers two observed sites, not all three declared sites. None of these descriptive calculations establishes random sampling, representativeness, a controlled intervention or a cause of the site difference. Even exact arithmetic cannot add that missing study-design information.
G5
Including flagged A5 adds 16 and one observation: sum=68, n=7, pooled=68/7. A mean becomes 40/5=8, B remains 14, and the mean of the two observed-site means becomes 11. The changed decision is A5: flagged to included. B3 remains missing.
Separately, under default QC, genuinely measuring B3 as zero keeps sum 52 but raises included count from six to seven, yielding 52/7. A stays at mean 6; B becomes 28/3, and their mean is (6+28/3)/2=23/3. This alternative does not include A5. Combining the changes would answer another question and must be explicitly specified. Neither a sensitivity flag nor a hypothetical substitution is evidence of valid measurement.
G6
Default QC leaves seven eligible planned slots: six observed and one missing. Let the missing concentration x lie in [0,20]. Then complete eligible mean=(52+x)/7, between 52/7 and 72/7, inclusive. The denominator is fixed by the selected planned slots, not just available values and not every planned row regardless of QC.
These are deterministic conditional bounds. They require the missing-value premise but no probability distribution or independence assumption. They do not estimate a confidence level, repair the raw dataset, establish unbiased missingness, or provide a site-balanced mean across C. The observed mean 26/3 and the bounded complete-eligible mean answer different questions and should appear with different labels.
Independent practice
I1
Duplicating A's four included rows adds sum 24 and count 4 to the original sum 52/count 6. The incorrect expanded table has sum 76, count 10 and mean 76/10=38/5=7.6. It overweights A even more than the original pooled mean; it does not create equal site weights. Metadata multiplicity, not a declared scientific weighting scheme, caused the change. The proper unique-key validator rejects the ambiguous lookup before producing this result.
I2
Counts, concentration sums, pooled mean, site means, observed-site count and audit decisions should remain unchanged. Site ID A still identifies the same group. The label appears in report and summary, so those bytes and their hashes may change. Raw input bytes and hash also change if the label is edited in the input. Distinguish a display-metadata correction from a measurement/policy change; preserve a record of the revision.
I3
Order-independent totals, group summaries and exclusion counts stay the same. The audit retains original sequence and row numbers, so it changes. Serializing the reversed input changes its bytes and normally its digest. Because audit order is part of report.json, complete report bytes also change even if all numerical totals remain equal. This is not irreproducibility: the input changed in a documented way. Two different files can encode the same multiset of observations without being byte-identical.
I4
With one accepted missing slot, observed count is zero and observed mean is undefined. The complete selected population contains one value x in [2,8], so its conditional mean lies in [2,8]. With no eligible slots at all, there is no denominator for either observed or complete-eligible mean, and both remain undefined. Return null/explicit text rather than dividing by zero or fabricating zero. A table can retain useful missing-value constraints without pretending to contain an observation.
I5
Examples:
- Accepted zero must be included, increasing the count but not the sum. This checks data handling, not whether a real instrument observed zero correctly.
- Flagged null under default policy must have one primary flagged exclusion; with flagged inclusion it becomes a missing exclusion. This checks accounting, not scientific acceptability.
- A validly shaped sample referencing an unknown site must raise an error before output creation. This checks referential completeness, not whether all real sites were sampled.
- Two rows with the same sample ID must be rejected even if one is flagged. This checks identity uniqueness, not whether two distinct IDs secretly refer to the same physical object.
Use independently specified expected decisions. Reusing the analyzer's own group builder to construct expected values would not provide an independent check.
I6
Site differences can reflect sampling times, collection procedures, environmental context, instrument/calibration differences or other uncontrolled conditions. The packet supplies no randomized intervention or causal design. It also supplies no sampling frame, inclusion probabilities, full-region coverage or evidence that these sites represent a broader region. Two observed sites with unequal numbers of observations and one unobserved declared site are insufficient to infer those properties. Descriptive statements about the supplied values are warranted; stronger claims require additional design and evidence.
Audit
H1
Nonnumeric states have different meanings. Null means unavailable; site labels and IDs are metadata/identity; qc describes a policy status. Replacing all such fields with zero destroys information and may produce false observations. Even within the concentration column, a null-to-zero replacement changes the denominator and asserts a numerical value that was not measured. Explicit bounded scenarios can explore assumptions without rewriting the original data.
H2
Specify the included population, unit receiving equal weight, QC/missingness policy, counts and sites covered. The pooled mean is the mean of included sample observations; the other is an equally weighted mean of available site means over two observed sites. Reproducibility means a documented calculation can be repeated under its inputs/options, not that an ambiguous label is acceptable or that its scientific purpose is appropriate.
H3
Scenario width depends on the assumed bounds and selected denominator. It does not diagnose selection bias, prove missingness is harmless, establish representativeness or supply a probability coverage level. No random model or 95% construction was provided. A narrow interval can be based on an unjustifiably narrow premise. State the premise and what evidence could make it credible, not an invented confidence claim.
Quiz: 30 formative points
Q1 — 6 points
Planned=6. B2 is QC-excluded, so eligible=5. A3 is missing, so included=4. Exclusions are flagged=1, missing=1. A's observed sum is 6 across two values, mean 3. B's observed sum is 26 across two values, mean 13. Pooled sum=32, count=4, mean 8. Mean of observed-site means=(3+13)/2=8. C remains undefined, so two of three declared sites contribute.
The two summaries coincide because each observed site contributes the same count. This equality is a property of this packet, not a reason to erase the distinction between sample and site weighting.
Rubric: counts and exclusions 2; site means and C status 1; pooled arithmetic 1; site-balanced arithmetic 1; equal-count explanation 1.
Q2 — 6 points
B2 changes from flagged exclusion to included. Added value=13; sum becomes 45 and included count 5, so pooled mean=9. A mean stays 3. B mean is (9+13+17)/3=13, so the mean of observed-site means remains 8. A3 stays missing. The differing movement of the two summaries is a useful diagnostic of their different weights; it is not a program inconsistency.
Rubric: changed decision/count/sum 2; pooled mean 1; site means and mean-of-means 2; correct interpretation/policy limit 1. No evidence is supplied that the flagged result is now reliable.
Q3 — 6 points
Under default QC, selected population contains five eligible slots with sum 32 among four observed values and one missing value x in [0,15]. Complete mean belongs to [32/5,47/5]=[6.4,9.4]. The bound applies only to the missing eligible value. B3=17 is an observed value, so it does not contradict that specific premise. If the intended premise were instead “all values are at most 15,” it would conflict with the observed packet and need revision.
Rubric: eligible denominator/missing count 2; endpoint arithmetic 2; missing-only versus all-values distinction 1; conditional-not-confidence interpretation 1.
Q4 — 6 points
An unknown site violates the data dictionary's required match. Silently discarding the sample can change planned/eligible counts and summaries while hiding the structural problem. Preserve original bytes and report the exact sample/reference mismatch. Inspect reliable metadata/acquisition evidence; if a correction is supported, record it in a separate revised packet and rerun with the same intended policy, preserving both runs. If evidence is unavailable, do not invent a match or assert a complete analysis.
Rubric: validation issue 2; population/denominator effect 1; original preservation 1; evidence-based correction/revision 1; honest unresolved status if evidence absent 1.
Q5 — 6 points
One suitable record predicts default observed mean 8 and missing bounds [32/5,47/5], runs the quiz with --missing-range 0 15, then reproduces from saved source/input into another new directory with that same option. A discriminating comparison includes flagged B2 and predicts pooled 9 while observed-site mean remains 8. Verify counts and independent arithmetic, not only matching files. Note that all data are fictional and no missing-value premise or real measurement process was empirically verified.
Rubric: predictions 1; reproducible input/source/options plan 1; correct results/status distinction 1; discriminating independent test 1; limitation and truthful execution/trace label 1; genuine actual execution evidence 1. Trace-only maximum is 5/6.
Project: 40 formative points
P1 — 8 points
Included: A1,A2,A3,B1,B2. Missing: A4,B4. Flagged: B3. Planned=8; eligible=7; included=5; excluded_flagged=1; excluded_missing=2. Included sum=2+6+10+8+12=38. A sum18/n3 gives mean6. B sum20/n2 gives mean10. Pooled mean=38/5=7.6. Mean of two observed-site means=(6+10)/2=8. C has no observations and remains outside that last denominator.
Rubric: complete decisions and disjoint accounting 2; counts/sum 2; site means/C 1; pooled result/population 1; observed-site result/population 1; appropriate units and no all-site overclaim 1.
P2 — 8 points
The default project run with --missing-range 0 18 should report observed mean 38/5, mean of observed-site means 8 and complete-eligible bounds [38/7,74/7]. Preserve input/source/structured report/text summary plus the manifest. Reproduce from that saved source and input, using the same missing-range option in a second new directory. Independently verify all four known-file hashes and compare report/summary bytes. Changed path/argv fields in the run metadata are expected.
Rubric: independent predicted values 2; correct preservation/comparison plan 1; authentic first run 2; authentic repeat-from-snapshot run 2; actually checked hashes/report/summary comparison 1. The final five points require execution; trace maximum is 3/8. A written command or proposed check is not evidence of its execution.
P3 — 8 points
Default selected population contains seven slots, with five observed values summing to 38 and two missing values each in [0,18]. Complete mean bounds are [38/7,(38+36)/7]=[38/7,74/7], approximately [5.4286,10.5714].
Separately permitting flagged B3 adds 16: observed sum54, n6, pooled mean9. A remains mean6; B becomes (8+12+16)/3=12; mean of observed-site means9. All eight planned slots are now QC-eligible, still with two missing values. Complete-eligible bounds become [54/8,(54+36)/8]=[27/4,45/4]=[6.75,11.25]. These denominators changed because the QC population changed, not because missing observations were measured.
Rubric: default denominator/bounds 2; revised observed counts/pooled mean 2; revised site means/site-balanced result 1; revised missing bounds 2; clear alternative-population/assumption explanation 1.
P4 — 8 points
With reliable new evidence A4=0 and default QC retained, B3 stays excluded. Sum remains38 but observed count rises to6, so pooled mean=38/6=19/3. A has sum18 over four observations, mean9/2. B stays mean10; mean of observed-site means=(9/2+10)/2=29/4. Eligible count stays7; only B4 remains missing. If the same missing-only [0,18] premise is used, complete-eligible bounds are [38/7,56/7]=[38/7,8].
Test A4's included decision, B3's flagged decision, included count6, mean19/3 and policy include_flagged=false. A separate comparison should show that including B3 yields another result, not this alternative. Preserve the reliable evidence/reference and revised packet rather than overwriting the original. Without new measurement evidence, the replacement would be a counterfactual assumption, not a recovered observation.
Rubric: changed count/pooled mean 2; site means/site-balanced mean 2; separation from flagged sensitivity 1; discriminating tests 2; evidence/provenance justification 1. Optional correct missing-bound extension is useful feedback but earns no extra points beyond the specified total.
P5 — 8 points
Example report; replace its trace/evidence statement with the learner's actual status:
Each fictional row represents one planned physical sample, with concentration in micrograms per litre. Under the default policy, flagged B3 is excluded before missing A4 and B4, leaving five observations from seven QC-eligible slots among eight planned samples. Their sum is 38 and pooled observed mean is 38/5. Birch and Reed observed means are 6 and 10; their equally weighted mean is 8 across two of three declared sites. Cove has no observations, not a zero concentration. If both missing eligible values lie in [0,18], the complete eligible sample mean lies in [38/7,74/7]. These conditional bounds are not a confidence interval or an imputed dataset. Separately permitting the flagged observation changes the selected population and produces pooled mean 9; it does not validate its measurement. This report is a mathematical trace, not my execution record. Computational evidence would retain the input, source, policy options, outputs and verified hashes and reproduce them in a new folder. No random sampling, causal design or regional representativeness is established.
Rubric: row meaning/units 1; policies/counts/denominator 2; clearly labelled observed summaries 1; conditional missing bounds 1; truthful executed/traced status 1; recoverable evidence description 1; meaningful scientific limitations 1. Communication credit cannot replace P2 execution credit.
Delayed transfer
D1
Three assays of one physical sample are not automatically three distinct planned physical samples. The current unique-sample-ID contract either rejects repeated IDs or could be misused by inventing new sample IDs, obscuring repeated measurement. A revised design should preserve a physical sample_id and a distinct assay_id for each repeat, together with units/QC and any relevant ordering or batch metadata.
Before aggregation, decide whether the question concerns the mean assay result, one summarized concentration per physical sample, assay agreement or something else. Those choices imply different denominators and QC/replicate handling. Do not silently treat repeated assays as independent physical samples. Preserve the raw assays and document any sample-level summary rule before using it in a wider analysis. This is a conceptual schema/analysis decision, not permission to modify the reserved SQL course or a live database.
D2
“Below detection limit 3” is more informative than an unspecified missing value. A suitable revised representation includes a status such as below_detection, its limit3 and units, with no invented exact concentration. Under an explicit nonnegative-concentration premise and a strict below-limit statement, the concentration lies in [0,3), excluding 3. If the laboratory instead reports at-or-below, the upper endpoint convention changes and must be preserved.
Bounds can propagate into totals/means while retaining that open endpoint, but a value of zero, 1.5 or 3 would be a separate imputation rule requiring justification and labelling. The current integer-or-null program does not represent censoring, so do not encode it as an ordinary measured value or claim this companion already supports the new model.
Feedback and limits
Diagnose whether the learner confused identity, row meaning, structural validation, QC policy, observed denominator, complete eligible population, group weighting or scientific inference. Ask them to explain the row that changes their result and identify a check that would expose the same error on new data. Correct arithmetic alone does not resolve an undefined question. Specialist moderation, calibrated marking, learner timing and actual assistive-technology validation remain outstanding; no accreditation or completed-semester claim follows.