Geostatex.IndicatorKriging (Geostatex v0.6.0)

Copy Markdown View Source

Indicator kriging: the conditional distribution of a variable at given thresholds.

The data are transformed into indicators i(t) = 1 where z <= t (else 0) at each threshold, and each threshold's indicators are kriged by ordinary kriging (Geostatex.Kriging.ordinary/3, as pykrige.OrdinaryKriging on the indicators). The kriged values estimate the distribution F(t) = P(Z <= t) at each target; they are corrected for order relations as GSLIB's ordrel does (each clipped to [0, 1], then the average of an upward pass max(F_k, F_(k-1)) and a downward pass min(F_k, F_(k+1))).

execute/5 returns, per target, the raw and corrected distributions (one value per threshold), the probability of exceeding each threshold (1 - F) and the E-type mean: the corrected distribution integrated over the class means of the data (the data between two thresholds; the midpoint for an empty inner class, the threshold for an empty tail). GSLIB's postik interpolates within classes instead; the class means are its documented alternative.

Indicator variograms come from the same options as ordinary kriging: one variogram_parameters for every threshold, a list with one per threshold, or nil to fit each threshold's automatically as PyKrige does. indicators/2 gives the indicators to study them with Geostatex.Variogram.new/3.

Examples

iex> ik = Geostatex.IndicatorKriging.new([{0, 0}, {10, 0}, {0, 10}, {10, 10}],
...>   [0.5, 1.5, 1.7, 3.0],
...>   thresholds: [1.0, 2.0],
...>   variogram_model: :spherical,
...>   variogram_parameters: %{psill: 0.2, range: 15.0, nugget: 0.0})
iex> %{e_type: [e]} = Geostatex.IndicatorKriging.execute(ik, :points, [10.0], [0.0])
iex> Float.round(e, 9)
1.6

Summary

Functions

The distributions at :points or on the :grid of xs and ys (options as Geostatex.Kriging.execute/5): %{raw_cdf:, cdf:, exceedance:, e_type:}, with a list of one value per threshold for each target (grids as rows of y) and one E-type mean per target.

The indicators of values at each threshold: one list per threshold, 1 where the value is at or below it.

Sets up indicator kriging of values at points (2D). Options: :thresholds (required, an increasing list) and the options of Geostatex.Kriging.ordinary/3, applied to every threshold, except that :variogram_parameters may be a list with one per threshold.

GSLIB's order-relation correction of a distribution (one value per threshold): each value clipped to [0, 1], then the average of an upward and a downward pass.

Types

t()

@type t() :: %Geostatex.IndicatorKriging{
  class_means: term(),
  dim: term(),
  models: term(),
  thresholds: term()
}

Functions

execute(ik, style, xs, ys, opts \\ [])

@spec execute(t(), :points | :grid, [number()], [number()], keyword()) :: map()

The distributions at :points or on the :grid of xs and ys (options as Geostatex.Kriging.execute/5): %{raw_cdf:, cdf:, exceedance:, e_type:}, with a list of one value per threshold for each target (grids as rows of y) and one E-type mean per target.

execute_3d(ik, style, xs, ys, zs, opts \\ [])

@spec execute_3d(t(), :points | :grid, [number()], [number()], [number()], keyword()) ::
  map()

The distributions in 3D, as execute/5 over Geostatex.Kriging.execute_3d/6.

indicators(values, thresholds)

@spec indicators(term(), [number()]) :: [[0 | 1]]

The indicators of values at each threshold: one list per threshold, 1 where the value is at or below it.

new(points, values, opts \\ [])

@spec new(term(), term(), keyword()) :: t()

Sets up indicator kriging of values at points (2D). Options: :thresholds (required, an increasing list) and the options of Geostatex.Kriging.ordinary/3, applied to every threshold, except that :variogram_parameters may be a list with one per threshold.

new_3d(points, values, opts \\ [])

@spec new_3d(term(), term(), keyword()) :: t()

Indicator kriging in 3D: new/3 over Geostatex.Kriging.ordinary_3d/3.

order_relations(cdf)

@spec order_relations([number()]) :: [float()]

GSLIB's order-relation correction of a distribution (one value per threshold): each value clipped to [0, 1], then the average of an upward and a downward pass.