Given a fitted Spatial Logistic Regression model, this function computes the fitted probabilities for each pixel, or the fitted probabilities at each original data point.
# S3 method for slrm
fitted(object, ..., type="probabilities",
dataonly=FALSE, leaveoneout=FALSE)A pixel image (object of class "im") containing the
fitted probability for each pixel,
or a numeric vector containing the fitted probability at each data point.
a fitted spatial logistic regression model.
An object of class "slrm".
Ignored.
Character string (partially) matching one of
"probabilities", "intensity" or "link"
determining the quantity that should be predicted.
Logical. If TRUE, then values will be computed
at the points of the data point pattern. If FALSE, then
values will be computed at the pixels used to fit the model.
Logical value specifying whether to perform a leave-one-out calculation. See Details.
Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.
This is a method for the generic function
fitted
for spatial logistic regression models
(objects of class "slrm", usually obtained
from the function slrm).
By default, the fitted presence probabilities in each pixel are computed and returned as a pixel image.
If dataonly=FALSE (the default), a value is computed
for each pixel in a fine grid.
If dataonly=TRUE, a value is computed for each
of the points in the original spatial point pattern.
If leaveoneout=FALSE (the default), fitted values are extracted
from the fitted model object.
If leaveoneout=TRUE, then a leave-one-out calculation is
performed:
If dataonly=FALSE and leaveoneout=TRUE,
the predicted value in each pixel is computed using a leave-one-out
calculation. At each pixel j, the model is re-fitted using all the
data except the data inside pixel j, and this updated model is
then predicted using the data inside pixel j.
(‘Leave one pixel out’)
If dataonly=TRUE and leaveoneout=TRUE,
the predicted value for each data point X[i] is calculated
by re-fitting the model to the data with X[i] removed,
and then predicting this model at location X[i].
(‘Leave one point out’)
slrm,
fitted
X <- rpoispp(42)
fit <- slrm(X ~ x+y)
plot(fitted(fit))
fitted(fit, dataonly=TRUE)
Run the code above in your browser using DataLab