as.function.gmCgram: Convert a gmCgram object to an (evaluable) function

View source: R/variograms.R

as.function.gmCgramR Documentation

Convert a gmCgram object to an (evaluable) function

Description

Evaluate a gmCgram on some h values, or convert the gmCgram object into an evaluable function

Usage

## S3 method for class 'gmCgram'
as.function(x, ...)

## S3 method for class 'gmCgram'
predict(object, newdata, ...)

Arguments

x

a gmCgram object

...

extra arguments for generic functionality

object

gmCgram object

newdata

matrix, data.frame or Spatial object containing coordinates

Value

a function that can be evaluated normally, with an argument X and possibly another argument Y; both must have the same number of columns than the geographic dimension of the variogram (i.e. dim(x$M)[3]).

Functions

  • predict.gmCgram: predict a gmCgram object on some lag vector coordinates

See Also

Other gmCgram functions: [.gmCgram(), [[.gmCgram(), as.gmCgram.variogramModelList(), length.gmCgram(), ndirections(), plot.gmCgram(), variogramModelPlot()

Examples

utils::data("variogramModels")
v1 = setCgram(type=vg.Gau, sill=diag(2)+0.5, anisRanges = 2*diag(c(3,0.5)))
v2 = setCgram(type=vg.Exp, sill=0.3*diag(2), anisRanges = 0.5*diag(2))
vm = v1+v2
vgf = as.function(vm)
(h = rbind(c(0,1), c(0,0), c(1,1)))
vgf(h)
predict(vm, h)

gmGeostats documentation built on April 18, 2023, 5:08 p.m.