LRF.e: Function for creating an Exponential basis function for a...

View source: R/LRF.e.R

LRF.eR Documentation

Function for creating an Exponential basis function for a spatial smooth using the CReSS method.

Description

This function calculates a local radial exponential basis matrix for use in runSALSA2D.

Usage

LRF.e(radiusIndices, dists, radii, aR)

Arguments

radiusIndices

Vector of length startKnots identifying which radii (splineParams[1]$radii) will be used to initialise the model

dists

Matrix of distances between data locations and knot locations (n x k). May be Euclidean or geodesic distances.

radii

Sequence of range parameters for the CReSS basis from local (small) to global (large). Determines the range of the influence of each knot.

aR

Index of knot locations. The index contains numbers selected by SALSA from 1 to the number of legal knot locations na.omit(knotgrid). Used to specify which columns of dists should be used to construct the basis matrix.

Details

Calculate a local radial basis matrix for use in runSALSA2D. The distance matrix input may be Euclidean or geodesic distances.

Value

Returns a basis matrix with one column for each knot in aR and one row for every observation (i.e. same number of rows as dists)

Examples


# load data
data(ns.data.re)
# load knot grid data
data(knotgrid.ns)

splineParams<-makesplineParams(data=ns.data.re, varlist=c('observationhour'))

#set some input info for SALSA
ns.data.re$response<- ns.data.re$birds

# make distance matrices for datatoknots and knottoknots
distMats<-makeDists(cbind(ns.data.re$x.pos, ns.data.re$y.pos), na.omit(knotgrid.ns), knotmat=FALSE)

# choose sequence of radii
r_seq<-getRadiiChoices(8, distMats$dataDist)

# using the fourth radius and picking 5 knots
basis<-LRF.e(radiusIndices=rep(4, 5), dists=distMats$dataDist, radii = r_seq, 
        aR=c(3, 10, 15, 28, 31))


lindesaysh/MRSea documentation built on April 5, 2024, 4:39 p.m.