Preamble

In this preamble, we load the gstlearn library and clean the workspace.

rm(list=ls())
library(gstlearn)
library(ggplot2)
library(ggpubr)
library(ggnewscale)

Then the necessary data set is downloaded and named dat: the target variable is January_temp

fileNF = loadData("Scotland", "Scotland_Temperatures.NF")
dat = Db_createFromNF(fileNF)

Variogram Cloud

Variogram Cloud

The data is modeled as samples of a regionalized variable \(z\), i.e. as evaluations at locations \(x_1,..,x_n\) of a variable \(z\) defined across a spatial domain: \[\lbrace z_i = z(x_i) : i = 1, ..., n\rbrace.\]

The variogram cloud is the set of pair of points defined as \[ \big\lbrace \big( \Vert x_i - x_j\Vert, \big\vert z(x_i)-z(x_j)\big\vert^2 \big) \quad\text{where}\quad 1\le i\le j\le n \big\rbrace \]

In gstlearn, variogram clouds are computed as grids.

varioParamOmni = VarioParam_createOmniDirection(npas = 100)
grid.cloud = db_vcloud(dat, varioParamOmni)
grid.cloud$display()
## 
## Data Base Grid Characteristics
## ==============================
## 
## Data Base Summary
## -----------------
## File is organized as a regular grid
## Space dimension              = 2
## Number of Columns            = 4
## Total number of samples      = 10000
## 
## Grid characteristics:
## ---------------------
## Origin :      0.000     0.000
## Mesh   :      7.789     0.031
## Number :        100       100
## 
## Variables
## ---------
## Column = 0 - Name = rank - Locator = NA
## Column = 1 - Name = x1 - Locator = x1
## Column = 2 - Name = x2 - Locator = x2
## Column = 3 - Name = Cloud.January_temp - Locator = NA
## NULL
p = ggplot()
p = p + plot.grid(grid.cloud, "Cloud.January*")
p = p + plot.geometry(asp=0)
ggPrint(p)