 Kriging procedure call - Maple Help

Interpolation[Kriging]

 procedure_call
 use the Kriging process to predict the value at one or more points Calling Sequence k(coordinates) k(coordinates, outopt) Parameters

 k - a Kriging object coordinates - sequence specifying the coordinates of the point at which the value will be predicted, or a Matrix where each row specifies the coordinates of one point outopt - (optional) keyword option of the form output=format Description

 • A Kriging object can be used in a function call. Used in this way, the function call makes use of the data stored in the Kriging object to predict the value at the point of the given coordinates.
 • The variogram set in the Kriging object is used to carry out the prediction. This can be set by using the SetVariogram procedure.
 • By default, the predicted value is returned. This is equivalent to the behavior if output=value. If output=variance then the variance associated with the predicted value is returned, which can be used as a measure of the uncertainty in the prediction. If output=both, then the sequence val, var is returned, where val is the predicted value and var is the associated variance.
 • coordinates can be an $m$-by-$n$ dimensional matrix, where $n$ is the dimensionality of the point data stored in the Kriging object. Each of the $m$ rows is treated as the coordinates of a point where the Kriging interpolation will be performed. If output=both then an $m$-by-2 matrix will be returned, with the first column corresponding to the predicted values and the second column corresponding to the variances. Otherwise, a column vector will be returned containing either the predicted values or variances as specified. Examples

 > $\mathrm{with}\left(\mathrm{Interpolation}\right):$

We generate some data points according to the $\mathrm{Spherical}\left(1,10,1\right)$ variogram.

 > $\mathrm{points},\mathrm{data}≔\mathrm{Kriging}:-\mathrm{GenerateSpatialData}\left(\mathrm{Spherical}\left(1,10,1\right)\right)$
 ${\mathrm{points}}{,}{\mathrm{data}}{≔}\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.31317888309841}\\ {3.78399452938781}\\ {-4.07906747556730}\\ {2.81033657021080}\\ {3.07159908082332}\\ {0.128958765233144}\\ {-3.21737272238246}\\ {0.707245165710619}\\ {0.0877877303791926}\\ {0.937296621856498}\\ {⋮}\end{array}\right]\\ \hfill {\text{30 element Vector[column]}}\end{array}$ (1)

The next step is to create the Kriging object.

 > $k≔\mathrm{Kriging}\left(\mathrm{points},\mathrm{data}\right)$
 ${k}{≔}\left(\begin{array}{c}{Kriging intⅇrpolation obȷⅇct with 30 samplⅇ points}\\ {Variogram: Sphⅇrical\left(1.25259453854482,13.6487615617247,.5525536774\right)}\end{array}\right)$ (2)

We can use this object as is with a variogram estimated purely from the data, but we should expect to get better results if we set the variogram that we know underlies these data.

 > $\mathrm{SetVariogram}\left(k,\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)

We can now find the interpolated value for any point, and the variance at such points, as well.

 > $k\left(0.2,0.3\right)$
 ${-2.65388575588639108}$ (4)
 > $k\left(0.2,0.3,\mathrm{output}=\mathrm{variance}\right)$
 ${2.46857252864955790}$ (5)
 > $k\left(0.2,0.3,\mathrm{output}=\mathrm{both}\right)$
 ${-2.65388575588639108}{,}{2.46857252864955790}$ (6)

Like any function of two variables, you can plot the interpolated surface with the plot3d command. One can also plot the variance.

 > $\mathrm{plot3d}\left(k\left(x,y\right),x=0..1,y=0..1\right)$ > $\mathrm{plot3d}\left(k,0..1,0..1\right)$ > $\mathrm{plot3d}\left(k\left(x,y,\mathrm{output}=\mathrm{variance}\right),x=0..1,y=0..1\right)$ You can even plot the interpolated surface, and use the color to indicate the variance.

 > $\mathrm{plot3d}\left(k\left(x,y\right),x=0..1,y=0..1,\mathrm{color}=\left[\frac{k\left(x,y,\mathrm{output}=\mathrm{variance}\right)}{5},0.8,0.8,\mathrm{colortype}=\mathrm{HSV}\right]\right)$ You can also approximate the area under the surface using numerical integration.

 > $\mathrm{int}\left(k,0..1,0..1,\mathrm{numeric},\mathrm{\epsilon }=0.1,\mathrm{method}=\mathrm{_CubaCuhre}\right)$
 ${-0.915288153662594}$ (7) Compatibility

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