|
| 1 | +--- |
| 2 | +title: "A New Neotoma Uncertainty Model" |
| 3 | +format: pdf |
| 4 | +--- |
| 5 | + |
| 6 | +# Adding Uncertainty to Neotoma |
| 7 | + |
| 8 | +The use of uncertainty for measured values is critical. We need it directly associated with individual measurements, and we need to identify the type of uncertainty, and, potentially, the source of the uncertainty (methods of calculation, etc.). This means that for any uncertainty measurement we need to have a link to the sample and the variable that is being measured, we need to have some set of fixed uncertainty measures (standard deviations, standard errors), we also need to be able to freely define the source of the uncertainty (or perhaps again have a fixed set of measures). So, it should be possible to report the following: |
| 9 | + |
| 10 | +| reference | value | units | uncertainty reported | source | |
| 11 | +|--------------------------------|-------|-------|----------------------|-----------------------------------------| |
| 12 | +| Pinus count for sample 1223445 | 12 | NISP | 1SD | Mahr Nomograms (cf. Maher Jr 1972) | |
| 13 | +| pH for sample 23244 | .02 | pH | 95% CI | Reported instrumental error from device | |
| 14 | +| NaOH for sample 23244 | .02 | ug | 95% CI | Reported instrumental error from device | |
| 15 | + |
| 16 | +## Table modifications |
| 17 | + |
| 18 | +The uncertainty must be linked with the `ndb.data.dataid` because it modifies the `ndb.data.value` for that variable & sample. If we can assume that the units for the uncertainty are equivalent to the units associated with the variable, however it is possible that uncertainty may be expressed as a percent value. Given this, we will create a new table that links the `ndb.data.dataid` primary key. This allows us to traverse the `ndb.variables` entry for the record (to retrieve the taxonomic information), and potentially link to the variable units if they are equivalent. |
| 19 | + |
| 20 | +Given this data model: |
| 21 | + |
| 22 | +* The table `ndb.data` remains as is. |
| 23 | +* The table `ndb.variables` remains as is. |
| 24 | +* We add a new table `ndb.datauncertainties` that uses fk(dataid) (the `fk(variableid)` is implied). |
| 25 | + * The table has columns `uncertaintyvalue`, `uncertaintyunit`, `uncertaintybasisid` and `notes` along with the standard `recdatecreated` and `recdatemodified`. |
| 26 | + |
| 27 | +They will inherit information from the `ndb.variables` row, so the assumption is that the uncertainty is reported in the same units (and for the same taxon) as the `ndb.data.value`. |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +### Example Table |
| 32 | + |
| 33 | +| column | type | nulls | default | children | parents | comments | |
| 34 | +|---------------------|---------|-------|---------|----------|----------|------------| |
| 35 | +| dataid | integer | F | null | | ndb.data | fk(dataid) | |
| 36 | +| uncertaintyvalue | float | F | | | | | The value is required. | |
| 37 | +| uncertaintyunit | float | F | | | | | The value is required. | |
| 38 | +| uncertaintybasisid | integer | F | | | | ndb.uncertaintybases | | |
| 39 | +| notes | text | T | null | | | | |
| 40 | + |
| 41 | +#### Proposed `ndb.uncertaintybasis.uncertaintybasis` values |
| 42 | + |
| 43 | +Proposed values for uncertainty tables will come from standard reporting of uncertainty. |
| 44 | + |
| 45 | +* 1 Standard Deviation |
| 46 | +* 2 Standard Deviations |
| 47 | +* 3 Standard Deviations |
| 48 | +* Mean square error |
| 49 | + |
| 50 | +```SQL |
| 51 | +CREATE TABLE IF NOT EXISTS ndb.uncertaintybases ( |
| 52 | + uncertaintybasisid SERIAL PRIMARY KEY, |
| 53 | + uncertaintybasis text, |
| 54 | + CONSTRAINT uniquebasis UNIQUE (uncertaintybasis)) |
| 55 | +) |
| 56 | +INSERT INTO ndb.uncertaintybases (uncertaintybasis) |
| 57 | +VALUES ('1 Standard Deviation'), |
| 58 | + ('2 Standard Deviations'), |
| 59 | + ('3 Standard Deviation'), |
| 60 | + ('1 Standard Error'); |
| 61 | +``` |
| 62 | + |
| 63 | +### Proposed `ndb.datauncertainties` structure |
| 64 | + |
| 65 | +| uncertaintybasisid | uncertaintybasis | . . . | |
| 66 | + |
| 67 | +```SQL |
| 68 | +CREATE TABLE IF NOT EXISTS ndb.datauncertainties ( |
| 69 | + dataid INTEGER REFERENCES ndb.data(dataid), |
| 70 | + uncertaintyvalue float, |
| 71 | + uncertaintyunitid integer REFERENCES ndb.variableunits(variableunitsid), |
| 72 | + uncertaintybasisid integer REFERENCES ndb.uncertaintybases(uncertaintybasisid), |
| 73 | + notes text, |
| 74 | + CONSTRAINT uniqueentryvalue UNIQUE (dataid, uncertaintyunitid, uncertaintybasisid) |
| 75 | +); |
| 76 | +``` |
0 commit comments