rmjarvis / TreeCorr

Code for efficiently computing 2-point and 3-point correlation functions. For documentation, go to
http://rmjarvis.github.io/TreeCorr/
Other
99 stars 37 forks source link

Jackknife on NK Correlation with Random Subtraction #102

Closed zhuoqizhang closed 4 years ago

zhuoqizhang commented 4 years ago

Hi Mike,

It seems that there is a little problem with jackknife on the random subtraction of NKCorrelation. I think treecorr is currently doing separate jackknives on the random and the measured NK, and then add the variances together. But I believe it probably makes more sense to first subtract the random noise and then do a jackknife patch-by-patch. I wrote a brute-force jackknife code comparing the two methods, and their results are in the attached plot. Thanks a lot if you can look into this issue a bit!

Jackie Zhang

jackknife

rmjarvis commented 4 years ago

Yes. Sorry about that. This was a bug that I had already fixed for NGCorrelation, but I forgot to apply the same fix to NKCorrelation. Please try the latest update to the jk2 branch to see if it matches better now. Thanks!

zhuoqizhang commented 4 years ago

Thanks for updating. I ran another test on CosmoDC2 with the updated version but still got quite different results (see fig) from the brute-force method that I used. Capture I have included a link to my brute-force method on GitHub, so may that may help--the brute-force jackknife is mainly in block 49-54. I expect that the way I did it may somehow underestimate the variance a bit, so I'm also very sure if it is absolutely correct though. Thanks if you can check that! https://github.com/zhzhuoqi/bazinga73/blob/master/jackknife_random_subtraction.ipynb

rmjarvis commented 4 years ago

I think this is now fixed and merged into master. Thanks for doing these tests! It was super helpful!