[R-sig-Geo] inference of local Gi* using permutations
Roger Bivand
Roger@B|v@nd @end|ng |rom nhh@no
Thu Mar 7 15:05:03 CET 2019
On Wed, 6 Mar 2019, Jay Wang wrote:
> Hello,
>
> I am currently using the localG () in spdep package, I was wondering if we
> can have a conditional permutation-based inference to get the P value for
> every Gi*. I saw that a Mote Carlo simulation is used in Moran.MC(), and I
> borrowed the following codes from this function and tried to see if I can
> do a permutation for localG():
>
> pvals<-matrix(0, nrow = V, ncol = 1)
> for (i in 1:V){
> rankresi<-rank(res[i, ])
> xranki <- rankresi[length(res[i, ])]
> diffi <- nsim - xranki
> diffi <- ifelse(diffi > 0, diffi, 0)
> pvali <- punif((diffi + 1)/(nsim + 1))
> pvals[i,]<-pvali
> }
Monte Carlo or Hope type tests or permutation bootstraps work like
analytical permutation in the global case, and are redundant for that
reason. Monte Carlo (conditional permutation) in the local case requires
that there is no global autocorrelation or other mis-specifications.
Your code snippet is not an example, and I think is not how permutation is
actually done. In the local case in ArcGIS, GeoDa, etc., you fix the value
of interest at i, randomly re-assign all the values to the other
observations, and recompute the local indicator at i, doing this say 499
times. Then you move on to the next i, and repeat. In your snippet, we
cannot see where res is coming from. Is this an n by nsim matrix from nsim
runs? Might you be needing to compare the sample values with the observed
value? If you are outputting Z-values of G_i anyway, you may need to step
back to the actual G_i (here from spdep):
attr(localG(..., return_internals=TRUE), "internals")[,1]
Then
mns <- apply(res, 1, mean)
sds <- apply(res, 1, sd)
permZ <- (obs_localG - mns)/sds
are z values that can be considered as drawn from the normal. However, I
advise against inference unless the assumptions are met, and p-values must
be adjusted anyway.
Roger
>
> After running these codes with several different datasets, I found that all
> the negative Gi*s have very high P values say 0.999 with 999 permutations,
> meaning that there are no significant cold spots. Where is the problem? How
> can we do conditional permutation-based inference for localG() with R
> spdep? I understand the critics of permutation-based inference for local
> indicators, but I just want to explore this. Thank you!
>
> Best
>
> [[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
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
More information about the R-sig-Geo
mailing list