fields-wrapper: Wrapper for Distance Matrix Computation

fields-wrapperR Documentation

Wrapper for Distance Matrix Computation

Description

These functions are simple wrappers to nearest.dist to be used in fields.

Usage

spam_rdist( x1, x2, delta = 1)
spam_rdist.earth( x1, x2, delta = 1, miles=TRUE, R=NULL)

Arguments

x1

Matrix of first set of locations where each row gives the coordinates of a particular point.

x2

Matrix of second set of locations where each row gives the coordinates of a particular point.

delta

only distances smaller than delta are recorded, see Details.

miles

For great circle distance: If true distances are in statute miles if false distances in kilometers.

R

Radius to use for sphere to find spherical distances. If NULL the radius is either in miles or kilometers depending on the values of the miles argument. If R=1 then distances are of course in radians.

Details

These functions are wrappers to rdist and rdist.earth in fields. They are used to simplify the use of sparse matrices in functions like mKrig.

For great circle distance, the matrices x1 and x2 contain the degrees longitudes in the first and the degrees latitudes in the second column. delta is in degrees. Hence to restrict to distances smaller than delta.km, one has to specify delta=delta.km*360/(6378.388*2*pi).

Value

A spam object containing the distances spanned between zero and delta. The sparse matrix may contain many zeros (e.g., collocated data). However, to calculate covariances, these zeros are essential.

Author(s)

Reinhard Furrer

See Also

nearest.dist

Examples

## Not run: 
require(fields)
look <- mKrig(x,Y, Covariance="Wendland", dimension=2, k=1,
    cov.args=list( Distance='spam_rdist'))

## End(Not run)


spam documentation built on Oct. 23, 2023, 5:07 p.m.