diff --git a/content/tutorials/spatial_variograms/index.md b/content/tutorials/spatial_variograms/index.md index d870452ad..6964604ab 100644 --- a/content/tutorials/spatial_variograms/index.md +++ b/content/tutorials/spatial_variograms/index.md @@ -200,7 +200,7 @@ Usually, we only require unique cross-combinations of elements in arbitrary orde ``` r # compute the difference of all elements of one vector to each other self_difference <- function(vec) outer(X = vec, Y = vec, FUN = function(X, Y) Y - X ) -wrap_difference <- function(vec) outer(X = vec, Y = vec, FUN = function(X, Y) (Y - X) %% (2*extent)) +wrap_difference <- function(vec) outer(X = vec, Y = vec, FUN = function(X, Y) ((Y - X + (extent/2)) %% (extent)) - (extent/2)) # Calculate the Euclidean distance of the x and y columns in a data frame. Euclid <- function(data) sqrt(self_difference(data$x)^2 + self_difference(data$y)^2 ) @@ -744,7 +744,10 @@ alt="Figure 8: Although it is inverted, scaled, y-shifted, and centered on zero I still have a hard time to associate anything maths-related to the words `nugget` and `sill`: they could equally well be some ancient greek letters spelled out in a non-greek way, such as `σίγμα`. Historically, they stem from what I think were the earliest applications of variogram-like analysis, as my colleague Hans Van Calster confirmed me when reviewing this tutorial: -\> nugget comes from "gold" nugget in mining. In sampling gold, the chances of finding a nugget of gold from adjacent locations may differ a lot - hence they have a large "nugget" effect (large differences at very small distances). + +> nugget comes from "gold" nugget in mining. In sampling gold, the chances of finding a nugget of gold from adjacent locations may differ a lot - hence they have a large "nugget" effect (large differences at very small distances). + + We have to accept that they are frequently encountered in the variogram literature. - The `nugget` is the value our function takes at the zero intercept, i.e. baseline variance, i.e. the lowest difference we can get (often defined by measurement uncertainty). @@ -795,9 +798,9 @@ plot_residuals_histogram(x, y, predictor_function, +alt="Figure 9: Residual distribution of the Gaussian model for semivariance." /> -
Residual distribution of the Matérn model for semivariance. Reasonably Gaussian as well, with some imagination.

+
Residual distribution of the Gaussian model for semivariance.

The regression results for scale, range, and nugget are 0.12, 16.76, 0.35, respectively. diff --git a/content/tutorials/spatial_variograms/spatial_variograms.qmd b/content/tutorials/spatial_variograms/spatial_variograms.qmd index ae838881f..b2d60b263 100644 --- a/content/tutorials/spatial_variograms/spatial_variograms.qmd +++ b/content/tutorials/spatial_variograms/spatial_variograms.qmd @@ -13,7 +13,7 @@ format: variant: -tex_math_dollars+tex_math_single_backslash embed-resources: true hugo-md: - output-file: "index.md" + output-file: "index_new.md" toc: false preserve_yaml: false maths: true @@ -238,7 +238,7 @@ Usually, we only require unique cross-combinations of elements in arbitrary orde ```{r cross-distance} # compute the difference of all elements of one vector to each other self_difference <- function(vec) outer(X = vec, Y = vec, FUN = function(X, Y) Y - X ) -wrap_difference <- function(vec) outer(X = vec, Y = vec, FUN = function(X, Y) (Y - X) %% (2*extent)) +wrap_difference <- function(vec) outer(X = vec, Y = vec, FUN = function(X, Y) ((Y - X + (extent)) %% (2*extent)) - (extent)) # Calculate the Euclidean distance of the x and y columns in a data frame. Euclid <- function(data) sqrt(self_difference(data$x)^2 + self_difference(data$y)^2 ) @@ -806,9 +806,12 @@ abline(v = 0) I still have a hard time to associate anything maths-related to the words `nugget` and `sill`: they could equally well be some ancient greek letters spelled out in a non-greek way, such as `σίγμα`. Historically, they stem from what I think were the earliest applications of variogram-like analysis, as my colleague Hans Van Calster confirmed me when reviewing this tutorial: + > nugget comes from "gold" nugget in mining. In sampling gold, the chances of finding a nugget of gold from adjacent locations may differ a lot - hence they have a large "nugget" effect (large differences at very small distances). + We have to accept that they are frequently encountered in the variogram literature. + - The `nugget` is the value our function takes at the zero intercept, i.e. baseline variance, i.e. the lowest difference we can get (often defined by measurement uncertainty). - Conversely, the `sill` is the maximum variance we expect to be reached when comparing measurements at totally unrelated locations. The stereotypical Gaussian variogram will asymptotically approach this value towards infinite distance. - The `sigma` parameter characterizes the width of the curve; it will indicate the range at which measurements still resemble each other to a certain degree. @@ -856,11 +859,11 @@ Inspecting the residual pattern: ```{r regression-residuals-histogram} #| label: fig-gauss-residuals -#| fig-cap: "Residual distribution of the Matérn model for semivariance. Reasonably Gaussian as well, with some imagination." +#| fig-cap: "Residual distribution of the Gaussian model for semivariance." plot_residuals_histogram(x, y, predictor_function, bins = 32, fill = "lightgray", color = "black") ``` -`
Residual distribution of the Matérn model for semivariance. Reasonably Gaussian as well, with some imagination.

`{=markdown} +`
Residual distribution of the Gaussian model for semivariance.

`{=markdown} The regression results for scale, range, and nugget are `{r} paste(round(optimizer_results$par, 2), collapse = ", ")`, respectively. @@ -1555,3 +1558,7 @@ Useful links: - - + +# Changelog + +- *(2026-03-31)* Fix an error in "wrapping", discovered during work on . Code adjusted, but rendering not repeated to avoid git binary overwrite.