Dogggg / accord

Automatically exported from code.google.com/p/accord
0 stars 0 forks source link

unbiased doesn't make any sense... #66

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The documentation (for Tools.Variance, for example) states:
/// <param name="unbiased">
///   True to compute the unbiased estimate of the population
///   variance, false for the sample variance.</param>

Which I interpret to mean: true - population variance, false - sample variance.

However, if I'm reading the code correctly, states just the opposite.

            if (unbiased)
            {
                // Sample variance
                return variance / (values.Length - 1);
            }
            else
            {
                // Population variance
                return variance / values.Length;
            }

Am I missing something here? 

However, if I'm correct then this bug is in several locations.

Thanks for the clarification.

Original issue reported on code.google.com by Tristen....@gmail.com on 11 Sep 2013 at 1:34

GoogleCodeExporter commented 8 years ago
Thanks for reporting the issue! On a first look, this seems to be an issue with 
the documentation itself. It was likely intended to read:

/// <param name="unbiased">
///   True to compute an unbiased estimate of the population
///   variance, false for the *population* variance. </para>

However, the passage would still be a bit confusing because of the terms used, 
and would surely benefit from a more simpler explanation. I will clarify all 
passages where the 'unbiased' term is used and and re-generate the docs soon.

By the way, please let me know if it makes more sense now. The fact is that the 
sample variance is an unbiased estimator of the population variance and the two 
terms were being used in a very confusing manner.

Original comment by cesarso...@gmail.com on 11 Sep 2013 at 5:32

GoogleCodeExporter commented 8 years ago
Hmmm... I'm in no way a statistic guru so the statement "the sample variance is 
an unbiased estimator of the population variance" is very confusing to me. 
Something like IsSample = true or IsPopulation = true would work better for me, 
it might not be technically correct but it is very easy to understand the 
intent.

Also, if that code doesn't wrong, then I would like to be able to pass-in what 
biase I would like to use when creating a Distribute, e.g. I need to create an 
EmpricalDistrution that is based upon the *population* and not on the sample - 
to get this to work I had to change the code but I think an extra param would 
work better.

Thanks for your quick response.

Original comment by Tristen....@gmail.com on 12 Sep 2013 at 12:38

GoogleCodeExporter commented 8 years ago
Fixed in release 2.12; it should now be possible to specify different smoothing 
functions in the Empirical distributions.

Original comment by cesarso...@gmail.com on 6 Jan 2014 at 11:08