cbdr icon indicating copy to clipboard operation
cbdr copied to clipboard

Should a single sample's variance being zero be acceptable?

Open sitegui opened this issue 4 years ago • 1 comments

Hello,

First of all, thanks for taking the time to write the awesome introduction! I've learned a lot :)

I was reading the code and the error Error::ZeroVariance returned here got me thinking: does it make sense for confidence_interval() to only return this error when both the samples have a zero variance?

Numerically, when both are zero we have a problem (v would divide by zero). But when only one is zero (let's say x.var), the code would collapse to:

// Estimate the variance of the `y.mean - x.mean`
let var_delta = y.mean_var();

// Approximate the degrees of freedom of `var_delta`
let v = (y.count - 1) as f64;

sitegui avatar May 09 '21 20:05 sitegui

Thanks for taking a look at the code! I think what you’re saying makes sense. I can imagine a situation where one of the benchmarks is so reliable that it always gives the same answer (ie. the true distribution is a delta function). In this case I think the CI for the difference in the means should just be the CI for the mean of the unreliable benchmark with an offset.

asayers avatar May 17 '21 06:05 asayers