Learn R Programming

FRK (version 2.3.1)

eval_basis: Evaluate basis functions

Description

Evaluate basis functions at points or average functions over polygons.

Usage

eval_basis(basis, s)

# S4 method for Basis,matrix eval_basis(basis, s)

# S4 method for Basis,SpatialPointsDataFrame eval_basis(basis, s)

# S4 method for Basis,SpatialPolygonsDataFrame eval_basis(basis, s)

# S4 method for Basis,STIDF eval_basis(basis, s)

# S4 method for TensorP_Basis,matrix eval_basis(basis, s)

# S4 method for TensorP_Basis,STIDF eval_basis(basis, s)

# S4 method for TensorP_Basis,STFDF eval_basis(basis, s)

Arguments

basis

object of class Basis

s

object of class matrix, SpatialPointsDataFrame or SpatialPolygonsDataFrame containing the spatial locations/footprints

Details

This function evaluates the basis functions at isolated points, or averages the basis functions over polygons, for computing the matrix \(S\). The latter operation is carried out using Monte Carlo integration with 1000 samples per polygon. When using space-time basis functions, the object must contain a field t containing a numeric representation of the time, for example, containing the number of seconds, hours, or days since the first data point.

See Also

auto_basis for automatically constructing basis functions.

Examples

Run this code
library(sp)

### Create a synthetic dataset
set.seed(1)
d <- data.frame(lon = runif(n=500,min = -179, max = 179),
                lat = runif(n=500,min = -90, max = 90),
                z = rnorm(500))
coordinates(d) <- ~lon + lat
slot(d, "proj4string") = CRS("+proj=longlat")

### Now create basis functions on sphere
G <- auto_basis(manifold = sphere(),data=d,
                nres = 2,prune=15,
                type = "bisquare",
                subsamp = 20000)

### Now evaluate basis functions at origin
S <- eval_basis(G,matrix(c(0,0),1,2))

Run the code above in your browser using DataLab