4

Moran's I を使用し、関心領域を 4 x 4 四角形で割って、自己相関をチェックしたい点のリストがあります。

Google で見つけたすべての例 (例: http://www.ats.ucla.edu/stat/r/faq/morans_i.htm ) は、モランの I 関数の最初の入力として何らかの測定値を使用しています。ライブラリが使用されます (私は ape と spdep パッケージを調べました)。

しかし、私が持っているのは、相関関係を確認したいポイント自体だけです。

問題は、これが面白い (または悲しい) ように聞こえるかもしれませんが、ここで何をしているのかわかりません。私は(空間)統計の専門家ではありません。私が知りたいのは、モランの I を使用して、ポイントのコレクションが分散、クラスタ化、またはランダム化されているかどうかだけです。

私のアプローチは正しいですか?そうでない場合、どこで何を間違っていますか?

ありがとう

これは私がこれまでに持っているものです:

# download, install and load the spatstat package (http://www.spatstat.org/)
install.packages("spatstat")
library(spatstat)

# Download, install and run the ape package (http://cran.r-project.org/web/packages/ape/)
install.packages("ape")
library(ape)

# Define points
x <- c(3.4, 7.3, 6.3, 7.7, 5.2, 0.3, 6.8, 7.5, 5.4, 6.1, 5.9, 3.1, 5.2, 1.4, 5.6, 0.3)
y <- c(2.2, 0.4, 0.8, 6.6, 5.6, 2.5, 7.6, 0.3, 3.5, 3.1, 6.1, 6.4, 1.5, 3.9, 3.6, 5.2)

# Store the coordinates as a matrix
coords <- as.matrix(cbind(x, y))

# Store the points as two-dimensional point pattern (ppp) object (ranging from 0 to 8 on both axis)
coords.ppp <- as.ppp(coords, c(0, 8, 0, 8))

# Quadrat count
coords.quadrat <- quadratcount(coords.ppp, 4)

# Store the Quadrat counts as vector
coords.quadrat.vector <- as.vector(coords.quadrat)

# Replace any value > 1 with 1
coords.quadrat.binary <- ifelse(coords.quadrat.vector > 1, 1, coords.quadrat.vector)

# Moran's I

# Generate the distance matrix (euclidean distances between points)
coords.dists <- as.matrix(dist(coords))

# Take the inverse of the matrix
coords.dists.inv <- 1/coords.dists

# replace the diagonal entries (Inf) with zeroes
diag(coords.dists.inv) <- 0

writeLines("Moran's I:")
print(Moran.I(coords.quadrat.binary, coords.dists.inv))
writeLines("")
4

1 に答える 1