1
$\begingroup$

I'm trying to compute the autocorrelation of a list of points $(x,y,z)$ in 3D. Can the CorrelationFunction or maybe ListCorrelate be used to compute this?

rand = RandomReal[{0, 1}, {10, 3}];
CorrelationFunction[rand, 2]

I'm not sure what the output here means. Especially because I'm not sure what the hspec parameter is and what the documentation calls a lag. In my real data I suspect I have many roughly uniformly sized spherical regions with a higher density of points and was hoping an autocorrelation analysis could help find them and determine their size.

Since I'm interested in a spherically symmetric density I believe I can compute the autocorrelation like this

distmatrix2 = 
  Compile[{{point, _Real, 1}, {tr, _Real, 2}}, Total@Abs[point - tr], 
   CompilationTarget -> "C", RuntimeOptions -> "Speed", 
   RuntimeAttributes -> {Listable}, Parallelization -> True];

pts = RandomReal[{0, 1}, {10000, 3}]; // AbsoluteTiming
distances = distmatrix2[pts, Transpose@pts]; // Timing
min = Min@Flatten@distances;
max = Max@Flatten@distances;

autocorrelation = 
   Total@BinCounts[#, {min, max, (max - min)/100}] & /@ 
    distances; // AbsoluteTiming

However, I have 10^7 points in my real dataset and this is much too slow...

$\endgroup$
  • $\begingroup$ do you want just the radial pair correlation ? $\endgroup$ – lalmei Feb 10 '15 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.