Description Usage Arguments Details Value Author(s) See Also Examples

`tessresid`

divides the space-time window into bins using a Voronoi tessellation and calculates residuals within each bin for a specified conditional intensity model.

1 2 |

`X` |
A “ |

`cifunction` |
A function returning the value of the conditional intensity at all points in |

`theta` |
Optional: A vector of parameters to be passed to |

`algthm` |
The algorithm used for estimating the integrals in each tessellation cell. The three algorithms are “ |

`n` |
Initial number of sample points in each grid tessellation for approximating integrals. The number of sample points are iteratively increased by |

`n.miser` |
The total number of sample points for estimating all integrals. |

`ints` |
An optional vector of integrals. Must be the same length as the number of tessellation cells, and each element of |

Tessellation residuals are residuals calculated in bins that are created by dividing up the spatial window using a Voronoi tessellation. Because the bins are based on a tessellation, each bin contains at most one point. The residual in bin i (*V_i*) is defined by

*R_{T}(V_{i}) = ≤ft(1 - \int_{V_{i}}\hat{λ}(x)dx\right)/√{\int_{V_{i}}\hat{λ}(x)dx},*

where *lambda_hat(x)* is the fitted conditional intensity model.

The conditional intensity function, `cifunction`

, should take `X`

as the first argument, and an optional `theta`

as the second argument, and return a vector of conditional intensity estimates with length equal to the number of points in `X`

, i.e. the length of `X$x`

. `cifunction`

is required, while `lambda`

is optional. `lambda`

eliminates the need for `tessresid`

to calculate the conditional intensity at each observed point in `X`

.

The integrals in *R_{T}(V_{i})* are approximated using one of two algorithms: a simple Monte Carlo (`mc`

) algorithm, or the MISER algorithm. The simple Monte Carlo iteratively adds `n`

sample points to each tessellation cell to approximate the integral, and the iteration stops when some threshold in the accuracy of the approximation is reached. The MISER algorithm samples a total number of `n.miser`

points in a recursive way, sampling the points in locations that have the highest variance. This part can be very slow and the approximations can be very inaccurate. For highest accuracy these algorithms will require a very large `n`

or `n.miser`

depending on the complexity of the conditional intensity functions (some might say ~1 billion sample points are needed for a good approximation).

Passing the argument `ints`

eliminates the need for approximating the integrals using either of the two algorithms here. However, the `tile.list`

must first be obtained in order to assure that each element of `ints`

corresponds to the correct cell. The `tile.list`

can be obtained, either by using the `deldir`

function separately, or by using `tessresid`

with one of the included algorithms first (the `tile.list`

is returned along with the residuals). `tessresid`

can then be called again with `ints`

included and `algthm`

= “`none`

”.

Note that if `miser`

is selected, and if the points in the point pattern are very densely clustered, the integral in some cells may end up being approximated based on only the observed point in the point pattern that is contained in that cell. This happens because the cells in these clusters of points will be very small, and so it may be likely that sampled points based on the MISER algorithm will miss these cells entirely. For this reason, the simple Monte Carlo algorithm might be preferred.

Outputs an object of class “`tessresid`

”, which is a list of

`X ` |
An object of class “ |

`tile.list ` |
An object of type “ pt: x and y coordinates of the point. x: x coordinates of the vertices of the tessellation cell. y: y coordinates of the vertices of the tessellation cell. |

`residuals ` |
A vector of tessellation residuals. The order of the residuals corresponds with the order of the cells in |

Robert Clements

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
#===> load simulated data <===#
data(simdata)
X <- stpp(simdata$x, simdata$y, simdata$t)
#===> define two conditional intensity functions <===#
ci1 <- function(X, theta){theta*exp(-2*X$x - 2*X$y - 2*X$t)} #correct model
ci2 <- function(X, theta = NULL){rep(250, length(X$x))} #homogeneous Poisson model
## Not run:
tsresiduals <- tessresid(X, ci1, theta = 3000)
tsresiduals2 <- tessresid(X, ci2)
#===> plot results <===#
plot(tsresiduals)
plot(tsresiduals2)
## End(Not run)
``` |

stppResid documentation built on May 19, 2017, 1:37 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.