Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

model.matrix.lppm

Extract Design Matrix from Point Process Model on a Network


Description

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

Usage

## S3 method for class 'lppm'
model.matrix(object,
                              data=model.frame(object, na.action=NULL),
                              ..., 
                              keepNA=TRUE)

Arguments

object

The fitted point process model. An object of class "lppm".

data

A model frame, containing the data required for the Berman-Turner device.

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 is a method for the generic function model.matrix. It extracts the design matrix of a spatial point process model on a linear network (object of class "lppm").

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 on a network (object of class "lppm") produced by the model-fitting function lppm. The method model.matrix.lppm 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 canonical 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.

Value

A matrix. Columns of the matrix are canonical covariates in the model. Rows of the matrix correspond to quadrature points in the fitting procedure (provided keepNA=TRUE).

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

See Also

Examples

fit <- lppm(spiders ~ x + y)
   head(model.matrix(fit))

spatstat.linnet

Linear Networks Functionality of the 'spatstat' Family

v2.1-1
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Ottmar Cronie [ctb], Tilman Davies [ctb], Greg McSwiggan [ctb], Suman Rakshit [ctb]
Initial release
2021-03-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.