Skip to contents

Front ends for the spatial lag model \(y = \rho W y + X\beta + e\); R arm of the Python modules morie.fn.sar*. Sardet and Sarjac: the log-Jacobian \(\log|I - \rho W|\) by LU. Sarlrt: likelihood ratio \(2(l_1 - l_0)\) against chi-square. Sarwald: \((\rho/se)^2\) against chi-square(1). Sarr2: Nagelkerke's rescaled R-squared. Sarfilt: the filter \((I - \rho W)y\). Sarres: Moran's I of residuals, exact test (as spdep::lm.morantest) when the design is given. Sarsc: LM (score) test of \(\rho = 0\) after OLS with its error-robust form. Sarimp, Sarspil: LeSage-Pace average direct, indirect and total impacts and the indirect/direct ratio. Sarsim: impacts of parameter draws from \(N((\rho, \beta), V)\) (Philox normals). Sarvar: inverse analytic information matrix of \((\beta, \rho, \sigma^2)\). Sarboot: residual-bootstrap percentile interval for \(\rho\) (Philox resampling).

Usage

Sardet(W, rho)

Sarjac(W, rho)

Sarlrt(ll_sar, ll_ols, df = 1)

Sarwald(rho, se_rho)

Sarr2(ll_model, ll_null, n)

Sarfilt(y, W, rho = 0.3)

Sarres(resid, W, X = NULL)

Sarsc(y, X, W)

Sarimp(coef, rho, W)

Sarspil(coef, rho, W)

Sarsim(coef, rho, W, nsim = 99, vcov = NULL, seed = 0)

Sarvar(X, W, rho, sigma2, beta)

Sarboot(y, X, W, B = 99, seed = 0, level = 0.95)

Arguments

W

Spatial weights matrix.

rho

Spatial lag parameter.

ll_sar, ll_ols

Log-likelihoods of the SAR and the OLS model.

df

Degrees of freedom.

se_rho

Standard error of rho.

ll_model, ll_null

Log-likelihoods of the model and the null model.

n

Number of observations.

y

Response (or series to filter).

resid

Model residuals.

X

Design matrix including any intercept column (optional for Sarres).

coef

Slopes of the lag model, without intercept.

nsim

Number of simulation draws.

vcov

Covariance of c(rho, coef).

seed

Philox seed.

sigma2

Error variance.

beta

Regression coefficients including the intercept.

B

Bootstrap replicates.

level

Confidence level.

Value

A list whose statistic is the headline value, with the components of the Python result's extra.

References

Ord, K. (1975). Estimation methods for models of spatial interaction. Journal of the American Statistical Association 70, 120-126.

Anselin, L. (1988). Spatial Econometrics: Methods and Models. Kluwer, Dordrecht.

Anselin, L., Bera, A. K., Florax, R. and Yoon, M. J. (1996). Simple diagnostic tests for spatial dependence. Regional Science and Urban Economics 26, 77-104.

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

Nagelkerke, N. J. D. (1991). A note on a general definition of the coefficient of determination. Biometrika 78, 691-692.

Efron, B. and Tibshirani, R. J. (1993). An Introduction to the Bootstrap. Chapman and Hall.

Examples

W <- matrix(c(0, .5, 0, 1, 0, 1, 0, .5, 0), 3)
Sardet(matrix(c(0, 1, 1, 0), 2), 0.5)$statistic
#> [1] -0.2876821
Sarimp(2, 0.4, W)$total
#> [1] 3.333333
Sarlrt(-10, -12.5)$p_value
#> [1] 0.02534732