Calculate values of the heat kernel in a rectangle with insulated edges.

```
hotbox(Xsource, Xquery, sigma,
..., W=NULL, squared=FALSE, nmax=20)
```

If `Xquery`

is a point pattern,
the result is a numeric vector with one entry for each query point.

If `Xquery`

is an image or window, the result is
a pixel image.

- Xsource
Point pattern of sources of heat. Object of class

`"ppp"`

or convertible to a point pattern using`as.ppp(Xsource, W)`

.- Xquery
Locations where the heat kernel value is required. An object of class

`"ppp"`

specifying query location points, or an object of class`"im"`

or`"owin"`

specifying a grid of query points.- sigma
Bandwidth for kernel. A single number.

- ...
Extra arguments (passed to

`as.mask`

) controlling the pixel resolution of the result, when`Xquery`

is a window or an image.- W
Window (object of class

`"owin"`

) used to define the spatial domain when`Xsource`

is not of class`"ppp"`

.- squared
Logical value indicating whether to take the square of each heat kernel value, before summing over the source points.

- nmax
Number of terms to be used from the infinite-sum expression for the heat kernel. A single integer.

Adrian Baddeley and Greg McSwiggan.

This function computes the sum of heat kernels associated with each of the source points, evaluating them at each query location.

The window for evaluation of the heat kernel must be a rectangle.

The heat kernel in any region can be expressed as an infinite sum of terms
associated with the eigenfunctions of the Laplacian. The heat kernel
in a rectangle is the product of heat kernels for
one-dimensional intervals on the horizontal and vertical axes. This
function uses `hotrod`

to compute the
one-dimensional heat kernels, truncating the infinite sum to the
first `nmax`

terms, and then calculates the two-dimensional heat
kernel from each source point to each query location. If
`squared=TRUE`

these values are squared. Finally the values are
summed over all source points to obtain a single value for each
query location.

Baddeley, A., Davies, T., Rakshit, S., Nair, G. and McSwiggan, G. (2021)
Diffusion smoothing for spatial point patterns.
*Statistical Science*, in press.

`densityHeat.ppp`

```
X <- runifpoint(10)
Y <- runifpoint(5)
hotbox(X, Y, 0.1)
plot(hotbox(X, Window(X), 0.1))
points(X, pch=16)
```

Run the code above in your browser using DataLab