Learn R Programming

spatialprobit (version 1.0.4)

sar_lndet: Approximation of the log determinant \(\ln{|I_n - \rho W|}\) of a spatial weight matrix

Description

Compute the log determinant \(\ln{|I_n - \rho W|}\) of a spatial weight matrix W using either the exact approach, or using some approximations like the Chebyshev log determinant approximation or Pace and Barry approximation.

Usage

sar_lndet(ldetflag, W, rmin, rmax)
lndetfull(W, rmin, rmax)
lndetChebyshev(W, rmin, rmax)

Value

detval

a 2-column Matrix with gridpoints for rho from rmin,...,rmax and corresponding log-determinant

time

execution time

Arguments

ldetflag

flag to compute the exact or approximate log-determinant (Chebychev approximation, Pace and Barry approximation). See details.

W

spatial weight matrix

rmin

minimum eigen value

rmax

maximum eigen value

Author

James P. LeSage, Adapted to R by Miguel Godinho de Matos <miguelgodinhomatos@cmu.edu>

Details

This method will no longer provide its own implementation and will use the already existing methods in the package spatialreg (do_ldet).

ldetflag=0 will compute the exact log-determinant at some gridpoints, whereas ldetflag=1 will compute the Chebyshev log-determinant approximation. ldetflag=2 will compute the Barry and Pace (1999) Monte Carlo approximation of the log-determinant.

Exact log-determinant:
The exact log determinant \(\ln|I_n - \rho W|\) is evaluated on a grid from \(\rho=-1,...,+1\). The gridpoints are then approximated by a spline function.

Chebychev approximation:
This option provides the Chebyshev log-determinant approximation as proposed by Pace and LeSage (2004). The implementation is faster than the full log-determinant method.

References

Pace, R. K. and Barry, R. (1997), Quick Computation of Spatial Autoregressive Estimators, Geographical Analysis, 29, 232--247

R. Barry and R. K. Pace (1999) A Monte Carlo Estimator of the Log Determinant of Large Sparse Matrices, Linear Algebra and its Applications, 289, 41--54.

Pace, R. K. and LeSage, J. (2004), Chebyshev Approximation of log-determinants of spatial weight matrices, Computational Statistics and Data Analysis, 45, 179--196.

LeSage, J. and Pace, R. K. (2009), Introduction to Spatial Econometrics, CRC Press, chapter 4

See Also

do_ldet for computation of log-determinants

Examples

Run this code
require(Matrix)

# sparse matrix representation for spatial weight matrix W (d x d) 
# and m nearest neighbors
d <- 10
m <- 3
W <- sparseMatrix(i=rep(1:d, each=m), 
  j=replicate(d, sample(x=1:d, size=m, replace=FALSE)), x=1/m, dims=c(d, d))

# exact log determinant
ldet1 <- sar_lndet(ldetflag=0, W, rmin=-1, rmax=1)

# Chebychev approximation of log determinant
ldet2 <- sar_lndet(ldetflag=1, W, rmin=-1, rmax=1)

plot(ldet1$detval[,1], ldet1$detval[,2], type="l", col="black", 
  xlab="rho", ylab="ln|I_n - rho W|",
  main="Log-determinant ln|I_n - rho W| Interpolations")
lines(ldet2$detval[,1], ldet2$detval[,2], type="l", col="red")
legend("bottomleft", legend=c("Exact log-determinant", "Chebychev approximation"), 
  lty=1, lwd=1, col=c("black","red"), bty="n")

Run the code above in your browser using DataLab