[R-sig-Geo] question on raster Moran's I statistical significance

Gabriel Cotlier g@b|k|m01 @end|ng |rom gm@||@com
Thu Oct 21 07:36:51 CEST 2021


Hello

Thank you very much.
I have large raster layers and would like to ask, in order to reduce the
processing time of the simulation, choosing a smaller nsim value could help
? and if so, what could be the minimum nsim value recommended?
Thanks a lot again.
Kind regards,


On Wed, Oct 20, 2021 at 8:45 PM Roger Bivand <Roger.Bivand using nhh.no> wrote:

> On Wed, 20 Oct 2021, Gabriel Cotlier wrote:
>
> > Hello,
> >
> > I would like to estimate the Moran's *I* coefficient for raster data and
> > together with the statical significance of the spatial autocorrelation
> > obtained.
> >
> > I found that the raster package function Moran() although calculates the
> > spatial autocorrelation index it apparently does not give directly the
> > statical significance of the results obtained :
> > https://search.r-project.org/CRAN/refmans/raster/html/autocor.html
> >
> > Could it be be possible to obtain the statistical significance of the
> > results with either raster package or similar one?
>
>
> fortunes::fortune("This is R")
>
>
> library(raster)
> r <- raster(nrows=10, ncols=10)
> values(r) <- 1:ncell(r)
> f <- matrix(c(0,1,0,1,0,1,0,1,0), nrow=3)
> (rI <- Moran(r, f))
> r1 <- r
> nsim <- 499
> res <- numeric(nsim)
> set.seed(1)
> for (i in 1:nsim) {
>    values(r1) <- values(r)[sample(prod(dim(r)))]
>    res[i] <- Moran(r1, f)
> }
>
> Hope-type tests date back to Cliff and Ord; they are permutation
> bootstraps.
>
> r_g <- as(r, "SpatialPixelsDataFrame")
> library(spdep)
> nb <- poly2nb(as(r_g, "SpatialPolygons"), queen=FALSE)
> set.seed(1)
> o <- moran.mc(r_g$layer, nb2listw(nb, style="B"), nsim=nsim,
>    return_boot=TRUE)
> x_a <- range(c(o$t, o$t0, res, rI))
> plot(density(o$t), xlim=x_a)
> abline(v=o$t0)
> lines(density(res), lty=2)
> abline(v=rI, lty=2)
>
> It is not immediately obvious from the code of raster::Moran() why it is
> different, possibly because of padding the edges of the raster and thus
> increasing the cell count.
>
> For added speed, the bootstrap can be parallelized in both cases; polygon
> boundaries are perhaps not ideal.
>
> Hope this clarifies. Always provide a reproducible example, never post
> HTML
> mail.
>
> Roger Bivand
>
>
> >
> > Thanks a lot.
> > Kind regards,
> > Gabriel
> >
> >       [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo using r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> --
> Roger Bivand
> Emeritus Professor
> Department of Economics, Norwegian School of Economics,
> Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway.
> e-mail: Roger.Bivand using nhh.no
> https://orcid.org/0000-0003-2392-6140
> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
>


-- 
Gabriel Cotlier, PhD
Haifa Research Center for Theoretical Physics and Astrophysics (HCTPA)
University of Haifa
Israel

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list