I have a question about how to use the distribution functions within the jstat library. Specifically, I am focused on studentt.
I've tried this:
var alphaLevel = 0.05;
var degreesOfFreedom = 18;
// the answer I want to get is 2.100922
tStat = jStat.studentt(alphaLevel,degreesOfFreedom);
// but all that is returned is an object with
// members _a,_b,_c (_a=0.05, _b=18,_c=undefined).
As explained on the jstat github site, there is a difference between static and instance functions. However, it is above my experience with javascript as to how to do this.
Can anyone explain how to properly call the studentt function and get the proper result?
Thank you!
PS: I also posted this on StackOverflow seeing that Trevor had taken time to answer there previously. Without an official distribution, I simply used script tags to reference in each of the jStat js files in sequence. Although I've been able to use matrix functions like .transpose - I can't figure out how to successfully utilitze the distribution library.
I have not seen a way to contribute to the project, but perhaps I could contribute with a bit of guidance.
- Again, Thank you.
So in your example you have two options. Either you can get the result immediately:
var tStat = jStat.studentt.pdf(alphaLevel, degreesOfFreedom);
Or you can return an instance that allows you to pass in multiple degrees of freedom:
var tStat = jStat.studentt(alpha);
var a1 = tStat.pdf(doF1);
var a2 = tStat.pdf(doF2);