asMatrixCsrListw {spdep} | R Documentation

## Convert spatial weights list to CSR matrix form

### Description

`asMatrixCsrListw` creates a `matrix.csr` from a `listw` object, `asMatrixCsrIrW` is a helper function used in fitting SAR models and elsewhere to make a (I - rho W) `matrix.csr` object from W; `asListwMatrixCsr` performs the reverse conversion from `matrix.csr` to `listw` object.

### Usage

    asMatrixCsrListw(listw, zero.policy=FALSE)
    asMatrixCsrIrW(W, rho)
    asMatrixCsrI(n)
    asListwMatrixCsr(mcsr)

### Arguments

`listw` | a `listw` object created for example by `nb2listw`
`zero.policy` | if TRUE assign zero to the lagged value of zones without neighbours, if FALSE (default) assume no cases of no neighbours - if they are in fact present, `asMatrixCsrListw()` will terminate with an error
`W` | a `matrix.csr` object created using `asMatrixCsrListw` from a `listw` object
`rho` | spatial regression coefficient
`n` | length of diagonal for identity matrix
`mcsr` | a `matrix.csr` object

### Value

`asMatrixCsrListw` and `asMatrixCsrIrW` return `matrix.csr` objects; `asListwMatrixCsr` returns a `listw` object

### Author(s)

Roger Bivand Roger.Bivand@nhh.no

### See Also

`as.matrix.csr`

### Examples

    data(oldcol)
    COL.W <- nb2listw(COL.nb, style="W")
    COL.W
    image(asMatrixCsrListw(COL.W))

[Package spdep version 0.3-25 Index]