View source: R/functions_range.R
compute_lowCurve | R Documentation |
Calculates a loess curve for the smoothing matrix entries, as a function of distance between points.
compute_lowCurve(S, D, newd, cl = NULL, span = 0.1)
S |
Smoothing matrix, or a subset of columns from a smoothing matrix. |
D |
Distance matrix, or a subset of columns from a distance matrix. |
newd |
Distances to use for loess prediction. |
cl |
Cluster object, or number of cluster instances to create. Defaults to no parallelization. |
span |
Passed to |
For each column in S
, a loess curve is fit to the values as a function of the distances between points, which are taken from the columns of D
. Thus, the order of rows and columns in S
should match the order of rows and columns in D
.
For a large number of locations, this procedure may be somewhat slow. The cl
argument can be used to parallelize the operation using clusterMap
.
computeS
fitLoess
xloc <- runif(n=100, min=0, max=10)
X <- splines::ns(x=xloc, df=4, intercept=TRUE)
S <- computeS(X)
d <- as.matrix(dist(xloc))
xplot <- 0:10
lC <- compute_lowCurve(S, D=d, newd=xplot)
matplot(xplot, lC$SCurve, type="l", col="black")
points(xplot, lC$SCurveMedian, type="l", col="red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.