# slrm

##### Spatial Logistic Regression

Fits a spatial logistic regression model to a spatial point pattern.

##### Usage

```
slrm(formula, ..., data = NULL, offset = TRUE, link = "logit",
dataAtPoints=NULL, splitby=NULL)
```

##### Arguments

- formula
- The model formula. See Details.
- ...
- Optional arguments passed to
`pixellate`

determining the pixel resolution for the discretisation of the point pattern. - data
- Optional. A list containing data required in the formula. The names of entries in the list should correspond to variable names in the formula. The entries should be point patterns, pixel images or windows.
- offset
- Logical flag indicating whether the model formula should be augmented by an offset equal to the logarithm of the pixel area.
- link
- The link function for the regression model. A character string, specifying a link function for binary regression.
- dataAtPoints
- Optional.
Exact values of the covariates at the data points.
A data frame, with column names corresponding to
variables in the
`formula`

, with one row for each point in the point pattern dataset. - splitby
- Optional. Character string identifying a window. The window will be used to split pixels into sub-pixels.

##### Details

This function fits a Spatial Logistic Regression model (Tukey, 1972; Agterberg, 1974) to a spatial point pattern dataset. The logistic function may be replaced by another link function.

The `formula`

specifies the form of the model to be fitted,
and the data to which it should be fitted. The `formula`

must be an Rformula with a left and right hand
side.

The left hand side of the `formula`

is the name of the
point pattern dataset, an object of class `"ppp"`

.

The right hand side of the `formula`

is an expression,
in the usual Rformula syntax, representing the functional form of
the linear predictor for the model.

Each variable name that appears in the formula may be

- one of the reserved names
`x`

and`y`

, referring to the Cartesian coordinates; - the name of an entry in the list
`data`

, if this argument is given; - the name of an object in the
parent environment, that is, in the environment where the call
to
`slrm`

was issued.

- a pixel image (object of class
`"im"`

) containing the values of a covariate; - a window (object of class
`"owin"`

), which will be interpreted as a logical covariate which is`TRUE`

inside the window and`FALSE`

outside it; - a
`function`

in theRlanguage, with arguments`x,y`

, which can be evaluated at any location to obtain the values of a covariate.

The fitting algorithm discretises the point pattern onto a pixel grid. The value in each pixel is 1 if there are any points of the point pattern in the pixel, and 0 if there are no points in the pixel. The dimensions of the pixel grid will be determined as follows:

- The pixel grid will be determined by the extra
arguments
`...`

if they are specified (for example the argument`dimyx`

can be used to specify the number of pixels). - Otherwise, if the right hand side of the
`formula`

includes the names of any pixel images containing covariate values, these images will determine the pixel grid for the discretisation. The covariate image with the finest grid (the smallest pixels) will be used. - Otherwise, the default pixel grid size is given by
`spatstat.options("npixel")`

.

`link="logit"`

(the default), the algorithm fits a Spatial Logistic
Regression model. This model states that the probability
$p$ that a given pixel contains a data point, is related to the
covariates through
$$\log\frac{p}{1-p} = \eta$$
where $\eta$ is the linear predictor of the model
(a linear combination of the covariates,
whose form is specified by the `formula`

). If `link="cloglog"`

then the algorithm fits a model stating that
$$\log(-\log(1-p)) = \eta$$.

If `offset=TRUE`

(the default), the model formula will be
augmented by adding an offset term equal to the logarithm of the pixel
area. This ensures that the fitted parameters are
approximately independent of pixel size.
If `offset=FALSE`

, the offset is not included, and the
traditional form of Spatial Logistic Regression is fitted.

##### Value

- An object of class
`"slrm"`

representing the fitted model.There are many methods for this class, including methods for

`print`

,`fitted`

,`predict`

,`anova`

,`coef`

,`logLik`

,`terms`

,`update`

,`formula`

and`vcov`

. Automated stepwise model selection is possible using`step`

. Confidence intervals for the parameters can be computed using`confint`

.

##### References

Agterberg, F.P. (1974)
Automatic contouring of geological maps to detect target areas for
mineral exploration.
*Journal of the International Association for Mathematical Geology*
**6**, 373--395.

Baddeley, A., Berman, M., Fisher, N.I., Hardegen, A., Milne, R.K.,
Schuhmacher, D., Shah, R. and Turner, R. (2010)
Spatial logistic regression and change-of-support
for spatial Poisson point processes.
*Electronic Journal of Statistics*
**4**, 1151--1201.
{doi: 10.1214/10-EJS581}

Tukey, J.W. (1972)
Discussion of paper by F.P. Agterberg and S.C. Robinson.
*Bulletin of the International Statistical Institute*
**44** (1) p. 596.
Proceedings, 38th Congress, International Statistical Institute.

##### See Also

`anova.slrm`

,
`coef.slrm`

,
`fitted.slrm`

,
`logLik.slrm`

,
`plot.slrm`

,
`predict.slrm`

,
`vcov.slrm`

##### Examples

```
X <- copper$SouthPoints
slrm(X ~ 1)
slrm(X ~ x+y)
slrm(X ~ x+y, link="cloglog")
# specify a grid of 2-km-square pixels
slrm(X ~ 1, eps=2)
Y <- copper$SouthLines
Z <- distmap(Y)
slrm(X ~ Z)
slrm(X ~ Z, dataAtPoints=list(Z=nncross(X,Y,what="dist")))
dat <- list(A=X, V=Z)
slrm(A ~ V, data=dat)
```

*Documentation reproduced from package spatstat, version 1.34-1, License: GPL (>= 2)*