moranTest.bma {spatBMS} | R Documentation

## Moran's I test for spatial residual autocorrelation for models with largest posterior support

### Description

This function is a simple wrapper to calculate the Moran's I statistic for the `n` models with largest posterior support - in terms of posterior model probabilities -identified by the BMA routine `spatFilt.bms`. The null hypothesis of the Moran's I test is that of no spatial autocorrelation. The test used is the lm.morantest. Type `?lm.morantest` for further information. Requires: `library(spdep)` in order to use function `lm.morantest`.

### Usage

    moranTest.bma(object, variants="single",W,nmodel=NULL)

### Arguments

`object` | a 'bma' / 'spatFilt' object (as e.g. resulting from `spatFilt.bms`)
`variants` | default is 'single', if set to double the Moran's I test is also calculated for the best models without including the eigenvectors. Cf. section 'Details' for more options.
`W` | a weight matrix in form of a 'listw' object.
`nmodel` | the number of models for which the Moran's I test is computed. Cannot exceed the number of models stored in `object`.

### Details

Ad `variants`:
This allows for a direct comparison of the degree of spatial autocorrelation for
a) not (!) dealing with the spatial patterns (standard OLS regression)
b) modelling spatial correlation following the spatial filtering approach
If there is no spatial autocorrelation present in case a) one might follow the standard BMA estimation, i.e. use function `bms` instead to deal with uncertainty stemming from the explanatory variables only.

### Value

Each column presents the coefficents for the model indicated by its column name. The zero coefficients are the excluded covariates per model. Note that the coefficients returned are only those of the best (100) models encountered by the `bma` object (cf. argument `nmodels` of `bms`).
For aggregate coefficients please refer to `coef.bma`.

### Author(s)

Martin Feldkircher

### See Also

`spatFilt.bms` for creating bma objects.

Check http://bms.zeugner.eu for additional help.

### Examples

      #sample a bma object:
       data(dataBoston);data(boston.soi);data(WL.boston);
       bma1=spatFilt.bms(X.data=dataBoston,WList=WL.boston,burn=1e04,iter=1e04,nmodel=100)
       mTest=moranTest.bma(bma1,variants="double",W=nb2listw(boston.soi))

      #extract p-values
      pvalueMat=cbind(sapply(mTest$moran,function(x) x$p.value),sapply(mTest$moranEV,function(x) x$p.value))

      #compare boxplots
      Colours=c("#1B9E77", "#D95F02", "#7570B3", "#E7298A", "#66A61E" ,"#E6AB02", "#A6761D", "#666666")
      par(mfrow=c(1,2))
      boxplot(pvalueMat[,1],main="Box plot of p-values \n OLS-regression",xaxt="n",col=Colours[3],outline=FALSE,ylim=c(0,1))
      grid()
      boxplot(pvalueMat[,2],main="Box plot of p-values \n Eigenvector augmented regression",xaxt="n",col=Colours[3],outline=FALSE,ylim=c(0,1))
      grid()
      par(mfrow=c(1,1))

[Package spatBMS version 0.0 Index]