trW {spdep} | R Documentation

## Spatial weights matrix powers traces

### Description

The function is used to prepare a vector of traces of pwers of a spatial weights matrix

### Usage

    trW(W, m = 100, p = 50, type = "mult")

### Arguments

`W` | A spatial weights matrix in CsparseMatrix form
`m` | The number of powers
`p` | The number of samples used in Monte Carlo simulation of the traces if type is MC
`type` | Either mult (default) for powering a sparse matrix, or MC for Monte Carlo simulation of the traces

### Value

A numeric vector of `m` traces.

### Author(s)

Roger Bivand Roger.Bivand@nhh.no

### References

LeSage J and RK Pace (2009) Introduction to Spatial Econometrics. CRC Press, Boca Raton, pp. 96–105.

### See Also

`as_dgRMatrix_listw`, `nb2listw`

### Examples

    example(columbus)
    listw <- nb2listw(col.gal.nb)
    W <- as(as_dgRMatrix_listw(listw), "CsparseMatrix")
    trMat <- trW(W, type="mult")
    str(trMat)
    trMC <- trW(W, type="MC")
    str(trMC)
    plot(trMat, trMC)

[Package spdep version 0.4-56 Index]