From 899644790aa60669cdf5c5a079c1c0b567ec37d2 Mon Sep 17 00:00:00 2001 From: niklasmueboe Date: Sun, 25 Aug 2024 15:45:13 +0200 Subject: [PATCH] fix calculation of morans I --- src/spatialPCA.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spatialPCA.jl b/src/spatialPCA.jl index 562277d..0b0c500 100644 --- a/src/spatialPCA.jl +++ b/src/spatialPCA.jl @@ -64,7 +64,7 @@ function varianceMoransIdecomposition(M::SpatialPCA, X) laggedX = transformedX * M.W w = 1 / size(M.W, 1) # sum of row_weights but because its normed the sum is n variance = sum(transformedX .* transformedX .* w; dims=2) - moransI = sum(transformedX .* laggedX; dims=2) ./ variance # TODO ? + moransI = sum(transformedX .* laggedX .* w; dims=2) ./ variance # TODO ? return variance, moransI end