View source: R/getRadiiSequence.R
getRadiiSequence | R Documentation |
Function for obtaining a sequence of range parameters for the bivariate CReSS smoother
getRadiiSequence(
method = NULL,
numberofradii = 10,
distMatrix,
basis,
rvin = NULL,
xydata,
response,
alpha = 0,
vgmmodel = "Sph",
showplots = FALSE,
...
)
method |
One of "original" or "variogram". The original method is described in Scott-Hayward et al 2013 (reference below) and the variogram method is in the vignette for variogram radii selection |
numberofradii |
The number of range parameters for SALSA to use when fitting the CReSS smooth. The default is 8. Remember, the more parameters the longer SALSA will take to find a suitable one for each knot location. |
distMatrix |
Matrix of distances between data locations and knot locations (n x k). May be Euclidean or geodesic distances. Euclidean distances created using |
basis |
character stating whether a 'gaussian' or 'exponential' basis is being used.
#' @param rvin Optional if |
xydata |
Required if 'method = "variogram". Data frame containing columns for x and y coordinates. x is assumed to be the first of the two columns |
response |
Required if |
alpha |
Optional if |
showplots |
( |
... |
Other parameters for the |
The range parameter determines the range of the influence of each knot. Small numbers indicate local influence and large ones, global influence.
Original method: This function returns a vector containing a sequence of range parameters.
Variogram method: This function returns a vector containing a sequence of range parameters. If an even number of radii is requested, this is reduced by one to give an odd length sequence where the middle number was the best range parameter from the variogram. The outputs of the variogram model can be found in the attributes of the returned object under vg.fit
.
Note If the estimated range from the variogram model exceeds the maximum distance in the distance matrix, the sequence reverts to the original method. A warning will be printed and the method used is an attribute in the returned sequence ("Method").
Scott-Hayward, L.; M. Mackenzie, C.Donovan, C.Walker and E.Ashe. Complex Region Spatial Smoother (CReSS). Journal of computational and Graphical Statistics. 2013. DOI: 10.1080/10618600.2012.762920
vignette for variogram radii selection
# load data
data(ns.data.re)
rad.dat <- dplyr::filter(ns.data.re, impact==0, Year==9, MonthOfYear == 3)
# load knot grid data
data(knotgrid.ns)
# make distance matrices for datatoknots and knottoknots
distMats<-makeDists(cbind(rad.dat$x.pos, rad.dat$y.pos), na.omit(knotgrid.ns))
# choose sequence of radii
r_seq<-getRadiiSequence(method = "variogram",
numberofradii = 8,
xydata = rad.dat[,c("x.pos", "y.pos")],
response = log(rad.dat$birds +1 ),
basis = "gaussian",
distMatrix = distMats$dataDist)
r_seq
attr(r_seq, "vg.fit")
attr(r_seq, "Method")
r_seq<-getRadiiSequence(method = "original",
numberofradii = 8,
distMatrix = distMats$dataDist,
basis="gaussian")
r_seq
attr(r_seq, "Method")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.