residuals.slrm | R Documentation |
Given a spatial logistic regression model fitted to a point pattern, compute the residuals for each pixel.
## S3 method for class 'slrm'
residuals(object,
type=c("raw", "deviance", "pearson", "working",
"response", "partial", "score"),
...)
object |
The fitted point process model (an object of class |
type |
String (partially matched) indicating the type of residuals to be calculated. |
... |
Ignored. |
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"
or type="response"
specifies
the response residual
r = y - p
type="pearson"
is the Pearson residual
r_P = \frac{y - p}{\sqrt{p (1-p)}}
type="deviance"
is the deviance residual
r_D = (-1)^{y+1} \sqrt{-2(y log p + (1-y) log(1-p))}
type="score"
specifies the score residuals
r_S = (y-p) x
where x
is the vector of canonical covariate values
for the pixel
type="working"
specifies the working residuals
as defined in residuals.glm
type="partial"
specifies the partial residuals
as defined in residuals.glm
A pixel image (if the residual values are scalar), or a list of pixel images (if the residual values are vectors).
residuals.glm
,
residuals.ppm
d <- if(interactive()) 128 else 32
H <- unmark(humberside)
fit <- slrm(H ~ x + y, dimyx=d)
plot(residuals(fit))
plot(residuals(fit, type="score"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.