moranTest.bma            package:spatBMS            R Documentation

_M_o_r_a_n'_s _I _t_e_s_t _f_o_r _s_p_a_t_i_a_l _r_e_s_i_d_u_a_l _a_u_t_o_c_o_r_r_e_l_a_t_i_o_n _f_o_r _m_o_d_e_l_s _w_i_t_h _l_a_r_g_e_s_t _p_o_s_t_e_r_i_o_r _s_u_p_p_o_r_t

_D_e_s_c_r_i_p_t_i_o_n:

     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'.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

  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'.

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     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'.

_A_u_t_h_o_r(_s):

     Martin Feldkircher

_S_e_e _A_l_s_o:

     'spatFilt.bms' for creating bma objects.

     Check <URL: http://bms.zeugner.eu> for additional help.

_E_x_a_m_p_l_e_s:

       #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))

