Closed dkczk closed 10 months ago
The Value section of the help page ?localG
says:
For conditional permutation, the returned value is the same as for 'localG()', and the simulated standard deviate is returned as column '"StdDev.Gi"' in 'attr(., "internals")'.
so:
> str(r_auto)
'localG' num [1:10000] -0.847 -1.281 -0.491 -1.378 -1.128 ...
- attr(*, "internals")= num [1:10000, 1:9] -0.0389 -0.0572 -0.0211 -0.0613 -0.0506 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:9] "Gi" "E.Gi" "Var.Gi" "StdDev.Gi" ...
- attr(*, "cluster")= Factor w/ 2 levels "Low","High": 2 1 1 1 1 1 1 1 2 1 ...
- attr(*, "gstari")= logi FALSE
- attr(*, "call")= language spdep::localG_perm(x = as.vector(terra::values(r)), listw = spdep::nb2listw(nb, style = "B"), nsim = 100, ze| __truncated__
The online help pages are stale, I'll update them.
Thank you very much! Is there a reason why localG_perm() is returned like that and not as dataframe?
Yes, G is returned as a standard variate as in its original literature. Inference is a matter of choice for the analyst - the results needed are returned, but the analyst has to make the choices, see i.a. https://doi.org/10.1111/gean.12319 and https://r-spatial.org/book/15-Measures.html.
I used the localG_perm() function which unlike localmoran_perm() doesn't return a dataframe but instead a localG num object. I can't access the parameters ("Gi", "E.Gi", "Var.Gi", "StdDev.Gi", "Pr(z != E(Gi))", "Pr(z != E(Gi)) Sim", "Pr(folded) Sim", "Skewness", "Kurtosis") from that object. I tried $, @ and the ordinary number and name indexing and nothing returns the specified parameter. How can I extract e.g. "Pr(z != E(Gi))" from a localG object?
Example:
Ubuntu 22.04.2 spdep 1.2-8 R 4.3.1