bw.smoothppp | R Documentation |
Uses least-squares cross-validation to select a smoothing bandwidth for spatial smoothing of marks.
bw.smoothppp(X, nh = spatstat.options("n.bandwidth"),
hmin=NULL, hmax=NULL, warn=TRUE, kernel="gaussian",
varcov1=NULL)
X |
A marked point pattern with numeric marks. |
nh |
Number of trial values of smoothing bandwith |
hmin , hmax |
Optional. Numeric values.
Range of trial values of smoothing bandwith |
warn |
Logical. If |
kernel |
The smoothing kernel.
A character string specifying the smoothing kernel
(current options are |
varcov1 |
Optional. Variance-covariance matrix matrix of the kernel with
bandwidth |
This function selects an appropriate bandwidth for the nonparametric
smoothing of mark values using Smooth.ppp
.
The argument X
must be a marked point pattern
with a vector or data frame of marks. All mark values must be numeric.
The bandwidth is selected by least-squares cross-validation.
Let y_i
be the mark value at the i
th data point.
For a particular choice of smoothing bandwidth,
let \hat y_i
be the smoothed value at the i
th data point.
Then the bandwidth is chosen to minimise
the squared error of the smoothed values
\sum_i (y_i - \hat y_i)^2
.
The result of bw.smoothppp
is a numerical value giving the selected bandwidth sigma
.
The result also belongs to the class "bw.optim"
allowing it to be printed and plotted. The plot shows the cross-validation
criterion as a function of bandwidth.
The range of values for the smoothing bandwidth sigma
is set by the arguments hmin, hmax
. There is a sensible default,
based on the nearest neighbour distances.
If the optimal bandwidth is achieved at an endpoint of the
interval [hmin, hmax]
, the algorithm will issue a warning
(unless warn=FALSE
). If this occurs, then it is probably advisable
to expand the interval by changing the arguments hmin, hmax
.
Computation time depends on the number nh
of trial values
considered, and also on the range [hmin, hmax]
of values
considered, because larger values of sigma
require
calculations involving more pairs of data points.
A single numerical value giving the selected bandwidth.
The result also belongs to the class "bw.optim"
(see bw.optim.object
)
which can be plotted to show the bandwidth selection criterion
as a function of sigma
.
Anisotropic smoothing is available in Smooth.ppp
using
the argument varcov
to specify the variance-covariance
matrix of the anisotropic kernel. In order to choose the matrix
varcov
, the user can call bw.smoothppp
using the argument varcov1
to specify a ‘template’
matrix. Scalar multiples of varcov1
will be
considered and the optimal scale factor will be determined.
That is, bw.smoothppp
will try
smoothing the data using varcov = h^2 * varcov1
for different
values of h
ranging from hmin
to hmax
.
The result of bw.smoothppp
will be the optimal value
of the standard deviation scale factor h
.
and \rolf
Smooth.ppp
,
bw.optim.object
b <- bw.smoothppp(longleaf)
b
plot(b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.