A Shape of the query
Three common table expressions prepare the die-based counts and the
coverage factor; the main SELECT then aggregates the stamps and joins those
counts back in. One output row is one findspot.
B Input and selection
FROM tbldistribution AS di LEFT JOIN tblpotter p ON lower(trim(di.pottername)) = lower(trim(p.pottername)) LEFT JOIN v_discoverysite vds ON di.site = vds.label LEFT JOIN kfactor k ON k.the_id = vds.id AND k.the_site = di.site AND k.the_findspot = di.findspot
datemin …
datemax. v_discoverysite resolves the site name against the
published archaeology.link location dataset, giving each row the persistent
identifier the_id.
WHERE di.isdate = 'Θ' -- occurrence usable for dating AND sitecharacter = 'Σ' -- settlement-type site AND findspot IS NOT NULL -- context resolvable AND p.datemin <> 0 -- potter carries a real date AND p.datemax NOT IN (260,120,150)
p.datemin <> 0 is tested in the
WHERE clause, the left join to tblpotter behaves as an
inner join — stamps without a matching dated potter do not appear.
GROUP BY vds.id, di.site, di.findspot, di.siteancientname,
di.coordinate1, di.coordinate2, di.pleiades
C The die counts
Two CTEs, run before the main aggregation.
SELECT vds.id, di.site, di.findspot, di.pottername, COUNT(DISTINCT di.die) AS dies_pp, -- distinct dies of this potter COUNT(*) AS stamps_pp -- occurrences of this potter -- ... same WHERE as above, plus: AND di.die IS NOT NULL GROUP BY vds.id, di.site, di.findspot, di.pottername
DISTINCT die within each potter and summing afterwards
is what makes the die identity potter-bound. Stamps with no recorded die are
excluded here, because they cannot contribute to a repetition count.
SELECT the_id, the_site, the_findspot, SUM(dies_pp) AS n_dies, ROUND(SUM(stamps_pp)::numeric / NULLIF(SUM(dies_pp),0), 3) AS rep, ( k_max - (k_max - k_min) * (1 - EXP(-SUM(stamps_pp)::numeric / tau)) ) AS k_eff FROM diecounts GROUP BY the_id, the_site, the_findspot
Since revision 30a this CTE no
longer feeds \(k\): it supplies \(D\) and \(r\) only. \(k\) is computed in the
main query from count_stamps.
D Central tendency
AVG(p.datemin)::integer AS avg_datemin, AVG(p.datemax)::integer AS avg_datemax, ((AVG(p.datemin) + AVG(p.datemax)) / 2.0) AS midpoint_year
MIN(p.datemin)::integer AS min_datemin, MAX(p.datemin)::integer AS max_datemin, MIN(p.datemax)::integer AS min_datemax, MAX(p.datemax)::integer AS max_datemax
E Dispersion and the dated interval
Two sources of blur are added together: each potter's range is itself wide, and different potters point to different years.
SQRT( AVG(POWER(p.datemax - p.datemin, 2) / 12.0) + COALESCE(VAR_SAMP((p.datemin + p.datemax) / 2.0), 0) )
COALESCE covers findspots with a single stamp, where no between-stamp
variance exists but the within-stamp width is still defined.
Small σ means the stamps point to a narrow window.
k_max - (k_max - k_min) * (1 - EXP(-count_stamps / tau)) -- k_min = 0.5 k_max = 1.5 tau = 6 (calibrated, see the method page)
k_max.
( midpoint - COALESCE(MIN(k.k_eff), k_max) * σ )::numeric(10,1) AS eff_start, ( midpoint + COALESCE(MIN(k.k_eff), k_max) * σ )::numeric(10,1) AS eff_end
MIN(k.k_eff) merely passes through a value that is constant within the
group.
F The two quality measures
Reported side by side and never combined: they answer different questions, and a findspot may score high on one and low on the other.
ROUND(COALESCE( CASE WHEN (AVG(p.datemax) - AVG(p.datemin)) = 0 THEN NULL ELSE EXP(-(SQRT(VAR_SAMP(p.datemin) + VAR_SAMP(p.datemax)) / ABS(AVG(p.datemax) - AVG(p.datemin)))) END, 0.5), 3)
MIN(k.n_dies) AS n_dies, MIN(k.rep) AS die_repetition, CASE WHEN MIN(k.rep) IS NULL THEN NULL ELSE ROUND(1 - 1.0/GREATEST(MIN(k.rep),1), 3) END AS q_repetition
ROUND(EXP(-(STDDEV_SAMP(p.datemin) / (SELECT t0 FROM params))), 3) AS q_start -- q_end identical, on datemax. t0 = 20 years, a fixed reference length.
G Values drawn but not modelled
COALESCE(STDDEV_SAMP(p.datemin)::integer, 0) AS unc_start_years, COALESCE(STDDEV_SAMP(p.datemax)::integer, 0) AS unc_end_years, COALESCE(SQRT(VAR_SAMP(p.datemin) + VAR_SAMP(p.datemax))::integer, 0) AS unc_interval_years
ROUND(AVG(p.datemin),0)::text || ' to ' || ROUND(AVG(p.datemax),0)::text
H Parameters
| Name | Value | Effect |
|---|---|---|
k_min | 0.5 | narrowest interval, richly attested findspots |
k_max | 1.5 | widest interval, thinly attested findspots |
tau | 6 | assemblage size, in stamps, at which ~63 % of the narrowing is reached; calibrated against five ceramic-independent ensembles |
t0 | 20 | reference length, in years, against which the edge dispersions are read; a stated convention, not a calibrated value |
w | 1.0 | weight of volume against repetition in \(k\); 1.0 = volume only |
| within-stamp variance | \(w^2/12\) | uniform distribution across each potter's range |
tau and t0 are not the same quantity. One is
counted in stamps and drives the width of the box; the other is counted in years and
drives the whisker colours. They carried the same value until tau was
calibrated, and during development both were once set to 6 at the same time — every
check passed, every figure looked plausible, and every whisker colour in the corpus
was wrong. Both are exported on every row, as p_tau and p_t0,
so that any output can be checked against the parameters that produced it.
All named parameters live in the params CTE at the top of the query
and are referenced from there, so a change takes effect in one place.
I Output columns
| Column | Formula | Used for |
|---|---|---|
| the_id | — | archaeology.link identifier |
| the_site · the_findspot | — | grouping unit |
| count_stamps | \(n\) | qualifying stamps at the findspot |
| avg_datemin · avg_datemax | \(\overline{a}\), \(\overline{b}\) | reference |
| min_datemin … max_datemax | extremes | plot stubs |
| midpoint_year | \(m\) | centre of the interval |
| eff_start · eff_end | \(m \pm k\sigma\) | the date · plot box |
| q_interval | \(e^{-\sqrt{s^2_a+s^2_b}/|\overline{b}-\overline{a}|}\) | dating sharpness · box colour |
| n_dies | \(D\) | distinct potter–die pairs |
| die_repetition | \(r = n_{\text{die}}/D\) | attestations per die |
| q_repetition | \(1 - 1/r\) | hoard character |
| q_start · q_end | \(e^{-s/t_0}\) | whisker colour |
| unc_*_years | \(s_a\), \(s_b\), \(\sqrt{s^2_a+s^2_b}\) | whisker lengths, graphical only |
| avg_interval | — | display string |