New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: standardError #257
base: main
Are you sure you want to change the base?
feat: standardError #257
Conversation
Related to #203. |
Nobody wants standard error :(. Sadness fills my heart. |
Bump? |
For your first two interrogations,
I vote for both we return
|
@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 |
@tmcw so everything's alright with current code? Do you want me to add TS definition file? |
throw new Error("standardError is not defined for empty arrays"); | ||
} | ||
|
||
return standardDeviation(x) / Math.sqrt(x.length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: is the name standardError
too general given that this is only the standard error of the sample mean?
* standardError([2, 4, 4, 4, 5, 5, 7, 9]); // => 2 / Math.sqrt(8) | ||
*/ | ||
function standardError(x /*: Array<number> */) /*:number*/ { | ||
if (x.length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be removed and standardDeviation
itself allowed to throw?
> ss.standardDeviation([]) / 0
Uncaught Error: variance requires at least one data point
at variance (/home/dsaxton/simple-statistics/dist/simple-statistics.js:226:15)
at Object.standardDeviation (/home/dsaxton/simple-statistics/dist/simple-statistics.js:254:13)
Adding the
standardError
function to the library.Some interrogations:
0
as done now?standardDeviation
function either).sampleStandardError
with Bessel's correction?Note that I can add some unit tests to reflect our choices on the first two questions.