generate_W: Generate a random spatial weight matrix.

Description Usage Arguments Details Value See Also Examples

Description

Generate a spatial weight matrix of given size and number of nearest neighbors from randomly-located observations on the unit square.

Usage

1
generate_W(n, nneigh, seed=123)

Arguments

n

the size of the matrix.

nneigh

the number of nearest neighbors.

seed

an integer to set the seed for the random generated locations.

Details

The output matrix has zero diagonal and it is row-standardised. The n observations are allocated randomly in the unit square. For each observation, the nneigh closests observations w.r.t. the Euclidean distance are assigned with a weight equal to 1/nneigh.

Value

a matrix of class dgCMatrix (sparse matrix).

See Also

sim_binomial_probit.

Examples

1
2
W <- generate_W(100,4,seed=12)
image(W)


Search within the ProbitSpatial package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.