Skip to contents

SarPoisson, SarNegbin, SarZip, SarZinb: Poisson, negative binomial (NB2), zero-inflated Poisson and zero-inflated negative binomial regressions with the spatially lagged mean \(\exp((I - \rho W)^{-1} X \beta)\), by profile maximum likelihood over rho (IRLS, dispersion ML and EM for fixed rho). SarPoissonLmTest: score test of rho = 0. CountModelIc: AIC, BIC, AICc. BymVarianceFraction: spatial share of the BYM variance with Sorbye-Rue scaling. Identical to the Python arm morie.fn.spcount.

Usage

SarPoisson(y, X, W, rho_bounds = c(-0.99, 0.99))

SarNegbin(y, X, W, rho_bounds = c(-0.99, 0.99))

SarZip(y, X, W, Z = NULL, rho_bounds = c(-0.99, 0.99))

SarZinb(y, X, W, Z = NULL, rho_bounds = c(-0.99, 0.99))

SarPoissonLmTest(y, X, W)

CountModelIc(loglik, k, n)

BymVarianceFraction(var_spatial, var_unstructured, Q = NULL)

Arguments

y

Counts.

X

Design matrix (with intercept).

W

Spatial weights matrix.

rho_bounds

Search interval for rho.

Z

Zero-model design (default intercept).

loglik, k, n

Log-likelihood, number of parameters, sample size.

var_spatial, var_unstructured

Spatial and unstructured variances.

Q

ICAR structure matrix (optional).

Value

List.

References

Lambert, D. M., Brown, J. P. and Florax, R. J. G. M. (2010). A two-step estimator for a spatial lag model of counts. Regional Science and Urban Economics 40, 241-252.

Lambert, D. (1992). Zero-inflated Poisson regression. Technometrics 34, 1-14.

Riebler, A., Sorbye, S. H., Simpson, D. and Rue, H. (2016). An intuitive Bayesian spatial model for disease mapping that accounts for scaling. Statistical Methods in Medical Research 25, 1145-1165.

Examples

W <- rbind(c(0, 1, 0, 0), c(0.5, 0, 0.5, 0), c(0, 0.5, 0, 0.5), c(0, 0, 1, 0))
X <- cbind(1, c(0.1, 0.4, 0.5, 0.9))
SarPoisson(c(1, 3, 4, 7), X, W)$rho
#> [1] 0.3588537
CountModelIc(-10, 3, 20)$BIC
#> [1] 28.9872