View source: R/GWPR.moran.test.R
GWPR.moran.test | R Documentation |
Moran's I test for spatial autocorrelation in residuals from an estimated panel linear model (plm).
GWPR.moran.test(plm_model, SDF, bw, adaptive = FALSE, p = 2, kernel = "bisquare", longlat = FALSE, alternative = "greater")
plm_model |
An object of class inheriting from "plm", see plm |
SDF |
Spatial*DataFrame on which is based the data, with the "ID" in the index |
bw |
The optimal bandwidth, either adaptive or fixed distance |
adaptive |
If TRUE, adaptive distance bandwidth is used, otherwise, fixed distance bandwidth. |
p |
The power of the Minkowski distance, default is 2, i.e. the Euclidean distance |
kernel |
bisquare: wgt = (1-(vdist/bw)^2)^2 if vdist < bw, wgt=0 otherwise (default); gaussian: wgt = exp(-.5*(vdist/bw)^2); exponential: wgt = exp(-vdist/bw); tricube: wgt = (1-(vdist/bw)^3)^3 if vdist < bw, wgt=0 otherwise; boxcar: wgt=1 if dist < bw, wgt=0 otherwise |
longlat |
If TRUE, great circle distances will be calculated |
alternative |
A character string specifying the alternative hypothesis, must be one of greater (default), less or two.sided. |
A list of result:
the value of the standard deviate of Moran's I.
the p-value of the test.
the value of the observed Moran's I.
the value of the expectation of Moran's I.
the value of the variance of Moran's I.
a character string describing the alternative hypothesis.
: Current version of panel Moran's I test can only chech the balanced panel data.
Chao Li <chaoli0394@gmail.com> Shunsuke Managi
Beenstock, M., Felsenstein, D., 2019. The econometric analysis of non-stationary spatial panel data. Springer.
data(TransAirPolCalif) data(California) formula.GWPR <- pm25 ~ co2_mean + Developed_Open_Space_perc + Developed_Low_Intensity_perc + Developed_Medium_Intensity_perc + Developed_High_Intensity_perc + Open_Water_perc + Woody_Wetlands_perc + Emergent_Herbaceous_Wetlands_perc + Deciduous_Forest_perc + Evergreen_Forest_perc + Mixed_Forest_perc + Shrub_perc + Grassland_perc + Pasture_perc + Cultivated_Crops_perc + pop_density + summer_tmmx + winter_tmmx + summer_rmax + winter_rmax pdata <- plm::pdata.frame(TransAirPolCalif, index = c("GEOID", "year")) moran.plm.model <- plm::plm(formula = formula.GWPR, data = pdata, model = "within") summary(moran.plm.model) #precomputed bandwidth bw.AIC.Fix <- 2.010529 # moran's I test GWPR.moran.test(moran.plm.model, SDF = California, bw = bw.AIC.Fix, kernel = "bisquare", adaptive = FALSE, p = 2, longlat = FALSE, alternative = "greater")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.