`supresid`

takes a space-time point pattern and conditional intensity model and calculates a set of superposed residuals for further analysis.

1 |

`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 |

`k` |
The superposition rate. |

`lambda` |
Optional: A vector of conditional intensities at each point in |

Superposed residuals is a type of transformation based residuals for space-time point processes (see Bremaud (1981)) which consists of superimposing a point process with rate `k`

- *lambda_hat* onto the observed point process. `k`

should be the maximum conditional intensity over the entire space-time window. If the model for the conditional intensity is correct, the residuals should be homogeneous Poisson with rate `k`

. Any patterns or inter-point interaction in the residuals indicates a lack of fit of the model. To test for homogeneity, a commonly used tool is Ripley's K-function, a version of which can be found in the `spatstat`

package.

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 `supresid`

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

.

If `k`

is not specified, the default is the maximum *lambda_hat* estimated at the points.

Outputs an object of class “`supresid`

”, which is a list of

`X ` |
An object of class “ |

`k ` |
The superposition rate. |

`residuals ` |
A data frame consisting of the x, y, and t coordinates of the superposed residuals. |

`super ` |
A data frame consisting of the x, y, and t coordinates of the superposed points. |

Robert Clements

Bremaud, P. *Point Processes and Queues: Martingale Dynamics.* SpringerVerlag, New York, 1981.

Clements, R.A., Schoenberg, F.P., and Schorlemmer, D. (2011) Residual analysis methods for space-time point processes with applications to earthquake forecast models in California. *Annals of Applied Statistics,* **5**, Number 4, 2549–2571.

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 conditional intensity function <===#
ci1 <- function(X, theta){theta[1]*exp(-theta[2]*X$x -
theta[3]*X$y - theta[4]*X$t)} #correct model
sresiduals1 <- supresid(X, ci1, theta = c(3000, 2, 2, 2))
sresiduals2 <- supresid(X, ci1, theta = c(2500, 5, 5, 10))
#===> plot results <===#
par(mfrow = c(1,2))
plot(sresiduals1)
plot(sresiduals2)
summary(sresiduals1)
summary(sresiduals2)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

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.