|
|
I've been trying to figure out the following code, and so far to no avail. I
mean, I understand the variables and functions it's working with. (Yes, I know
what the chi-square distribution is. In fact, I understand the Student
t-distribution and the Fisher F-distribution as well, both of which are
noticeably lacking, even though one or both should be used to account for the
problems inherent in using a "sample" variance with a small sample size).
I just don't understand why the (inverse CDF of the) chi-square distribution is
being used the way it is:
TracePixel::FocalBlurData::FocalBlurData(const Camera& camera)
{
// snipped code
DBL T1 = camera.Variance / chdtri((DBL)(camera.Blur_Samples-1),
camera.Confidence);
for(int i = 0; i < camera.Blur_Samples; i++)
Sample_Threshold[i] = T1 * chdtri((DBL)(i + 1), camera.Confidence);
// snipped code
}
Playing around with the numbers generated for various
confidence/variance/blur_samples settings, I can see that this equation
provides something roughly useful (as opposed to totally useless), but I can't
figure it out. It's not the confidence that the sample color is within the
requested blur "variance" of the true color. It's not the confidence that the
sample variance is close to either the "true" variance or the requested blur
variance.
The most likely intent I can think of, or at least the most *useful* variation
of what it might mean, is that it's related to the confidence that, having
taken k samples, the sample color will change by less than the "blur variance"
if we took (blur_samples-k) additional samples. But I still can't quite get the
math to work right. Perhaps I'm making a mistake, as this last variation is
quite a bit more complex than my previous two conjectures. But I'd like to
double-check, rather than just guessing what it means and then seeing if I get
the same formula.
Is this code documented anywhere (i.e., the math behind the formula)? Or did
someone come up with this code, black-box style, and now the best we can say is
that "it's just always been that way"?
I apologize if I seem hostile or smart-ass. I'm not trying to be. It's an honest
question, because the documentation doesn't make it remotely clear, and the few
times it's been discussed that I can track down, it's basically dismissed as
statistical magic that is too complex for the masses.
Post a reply to this message
|
|