Terraflux Terraflux
Download

Uncertainty

7 operators. Inputs marked required must be connected or given; the others have defaults.

sensitivity.analyze#

The indices of a global sensitivity analysis from its runs and their outputs (SALib's analyses, the same numbers): Morris's μ, μ* (the mean absolute elementary effect: the importance) and σ (the interactions and non-linearity) with μ*'s bootstrap interval; or Sobol's first order (S1: the share of the output's variance due to the factor alone), total (ST: with its interactions) and second order (S2: of pairs) indices with their bootstrap intervals.

InputTypeWhat it is
designrequiredtablethe runs (sensitivity.design's table)
resultsrequiredtablethe outputs of the runs, a row each in the same order
OutputTypeWhat it is
indicestablea row per factor (in the design's order): factor (1..), then mu, mu_star, sigma, mu_star_conf (morris) or s1, s1_conf, st, st_conf (sobol)
s2tablesobol: the second order indices, a row and a column per factor
s2_conftablesobol: their intervals
SettingTypeWhat it is
methodrequiredtextmorris or sobol
columntextthe results' column (default its last)
levelsintegermorris: the grid's levels, as the design's (default 4)
second_orderboolsobol: as the design (default true)
resamplesintegerthe bootstraps of the intervals (default 100)
confidencenumberthe level of the intervals (default 0.95)
seedintegerthe seed of the bootstraps (default 1)

sensitivity.design#

The runs of a global sensitivity analysis (SALib's samplers, the same values): Morris's trajectories (a factor changed at a time on a grid of levels; n trajectories of factors + 1 runs) or Saltelli's runs of Sobol's method (a scrambled Sobol' sequence; n base points, a power of 2, of 2 × factors + 2 runs, or factors + 2 without the second order). Run the model at every row (terraflux sensitivity, or a loop) and give the outputs to sensitivity.analyze.

OutputTypeWhat it is
tabletablea row per run: run, then a column per factor
SettingTypeWhat it is
methodrequiredtextmorris or sobol
factorsrequiredanythe factors and their ranges: [[name, low, high], ...] (or {name: [low, high]}); a model's input ($name) or setting (node.setting) for terraflux sensitivity
nintegertrajectories (morris) or base points (sobol; default 10 / 64)
levelsintegermorris: the grid's levels (default 4)
second_orderboolsobol: the pairs' indices too (default true)
seedintegerthe seed of numpy's default_rng (default 1)

uncertainty.delta#

The uncertainty of an expression of the node's maps and numbers (raster.calc's) from the uncertainty of its parameters, by the delta method (landschaft's delta_method, the GUM's first order): the derivatives by finite differences (central, or forward as Strassburg et al. 2020), the standard deviation sqrt(sum (df/dp sigma)^2) (quadratic) or sum |df/dp sigma| (linear).

OutputTypeWhat it is
valueanythe expression at the parameters (a map or a number)
sdanyits standard deviation
SettingTypeWhat it is
expressionrequiredtexte.g. carbon * factor + base
parametersrequiredany[["factor", 0.47, 0.02], ...]: name, value, sd
methodtextquadratic (default) or linear
schemetextcentral (default) or forward
stepanythe finite-difference step (one, or one per parameter)

Takes any other inputs by name (any).

uncertainty.interval#

The normal confidence interval of a value: value -/+ z sd, z the normal quantile of the level (landschaft's interval; scipy's norm.ppf, cephes' ndtri; Strassburg et al. 2020 fix z at 1.96).

InputTypeWhat it is
valuerequiredanya map or a number
sdrequiredanyits standard deviation
OutputTypeWhat it is
lowanythe lower bound
highanythe upper bound
SettingTypeWhat it is
levelnumberthe confidence level, 0 to 1 (0.95)

uncertainty.monte_carlo#

The uncertainty of an expression of the node's maps and numbers by drawing its parameters (landschaft's monte_carlo): n draws from normal distributions with numpy's generator and seed, the expression computed for each, their mean, standard deviation and quantiles (numpy's).

OutputTypeWhat it is
meananythe mean over the draws (a map or a number)
sdanythe standard deviation over the draws
quantilesanya layer (or a row) per quantile
SettingTypeWhat it is
expressionrequiredtexte.g. carbon * factor + base
parametersrequiredany[["factor", 0.47, 0.02], ...]: name, mean, sd
nintegerthe draws (1000)
seedintegerof numpy's generator (0)
quantilesany[0.025, 0.975] (default)

Takes any other inputs by name (any).

uncertainty.product_sd#

The standard deviation of the product of two independent uncertain values x v (landschaft's product_sd): Goodman's exact variance x^2 sigma_v^2 + v^2 sigma_x^2 + sigma_x^2 sigma_v^2, cell by cell, or of the sum of the products (total: quadratic or linear).

InputTypeWhat it is
xrequiredanya map or a number
sd_xrequiredanyits standard deviation
vrequiredanya map or a number
sd_vrequiredanyits standard deviation
OutputTypeWhat it is
sdanya map (or a number) of standard deviations, or the total's
SettingTypeWhat it is
totalboolthe standard deviation of the sum of the products
methodtextof the total: quadratic (default) or linear

uncertainty.sum_sd#

The standard deviation of a total of uncertain values, the sum of w v (landschaft's sum_sd): independent errors sqrt(sum (sigma w)^2), errors adding up sum |sigma w|, or with a correlation rho of every pair sqrt((1 - rho) sum s^2 + rho (sum s)^2). Missing cells left out.

InputTypeWhat it is
sdrequiredmapthe values' standard deviations
weightsanya map or a number (default 1)
OutputTypeWhat it is
sdnumberthe total's standard deviation
SettingTypeWhat it is
methodtextquadratic (default) or linear
correlationnumberof every pair of errors, -1 to 1