sim_sar {geostan} | R Documentation |
Given a spatial weights matrix and degree of autocorrelation, returns autocorrelated data.
sim_sar(m = 1, mu = rep(0, nrow(w)), w, rho, sigma = 1, ...)
m |
The number of samples required. Defaults to |
mu |
An |
w |
Row-standardized |
rho |
Spatial autocorrelation parameter in the range (-1, 1). Typically a scalar value; otherwise an n-length numeric vector. |
sigma |
Scale parameter (standard deviation). Defaults to |
... |
further arguments passed to |
Calls MASS::mvrnorm
internally to draw from the multivariate normal distribution. The covariance matrix is specified following the simultaneous autoregressive (SAR, aka spatial error) model.
If m = 1
a vector of the same length as mu
, otherwise an m x length(mu)
matrix with one sample in each row.
aple
, mc
, moran_plot
, lisa
, shape2mat
data(georgia)
w <- shape2mat(georgia, "W")
x <- sim_sar(w = w, rho = 0.5)
aple(x, w)
x <- sim_sar(w = w, rho = 0.7, m = 10)
dim(x)
apply(x, 1, aple, w = w)