View source: R/multiscale.density.R
multiscale.density  R Documentation 
Computes adaptive kernel estimates of spatial density/intensity using a 3D FFT for multiple global bandwidth scales.
multiscale.density(
pp,
h0,
hp = NULL,
h0fac = c(0.25, 1.5),
edge = c("uniform", "none"),
resolution = 128,
dimz = 64,
gamma.scale = "geometric",
trim = 5,
intensity = FALSE,
pilot.density = NULL,
xy = NULL,
taper = TRUE,
verbose = TRUE
)
pp 
An object of class 
h0 
Reference global bandwidth for adaptive smoothing; numeric value >
0. Multiscale estimates will be computed by rescaling this value as per

hp 
Pilot bandwidth (scalar, numeric > 0) to be used for fixed
bandwidth estimation of the pilot density. If 
h0fac 
A numeric vector of length 2 stipulating the span of the global
bandwidths in the multiscale estimates. Interpreted as a multiplicative
factor on 
edge 
Character string dictating edge correction. 
resolution 
Numeric value > 0. Resolution of evaluation grid in the
spatial domain; the densities/intensities will be returned on a
[ 
dimz 
Resolution of z (rescaled bandwidth)axis in the trivariate convolution. Higher values increase precision of the multiscale estimates at a computational cost. See ‘Details’. 
gamma.scale 
Scalar, numeric value > 0; controls rescaling of the
variable bandwidths. Defaults to the geometric mean of the bandwidth factors
given the pilot density (as per Silverman, 1986). See the documentation for

trim 
Numeric value > 0; controls bandwidth truncation for adaptive
estimation. See the documentation for 
intensity 
Logical value indicating whether to return an intensity estimate (integrates to the sample size over the study region), or a density estimate (default, integrates to 1). 
pilot.density 
An optional pixel image (class

xy 
Optional alternative specification of the spatial evaluation grid;
matches the argument of the same tag in 
taper 
Logical value indicating whether to taper off the trivariate
kernel outside the range of 
verbose 
Logical value indicating whether to print function progress. 
Davies & Baddeley (2018) investigated computational aspects of Abramson's (1982) adaptive kernel smoother for spatial (2D) data. This function is the implementation of the 3D convolution via a fastFourier transform (FFT) which allows simultaneous calculation of an adaptive kernel estimate at multiple global bandwidth scales.
These ‘multiple global bandwidth scales’ are computed with respect to
rescaling a reference value of the global bandwidth passed to the h0
argument. This rescaling is defined by the range provided to the argument
h0fac
. For example, by default, the function will compute the
adaptive kernel estimate for a range of global bandwidths between
0.25*h0
and 1.5*h0
. The exact numeric limits are subject to
discretisation, and so the returned valid range of global bandwidths will
differ slightly. The exact resulting range following function execution is
returned as the h0range
element of the result, see ‘Value’ below.
The distinct values of global bandwidth used (which define the
aforementioned h0range
) and hence the total number of pixel
images
returned depend on both the width of the span
h0fac
and the discretisation applied to the bandwidth axis through
dimz
. Increasing this zresolution will provide more pixel images and
hence greater numeric precision, but increases computational cost. The
returned pixel images
that represent the multiscale
estimates are stored in a named list (see ‘Value’), whose names reflect the
corresponding distinct global bandwidth. See ‘Examples’ for the easy way to
extract these distinct global bandwidths.
The user can request an interpolated density/intensity estimate for any
global bandwidth value within h0range
by using the
multiscale.slice
function, which returns an object of class
bivden
.
An object of class "msden"
. This is very similar to a
bivden
object, with lists of pixel
im
ages in the z
, him
, and q
components (instead of standalone images).
z 
A list of the resulting
density/intensity estimates; each member being a pixel image object of class

h0 
A copy of the reference value of 
h0range 
A vector of length 2 giving the actual range of global bandwidth values available (inclusive). 
hp 
A copy of the value of 
h 
A numeric vector of length equal to the
number of data points, giving the bandwidth used for the corresponding
observation in 
him 
A list of pixel images (class 
q 
Edgecorrection weights; list of pixel 
gamma 
The numeric value of 
geometric 
The geometric mean of the
untrimmed variable bandwidth factors. This will be identical to 
pp 
A copy of the 
T.M. Davies and A. Baddeley
Abramson, I. (1982). On bandwidth variation in kernel estimates — a square root law, Annals of Statistics, 10(4), 12171223.
Davies, T.M. and Baddeley A. (2018), Fast computation of spatially adaptive kernel estimates, Statistics and Computing, 28(4), 937956.
Silverman, B.W. (1986), Density Estimation for Statistics and Data Analysis, Chapman & Hall, New York.
bivariate.density
, multiscale.slice
data(chorley) # ChorleyRibble data (package 'spatstat')
ch.multi < multiscale.density(chorley,h0=1)
plot(ch.multi)
ch.pilot < bivariate.density(chorley,h0=0.75) # with predefined pilot density
ch.multi2 < multiscale.density(chorley,h0=1,pilot.density=ch.pilot$z)
plot(ch.multi2)
data(pbc)
# widen h0 scale, increase zaxis resolution
pbc.multi < multiscale.density(pbc,h0=2,hp=1,h0fac=c(0.25,2.5),dimz=128)
plot(pbc.multi)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.