[R-sig-Geo] Moran´s I
NicoP
Nicopollex at yahoo.de
Sun Feb 3 16:59:10 CET 2013
Hello,
ich have
Miete <- read.table(..., header = TRUE, sep = ";", dec=",")
>
>
> head (Miete, n=10)
Respondent Miete lat lon
1 584 550 49.87128 8.650939
2 418 620 48.12676 11.555891
3 829 550 53.09142 8.805106
4 1381 512 54.09108 12.106584
5 939 290 53.55610 8.579847
6 727 345 54.33311 10.123090
7 26 460 53.62416 10.023311
8 679 180 52.56844 13.502090
9 324 450 48.09125 11.521790
10 207 880 48.15264 11.579110
>
> Miete.dists <- as.matrix(dist(cbind(Miete$lon, Miete$lat)))
>
> Miete.dists.inv <- 1/Miete.dists
> diag(Miete.dists.inv) <- 0
> Miete.dists.inv[1:10, 1:10]
1 2 3 4 5 6 7
8 9 10
1 0.0000000 0.2951138 0.3101904 0.1833454 0.2713336 0.2128375 0.2502544
0.1801631 0.2960409 0.2945268
2 0.2951138 0.0000000 0.1761868 0.1669538 0.1615121 0.1569960 0.1752226
0.2062133 20.3113455 28.7617086
3 0.3101904 0.1761868 0.0000000 0.2898969 1.9364969 0.5522520 0.7521068
0.2115950 0.1757308 0.1765379
4 0.1833454 0.1669538 0.2898969 0.0000000 0.2803412 0.5004488 0.4683936
0.4841688 0.1658854 0.1677342
5 0.2713336 0.1615121 1.9364969 0.2803412 0.0000000 0.5787651 0.6920094
0.1991892 0.1611237 0.1618113
6 0.2128375 0.1569960 0.5522520 0.5004488 0.5787651 0.0000000 1.3967632
0.2623262 0.1563318 0.1574887
7 0.2502544 0.1752226 0.7521068 0.4683936 0.6920094 1.3967632 0.0000000
0.2750697 0.1744521 0.1757961
8 0.1801631 0.2062133 0.2115950 0.4841688 0.1991892 0.2623262 0.2750697
0.0000000 0.2042655 0.2076266
9 0.2960409 20.3113455 0.1757308 0.1658854 0.1611237 0.1563318 0.1744521
0.2042655 0.0000000 11.9061332
10 0.2945268 28.7617086 0.1765379 0.1677342 0.1618113 0.1574887 0.1757961
0.2076266 11.9061332 0.0000000
> require(ape)
> Moran.I(Miete$Miete, Miete.dists.inv)
Error in if (obs <= ei) 2 * pv else 2 * (1 - pv) :
missing value where TRUE/FALSE needed
I dont understand the error. I can´t calculate Morans´ I Coefficient.
Can anyone help me ??
Many thanks !!
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Moran-s-I-tp7582466.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list