Interpolation[Kriging] - Maple Programming Help

Home : Support : Online Help : Statistics and Data Analysis : Interpolation and Curve Fitting : Interpolation Package : Kriging Subpackage : Interpolation/Kriging/GenerateSpatialData

Interpolation[Kriging]

 GenerateSpatialData
 generate a spatially correlated data set

 Calling Sequence GenerateSpatialData(variogram) GenerateSpatialData(variogram,n,options)

Parameters

 variogram - a supported variogram model n - (optional) the (approximate) number of points generated. The default value is 30. options - (optional) keyword option of the form grid=truefalse or dimension=d. If grid is set to true, the generated data points will be equally spaced along each dimension (default: false). The dimension option sets the dimension of the points to be generated (default: 2).

Description

 • The GenerateSpatialData command takes a variogram and generates a set of points and associated data reflective of that variogram model. These points and data can then be used to experiment with, or demonstrate, Kriging interpolation.
 • If the grid=true option is given, then the points are located in a square $d$-dimensional grid, at coordinates equally spaced between 0 and 1. As a consequence, there will be ${k}^{d}$ points in total, for some $k$. Maple chooses $k$ as $⌊{n}^{\frac{1}{d}}⌋$; consequently, the number of points generated may be smaller than $n$. For example, if $d$ has its default value of 2, then the number of points will be reduced to the largest perfect square that is not greater than n.
 • If the grid=true option is not given, then the points are uniformly randomly selected from the $d$-dimensional unit cube. In this case, exactly $n$ points are generated.
 • The data set is returned as an expression sequence of a list of lists representing the points, and a Vector of values at those points.

Examples

We generate some points in two dimensions and associated data.

 > $\mathrm{points1},\mathrm{data1}≔\mathrm{Interpolation}:-\mathrm{Kriging}:-\mathrm{GenerateSpatialData}\left(\mathrm{Spherical}\left(1,10,1\right)\right)$
 ${\mathrm{points1}}{,}{\mathrm{data1}}{≔}\begin{array}{c}\left[\begin{array}{cc}{0.814723686393179}& {0.706046088019609}\\ {0.905791937075619}& {0.0318328463774207}\\ {0.126986816293506}& {0.276922984960890}\\ {0.913375856139019}& {0.0461713906311539}\\ {0.632359246225410}& {0.0971317812358475}\\ {0.0975404049994095}& {0.823457828327293}\\ {0.278498218867048}& {0.694828622975817}\\ {0.546881519204984}& {0.317099480060861}\\ {0.957506835434298}& {0.950222048838355}\\ {0.964888535199277}& {0.0344460805029088}\\ {⋮}& {⋮}\end{array}\right]\\ \hfill {\text{30 × 2 Matrix}}\end{array}{,}\begin{array}{c}\left[\begin{array}{c}{-1.31317888309844}\\ {3.78399452938756}\\ {-4.07906747556769}\\ {2.81033657021060}\\ {3.07159908082337}\\ {0.128958765233181}\\ {-3.21737272238249}\\ {0.707245165710691}\\ {0.0877877303791831}\\ {0.937296621856970}\\ {⋮}\end{array}\right]\\ \hfill {\text{30 element Vector[column]}}\end{array}$ (1)

These can be used to demonstrate Kriging interpolation.

 > $\mathrm{k1}≔\mathrm{Interpolation}:-\mathrm{Kriging}\left(\mathrm{points1},\mathrm{data1}\right)$
 ${\mathrm{k1}}{≔}\left(\begin{array}{c}{Kriging intⅇrpolation obȷⅇct with 30 samplⅇ points}\\ {Variogram: Sphⅇrical\left(1.25259453854485,13.6487615617233,.5525536774\right)}\end{array}\right)$ (2)
 > $\mathrm{SetVariogram}\left(\mathrm{k1},\mathrm{Spherical}\left(1,10,1\right)\right)$
 $\left(\begin{array}{c}{Kriging intⅇrpolation obȷⅇct with 30 samplⅇ points}\\ {Variogram: Sphⅇrical\left(1,10,1\right)}\end{array}\right)$ (3)
 > $\mathrm{ComputeGrid}\left(\mathrm{k1},\left[0..1,0..1\right],0.1,\mathrm{output}=\mathrm{plot}\right)$

We now generate some points in a three-dimensional grid and associated data.

 > $\mathrm{points2},\mathrm{data2}≔\mathrm{Interpolation}:-\mathrm{Kriging}:-\mathrm{GenerateSpatialData}\left(\mathrm{RationalQuadratic}\left(0.1,10,4\right),216,\mathrm{dimension}=3,\mathrm{grid}=\mathrm{true}\right)$
 ${\mathrm{points2}}{,}{\mathrm{data2}}{≔}\begin{array}{c}\left[\begin{array}{ccc}{0.}& {0.}& {0.}\\ {0.200000000000000}& {0.}& {0.}\\ {0.400000000000000}& {0.}& {0.}\\ {0.600000000000000}& {0.}& {0.}\\ {0.800000000000000}& {0.}& {0.}\\ {1.}& {0.}& {0.}\\ {1.}& {0.200000000000000}& {0.}\\ {0.800000000000000}& {0.200000000000000}& {0.}\\ {0.600000000000000}& {0.200000000000000}& {0.}\\ {0.400000000000000}& {0.200000000000000}& {0.}\\ {⋮}& {⋮}& {⋮}\end{array}\right]\\ \hfill {\text{216 × 3 Matrix}}\end{array}{,}\begin{array}{c}\left[\begin{array}{c}{-0.632614397974936}\\ {-1.34308166072871}\\ {-1.93300651069168}\\ {-2.13152824723620}\\ {-4.83822992869101}\\ {-4.32045644058760}\\ {-5.67818087381980}\\ {-4.97533204086918}\\ {-3.86641985393756}\\ {-2.11822526262428}\\ {⋮}\end{array}\right]\\ \hfill {\text{216 element Vector[column]}}\end{array}$ (4)
 > $\mathrm{k2}≔\mathrm{Interpolation}:-\mathrm{Kriging}\left(\mathrm{points2},\mathrm{data2}\right)$
 ${\mathrm{k2}}{≔}\left(\begin{array}{c}{Kriging intⅇrpolation obȷⅇct with 216 samplⅇ points}\\ {Variogram: Sphⅇrical\left(1.3774001758466,22.7123587826079,.8\right)}\end{array}\right)$ (5)
 > $\mathrm{SetVariogram}\left(\mathrm{k2},\mathrm{RationalQuadratic}\left(0.1,10,4\right)\right)$
 $\left(\begin{array}{c}{Kriging intⅇrpolation obȷⅇct with 216 samplⅇ points}\\ {Variogram: RationalQuaⅆratic\left(.1,10,4\right)}\end{array}\right)$ (6)
 > $\mathrm{plots}:-\mathrm{implicitplot3d}\left(\mathrm{k2}\left(x,y,z\right)=\mathrm{Statistics}:-\mathrm{Median}\left(\mathrm{data2}\right),x=0..1,y=0..1,z=0..1,\mathrm{grid}=\left[8,8,8\right]\right)$
 > 

Compatibility

 • The Interpolation[Kriging][GenerateSpatialData] command was introduced in Maple 2018.