Learn R Programming

spdep (version 0.3-8)

asMatrixCsrListw: 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)
asMatrixCsrIrW(W, rho)
asMatrixCsrI(n)
asListwMatrixCsr(mcsr)

Arguments

listw
a listw object created for example by nb2listw
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

See Also

as.matrix.csr

Examples

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

Run the code above in your browser using DataLab