thinresid: Perform thinned residuals method

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

View source: R/thinresid.R

Description

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

Usage

1
thinresid(X, cifunction = NULL, theta = NULL, k = NULL, lambda = NULL)

Arguments

X

A “stpp” object.

cifunction

A function returning the value of the conditional intensity at all points in X. The function should take arguments X and an optional vector of parameters theta.

theta

Optional: A vector of parameters to be passed to cifunction.

k

The thinning rate.

lambda

Optional: A vector of conditional intensities at each point in X.

Details

Thinned residuals is a type of transformation based residuals for space-time point processes (see Schoenberg (2003)) which consists of thinning out the observed points using the fitted conditional intensity model, lambda_hat. Each point is kept with probability k/lambda_hat, where k should be the minimum 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 thinresid to calculate the conditional intensity at each observed point in X.

If k is not specified, the default is the minimum lambda_hat estimated at the points.

Value

Outputs an object of class “thinresid”, which is a list of

X

An object of class “stpp”.

k

The thinning rate.

residuals

A data frame consisting of the x, y, and t coordinates of the thinned residuals.

deleted

A data frame consisting of the x, y, and t coordinates of the points removed during the thinning process.

Author(s)

Robert Clements

References

Schoenberg, F.P. (2003) Multi-dimensional residuals analysis of point process models for earthquake occurrences. Journal of the American Statistical Association, 98, 789–795.

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.

See Also

stpp, supresid, superthin

Examples

 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

tresiduals1 <- thinresid(X, ci1, theta = c(3000, 2, 2, 2))
tresiduals2 <- thinresid(X, ci1, theta = c(2500, 5, 5, 10))
#===> plot results <===#
par(mfrow = c(1,2))
plot(tresiduals1)
plot(tresiduals2)

summary(tresiduals1)
summary(tresiduals2)

stppResid documentation built on May 29, 2017, 3:48 p.m.