Check the magnitude of an impact variable against the global reference
Source:R/check_impact.R
eiod_check_magnitude.RdCompares the median of your data against the published global 50th percentile for that indicator, weighted to your sample's demographic mix, and names the likely conversion when the ratio lands near a common unit factor.
Details
This is the check that catches a unit error. A greenhouse gas column supplied in grams rather than kilograms will sit about 1000 times above the reference and be reported as such, rather than quietly producing a result in which every diet exceeds every threshold.
Examples
data(eiod_demo)
grp <- eiod_age_sex_group(eiod_demo$age, eiod_demo$sex)
eiod_check_magnitude(eiod_demo$ghg_kgco2e, "ghg", grp, name = "ghg_kgco2e")
#> reiod data quality report
#>
#> ERROR 0
#> WARNING 0
#> NOTE 1
#>
#> NOTE ghg_kgco2e magnitude median 3.061 vs expected 5.547 for this demographic mix (ratio 0.552).
#>
#> No blocking problems.
# the same data in grams
eiod_check_magnitude(eiod_demo$ghg_kgco2e * 1000, "ghg", grp,
name = "ghg_grams")
#> reiod data quality report
#>
#> ERROR 0
#> WARNING 1
#> NOTE 0
#>
#> WARNING ghg_grams magnitude median 3061 vs expected 5.547 for this demographic mix (ratio 552).
#> Consistent with a unit error: values in g where kg is expected. Expected
#> unit: kg CO2eq.
#>
#> No blocking problems.