# model.matrix.ppm

##### Extract Design Matrix from Point Process Model

Given a point process model that has been fitted to spatial point pattern data, this function extracts the design matrix of the model.

##### Usage

```
## S3 method for class 'ppm':
model.matrix(object, ..., keepNA=TRUE)
```

##### Arguments

- object
- The fitted point process model (an object of class
`"ppm"`

.) - keepNA
- Logical. Determines whether rows containing NA values will be deleted or retained.
- ...
- Other arguments (such as
`na.action`

) passed to`model.matrix.lm`

.

##### Details

This command is a method for the generic function
`model.matrix`

. It extracts the design matrix of a
spatial point process model (class `"ppm"`

).

More precisely, this command extracts
the design matrix of the generalised linear model associated with
a spatial point process model.
The `object`

must be a fitted point process model
(object of class `"ppm"`

) fitted to spatial point pattern data.
Such objects are produced by the model-fitting
function `ppm`

.

This function `model.matrix.ppm`

extracts the model matrix for the GLM.

The result is a matrix, with one row for every quadrature point in the fitting procedure, and one column for every constructed covariate in the design matrix.

If there are `NA`

values in the covariates,
the argument `keepNA`

determines whether to retain or delete
the corresponding rows of the model matrix. The default
`keepNA=TRUE`

is to retain them. Note that this differs from
the default behaviour of many other methods for `model.matrix`

,
which typically delete rows containing `NA`

.
The quadrature points themselves can be extracted using
`quad.ppm`

.

##### Value

- A matrix. Rows of the matrix correspond to quadrature points
in the fitting procedure (provided
`keepNA=TRUE`

). Columns are covariates in the model.

##### See Also

`model.images`

,
`ppm`

,
`ppm.object`

,
`quad.ppm`

,
`residuals.ppm`

,
`model.matrix`

##### Examples

```
data(cells)
fit <- ppm(cells, ~x)
model.matrix(fit)
# matrix with two columns: '(Intercept)' and 'x'
```

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