residuals.slrm {spatstat.model} | R Documentation |
Residuals for Fitted Spatial Logistic Regression Model
Description
Given a spatial logistic regression model fitted to a point pattern, compute the residuals for each pixel.
Usage
## S3 method for class 'slrm'
residuals(object,
type=c("raw", "deviance", "pearson", "working",
"response", "partial", "score"),
...)
Arguments
object |
The fitted point process model (an object of class |
type |
String (partially matched) indicating the type of residuals to be calculated. |
... |
Ignored. |
Details
This function computes several kinds of residuals for the fit of a spatial logistic regression model to a spatial point pattern dataset.
The argument object
must be a fitted spatial logistic
regression model (object of class "slrm"
). Such objects are
created by the fitting algorithm slrm
.
The residuals are computed for each pixel that was used to fit the original model. The residuals are returned as a pixel image (if the residual values are scalar), or a list of pixel images (if the residual values are vectors).
The type of residual is chosen by the argument type
.
For a given pixel, suppose p
is the fitted probability of
presence of a point, and y
is the presence indicator
(equal to 1 if the pixel contains any data points, and equal to 0
otherwise). Then
-
type="raw"
ortype="response"
specifies the response residualr = y - p
-
type="pearson"
is the Pearson residualr_P = \frac{y - p}{\sqrt{p (1-p)}}
-
type="deviance"
is the deviance residualr_D = (-1)^{y+1} \sqrt{-2(y log p + (1-y) log(1-p))}
-
type="score"
specifies the score residualsr_S = (y-p) x
where
x
is the vector of canonical covariate values for the pixel -
type="working"
specifies the working residuals as defined inresiduals.glm
-
type="partial"
specifies the partial residuals as defined inresiduals.glm
Value
A pixel image (if the residual values are scalar), or a list of pixel images (if the residual values are vectors).
Author(s)
Adrian Baddeley Adrian.Baddeley@curtin.edu.au
See Also
Examples
d <- if(interactive()) 128 else 32
H <- unmark(humberside)
fit <- slrm(H ~ x + y, dimyx=d)
plot(residuals(fit))
plot(residuals(fit, type="score"))