feat: standardError
Adding the standardError function to the library.
Some interrogations:
- What should we return when the list has only 1 element?
0as done now? - What should we do with an empty list? Throw? (Note that this case is not addressed with the
standardDeviationfunction either). - Should we also add
sampleStandardErrorwith Bessel's correction?
Note that I can add some unit tests to reflect our choices on the first two questions.
Related to #203.
Nobody wants standard error :(. Sadness fills my heart.
Bump?
For your first two interrogations,
What should we return when the list has only 1 element? 0 as done now?
What should we do with an empty list? Throw? (Note that this case is not addressed with the standardDeviation function either).
I vote for both we return nan .
I'd have to review, but I believe in either case we'll have degrees of freedom for our estimates <= 0.
This also mirrors how both R and scipy handle such cases.
scipy.stats.sem also has a policy for handling nan returns, (e.g. throw or return nan) - maybe you could add something similar?
@Yomguithereal @jwilber I've rebased and cleaned up this branch - sorry, wasn't very familiar with standard error the concept, the delay on this one is 😢.
The current state of the branch is that throws with [] input, like other methods, and returns 0 on single-element input, which seems like the right approach given that std_dev / sqrt(length) returns 0 naively. If that's good for you folks, I'll merge and release with this (thanks @Yomguithereal and sorry for the epic delay :/)
@tmcw so everything's alright with current code? Do you want me to add TS definition file?