View source: R/LocalRadialFunction.R
LocalRadialFunction | R Documentation |
This function calculates a local radial Gausiian basis matrix for use in runSALSA2D
.
LocalRadialFunction(radiusIndices, dists, radii, aR)
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 |
Calculate a local radial basis matrix for use in runSALSA2D
. The distance matrix input may be Euclidean or geodesic distances.
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
)
# 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<-LocalRadialFunction(radiusIndices=rep(4, 5), dists=distMats$dataDist, radii = r_seq,
aR=c(3, 10, 15, 28, 31))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.