diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a61a3751..b4e53363f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2912,6 +2912,8 @@ A total of 17 people contributed to this release. Thank you to the following con
+- [`0ba282b`](https://github.com/stdlib-js/stdlib/commit/0ba282b89c384f06bbe3ff8ecd71982f05209606) - **chore:** minor clean-up _(by Philipp Burckhardt)_ +- [`9f71ae0`](https://github.com/stdlib-js/stdlib/commit/9f71ae0ab3105190b6638768b83756e69d9146ea) - **chore:** address feedback and enable tests _(by Philipp Burckhardt)_ - [`603c766`](https://github.com/stdlib-js/stdlib/commit/603c76686fc8de480628e5b96efd9733b1f059b5) - **test:** only conditionally run tests _(by Philipp Burckhardt)_ - [`2712c2c`](https://github.com/stdlib-js/stdlib/commit/2712c2c49e251f7dc53e1a984b233c37a2fdb871) - **bench:** only conditionally run benchmarks _(by Philipp Burckhardt)_ - [`318f280`](https://github.com/stdlib-js/stdlib/commit/318f28057bf00d910a656c4f315b8de17f89d3b5) - **chore:** minor clean-up _(by Philipp Burckhardt)_ diff --git a/base/dists/f/cdf/README.md b/base/dists/f/cdf/README.md index 454674011..e09d171f8 100644 --- a/base/dists/f/cdf/README.md +++ b/base/dists/f/cdf/README.md @@ -109,7 +109,7 @@ y = cdf( 2.0, 0.5, 0.0 ); #### cdf.factory( d1, d2 ) -Returns a function for evaluating the [cumulative distribution function][cdf] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Returns a function for evaluating the [cumulative distribution function][cdf] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```javascript var mycdf = cdf.factory( 10.0, 2.0 ); diff --git a/base/dists/f/entropy/README.md b/base/dists/f/entropy/README.md index 402d50d8b..51965a572 100644 --- a/base/dists/f/entropy/README.md +++ b/base/dists/f/entropy/README.md @@ -59,7 +59,7 @@ var entropy = require( '@stdlib/stats/base/dists/f/entropy' ); #### entropy( d1, d2 ) -Returns the [differential entropy][entropy] of a [F][f-distribution] distribution with numerator degrees of freedom `d1` and denominator degrees of freedom `d2` (in [nats][nats]). +Returns the [differential entropy][entropy] of an [F][f-distribution] distribution with numerator degrees of freedom `d1` and denominator degrees of freedom `d2` (in [nats][nats]). ```javascript var v = entropy( 4.0, 7.0 ); @@ -172,7 +172,7 @@ for ( i = 0; i < 10; i++ ) { #### stdlib_base_dists_f_entropy( d1, d2 ) -Evaluates the [differential entropy][entropy] of a [F][f-distribution] distribution with numerator degrees of freedom `d1` and denominator degrees of freedom `d2` (in [nats][nats]). +Evaluates the [differential entropy][entropy] of an [F][f-distribution] distribution with numerator degrees of freedom `d1` and denominator degrees of freedom `d2` (in [nats][nats]). ```c double out = stdlib_base_dists_f_entropy( 3.0, 7.0 ); diff --git a/base/dists/f/kurtosis/README.md b/base/dists/f/kurtosis/README.md index c7a25484b..395613b5b 100644 --- a/base/dists/f/kurtosis/README.md +++ b/base/dists/f/kurtosis/README.md @@ -59,7 +59,7 @@ var kurtosis = require( '@stdlib/stats/base/dists/f/kurtosis' ); #### kurtosis( d1, d2 ) -Returns the [excess kurtosis][kurtosis] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Returns the [excess kurtosis][kurtosis] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```javascript var v = kurtosis( 4.0, 9.0 ); @@ -175,7 +175,7 @@ for ( i = 0; i < 10; i++ ) { #### stdlib_base_dists_f_kurtosis( d1, d2 ) -Evaluates the [excess kurtosis][kurtosis] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Evaluates the [excess kurtosis][kurtosis] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```c double out = stdlib_base_dists_f_kurtosis( 3.0, 9.0 ); diff --git a/base/dists/f/kurtosis/src/main.c b/base/dists/f/kurtosis/src/main.c index 5babfc32b..a785c915f 100644 --- a/base/dists/f/kurtosis/src/main.c +++ b/base/dists/f/kurtosis/src/main.c @@ -37,8 +37,7 @@ double stdlib_base_dists_f_kurtosis( const double d1, const double d2 ) { if ( d1 <= 0.0 || d2 <= 8.0 ) { return 0.0/0.0; // NaN } - num = ( d1 * ( ( 5.0*d2 ) - 22.0 ) * ( d1+d2-2.0 ) ) + - ( ( d2-4.0 ) * stdlib_base_pow( d2-2.0, 2.0 ) ); + num = ( d1 * ( ( 5.0*d2 ) - 22.0 ) * ( d1+d2-2.0 ) ) + ( ( d2-4.0 ) * stdlib_base_pow( d2-2.0, 2.0 ) ); denom = d1 * ( d2-6.0 ) * ( d2-8.0 ) * ( d1+d2-2.0 ); return 12.0 * num / denom; } diff --git a/base/dists/f/kurtosis/test/fixtures/julia/data.json b/base/dists/f/kurtosis/test/fixtures/julia/data.json index c94e22ef4..21ab94c4f 100644 --- a/base/dists/f/kurtosis/test/fixtures/julia/data.json +++ b/base/dists/f/kurtosis/test/fixtures/julia/data.json @@ -1 +1 @@ -{"expected":[47.474445718750815,26.97563555032496,45.145888783348916,24.393355099868785,32.54028713775273,31.76276798719402,207.8929621797779,15.822768909433005,32.183134687705014,66.7836182289343,23.589025106384724,null,527.034261992251,55.03592267238565,328.52709001798746,19.481765039553338,17.67362561968856,16.839616557380317,31.76729338667728,null,304.69451431859073,21.194061271405584,null,63.974795353463165,40.63617961422816,null,26.100123622599835,21.701084832494995,24.974622514278163,135.23638694437116,42.73709809811311,20.92485364505373,321.3069232757477,128.5843488020623,61.590774101920886,22.825953743617895,24.396739795851502,35.74904775475785,23.193169147400695,137.95892737898149,220.56559489875687,26.618135071591475,41.157890353594354,null,86.2881027698738,30.401195538083403,111.75087672704998,50.827770234678056,26.870568534373835,18.80140561846403,21.59920963236488,94.97381547460083,22.1937950146084,8246.372778548706,19.582962446098676,17.232285658928188,33.76387348708364,22.57717598663061,48.17359404627902,null,null,20.384326952381798,119.46945850652881,47.36054554446937,null,562.6860831439127,31.330876176272454,null,null,730.1214674229261,null,19.662653561472066,28.102534111516647,17.279072305174683,28.6894976779165,37.654624507177985,54.13414662014492,235.6314695878212,16.303316534454567,144.24433257451685,25.05929572520629,46.1443804522546,17.870062001836622,47.542658464093016,32.003516949305634,75.80899171525854,61.74139834424153,22.847707432822688,18.148292170065123,16.089358592962583,21.326902040360995,58.57481207290885,24.215851354654003,null,null,19.931886713337057,48.613688720077555,27.392004068702796,17.212703318175336,30.643607434070642],"d1":[2.479263017315603,3.0686145337180175,2.9642621348846614,2.0924863145736476,3.775882325898037,10.863878042133642,8.334418999447806,5.890224289540896,2.6999005454141827,4.901288910259843,4.670924643944246,4.6546256354509286,4.912198131330699,9.858956758173989,8.864258240631463,7.1890289430569965,5.106043770897866,6.320035306506398,4.234088513588093,4.299262853846534,7.462949511048809,5.121963285269453,5.740499834782343,11.618202931354636,6.243880768771238,2.844322499989272,8.158126566980638,5.311009816661099,3.0341809137535796,2.0661141301746837,6.770235670150324,6.15697220726341,2.3517122874604173,4.737671120642025,6.38402675773588,10.004274702703526,8.574675351702272,5.339610946060796,5.911361259644104,8.661989585115336,5.642491766868902,8.062376877771019,11.784513020088019,6.236557377859935,6.002855748895195,11.762211995417939,6.44656651450118,4.694462936225401,4.906096389155213,4.584312448182697,10.130184531846558,3.3941315429847934,4.762489421015493,11.726678451247658,10.844641324703787,10.586900778520887,7.994310938414788,3.3072219442420896,4.022826122584793,7.190062726244338,3.1295694218890096,8.28953441158809,5.972821847346268,3.020520495813133,5.291406990542773,11.390381872826882,2.1399849271728093,5.9209416604730585,6.10667605668128,8.22770257395253,10.712380601866766,9.949661349852956,7.086986434018954,8.833334143247058,8.001645658090657,10.850454576493881,2.307638740688736,3.3768310031818243,9.333509425261882,7.471944650036269,4.612166855943796,6.552988995805505,3.267037964275053,8.290320715070257,2.6219141546152906,8.31500514286312,9.177079846789585,7.51851162991523,6.5187525832969255,7.991421558460162,6.28094334155708,6.4618220712726275,5.936057279581107,5.422257735786216,3.4951555832803454,2.336123811159972,6.93309193836708,3.261501138826735,5.681978378996307,5.767994183942946],"d2":[11.384638778183836,13.529992852595656,11.41945981839744,15.112270333429308,12.468094821195674,13.08060663705458,9.042410446888045,16.377641125621224,12.808754846937845,10.389755036064535,13.884899667029481,6.762147770473513,8.390524502916449,11.227379399120508,8.720641414764543,14.995401368235518,15.630846659336346,15.904136382228812,12.524833877831313,7.137542438004239,8.721420423215845,14.453835500838391,7.045484235109641,11.030363290137894,11.723109962584559,6.834095273379855,13.572100583044449,14.309874097785297,13.987214492961085,9.344484874275832,11.615028907164294,14.520608369178941,8.59497679754863,9.363003368784652,10.652685159736347,14.44806468488689,13.93549988454302,12.084432754258788,13.953416563306405,9.48685047156522,8.88227133740862,13.473081105162676,12.265880942355462,7.398523805779618,9.984984615443452,13.371606942590152,9.625217041212139,11.003967442747479,13.224202254983409,15.280393479907584,14.754442230261228,9.739812330535742,14.213852447213014,8.039676548595994,15.404219276310002,16.158469280292877,12.50879746884847,14.474830341051932,11.138431506229699,6.595876410823101,7.393126504706723,14.838812442495605,9.510763491132382,11.263017747587613,7.372108556453622,8.50287473694981,13.356028842635045,7.389755341616327,6.804896374014476,8.34131348247699,7.356331277272469,15.254412520102353,13.136138011241847,15.908738953828673,13.143447638585108,12.454390886266534,11.045592280650215,8.777128310473788,16.360921842197968,9.366781987353422,13.574727068933122,11.376817230794753,16.27363344525653,11.456373723384873,12.8759564163216,10.384131790240142,10.887211857499736,14.14395690051126,15.399406498647686,16.30851920217826,14.418230853027552,10.770365974374995,13.735661053423922,6.755156258991638,7.233777222950216,16.472336494123013,11.268023578773803,13.372260895612182,15.766303967560695,12.679910871889952]} +{"expected":[32.6900203602921,10.82760019862246,15.5584759491877,45.63929480002005,35.294086608603756,44.63370483618372,68.30387899155664,14.191861630957163,18.218998441623906,11.492216151826824,8.024424287266346,9.675357602860371,36.450853210469475,15.195942777239603,43.95523902213032,60.320309342594555,21.42399277736466,84.58094793798954,38.629667405408156,15.234880087060976,21.553326250169473,8.795266514024485,19.988324837207458,15.421742867481882,63.19423294378426,24.554431413565975,9.451488787311343,12.978121636749412,23.56479051289963,31.38592447679466,19.23417776001429,11.404028972028414,174.44572431222443,15.8043624314847,13.94042357067528,20.062959842109496,14.42128001603797,23.067931834172047,28.085677649940973,21.41088169177697,17.560235662367344,16.133947700023057,13.911721617643773,15.10268983177478,216.65258811328752,83.28240169412321,8.961124393541219,133.75372434480747,16.23520154497893,58.00496233137835,18.399282813204195,52.88426542103454,9.8217113097497,13.590043076553961,7.7382731696211176,36.22830627581413,12.710642676440681,53.10668293115339,9.844931461800199,8.69086350936229,13.235754570266263,52.20308750970465,22.919022284575156,7.569378377665851,28.735349666879497,14.294425328712597,17.29559656764257,25.003643527887256,10.825790522863874,186.82337608495934,9.562898180834486,13.293479814621222,45.02715553152076,53.83457885967619,44.191559952361196,13.029317891891841,129.6004710040344,14.405916929378035,11.930336941880256,10.886769033952104,21.54163449363664,14.313461568445742,30.235760721138625,27.817631199739466,152.23458998931955,24.389376658321694,7.984734083468051,22.17822793990788,10.251939337440966,186.77279918821034,10.682251728074652,29.655017937417437,127.3778190147813,12.535573587088294,90.90042344841532,10.49617588524233,64.36844699418661,44.27318808109924,207.84452094602733,17.759139242599716],"d1":[11.486645814302525,7.134310814819808,10.72122191888755,8.503847171524916,9.155977836520982,5.663746792387599,7.40770956414217,3.21851221326311,9.674139021529774,6.179791540917829,9.201323448111994,8.036058591413958,9.175822972446436,4.537858157240411,2.470355985340781,3.742471243998721,4.584321574326161,4.056153184047709,3.529524585801616,9.795628876777483,3.116914301612403,8.237583956883416,9.196100546870182,9.236136581966129,4.933597940407271,2.629918729795773,10.832189274606794,10.573405574628746,2.3152627406651076,2.3448149669599934,7.6829456722912965,3.8577441637681416,3.2508690970062086,3.1643142775385207,9.451480733616835,11.712998526094124,4.257786670946716,10.590499180130573,10.41535303527146,3.749523663361068,10.813883819631744,6.098028790399696,4.162949522848035,8.674892365047622,6.575291747945135,11.581698796299275,9.03547217452986,9.642931661352343,5.955524802381526,6.103900581792681,7.13913390835148,8.205721060181405,6.2385398178358695,6.088928509207323,10.922946044060854,6.5542362732282,7.382151842123744,11.745824164765125,6.184713368268417,8.165099738141404,7.479031683310538,11.337741586047917,6.167716197838197,11.722416344019841,6.337457126252573,5.648230502170062,9.296486383542357,7.129084194310107,5.501538855418831,3.2257159328182308,11.460634958400579,6.767725085008743,9.71673724113419,5.427953877869344,3.5150901188395407,8.614752220504421,8.24379114560427,8.41213443112225,4.259133165581575,11.761387202814898,6.602466716973681,9.783293607635951,4.389326977649272,6.489458610548493,10.124433956105412,11.455075459216696,10.243605281994812,2.6680186673597355,8.608253279969354,4.3591046666092454,5.275105553128901,2.8969780950303976,2.3992702886962887,9.341665398392838,2.4132600239289697,10.19782705857063,3.440123070830782,2.233036023640566,4.480663006535751,6.776286362079691],"d2":[10.63816198759963,16.164958732475515,13.23703189772922,10.018322560350402,10.521578293652805,10.196553050258572,9.42808421011895,16.60214676232144,12.584390661850128,16.02748896463025,18.42649761011814,16.878527144868887,10.448698744056053,14.67537195529101,10.894884632333369,9.838284883123,12.657692998200591,9.31561261671068,10.85199044281956,13.415338041702803,13.418408543197092,17.755495119883626,12.236761325672713,13.405523455615247,9.643341971273022,13.134506773340844,16.473553692232223,14.234754316036055,13.793617726385946,12.193154466283243,12.529596119972847,18.081543247486742,8.713042037181825,15.633287797088617,13.931522828828765,12.092778811616629,15.2651350035902,11.644135434059244,11.053740906732767,13.020224478798845,12.67160248992248,13.673299411230797,15.643828625385812,13.57785228625454,8.502975294652124,9.142698766012824,17.322608916560267,8.753892436659592,13.675662801550786,9.705422743285512,12.79709936467325,9.775399923967877,17.499673144252203,14.760049947722454,18.37612317046324,10.587250783058069,14.85353570640242,9.70777898247949,17.50638524908823,17.907656316364864,14.557770303012465,9.738906084800531,12.015363070697878,18.453145210247794,11.225628472141931,14.570998988455809,12.843232983689694,11.589342547700976,16.956978718757888,8.67018096908473,16.286897350674863,14.702728059530973,10.01268298279655,9.86581780409913,10.51090934520481,14.449833096662946,8.787794367631692,13.87429934581737,17.02523643399462,15.264230245103873,12.19527182270131,13.748563183511568,11.3675952266938,11.308931080406207,8.666669430459255,11.434722037000162,18.194322924883316,13.701696415959923,16.20864704978577,8.621093305771199,17.25857408311427,12.00706520940166,9.05949550700501,14.590936754103247,9.45231572872182,15.72120201909092,9.774126307096182,11.014341713385788,8.558652336795195,13.02282279750615]} diff --git a/base/dists/f/kurtosis/test/fixtures/julia/runner.jl b/base/dists/f/kurtosis/test/fixtures/julia/runner.jl index 5981ba4df..3d3a29b24 100644 --- a/base/dists/f/kurtosis/test/fixtures/julia/runner.jl +++ b/base/dists/f/kurtosis/test/fixtures/julia/runner.jl @@ -70,6 +70,6 @@ dir = dirname( file ); # Generate fixtures: d1 = ( rand( 100 ) .* 10.0 ) .+ 2.0; -d2 = ( rand( 100 ) .* 10.0 ) .+ 6.5; +d2 = ( rand( 100 ) .* 10.0 ) .+ 8.5; gen( d1, d2, "data.json" ); diff --git a/base/dists/f/kurtosis/test/test.js b/base/dists/f/kurtosis/test/test.js index d5ebca992..abb8956c0 100644 --- a/base/dists/f/kurtosis/test/test.js +++ b/base/dists/f/kurtosis/test/test.js @@ -16,8 +16,6 @@ * limitations under the License. */ -/* eslint-disable no-unused-vars */ - 'use strict'; // MODULES // @@ -120,9 +118,6 @@ tape( 'if provided `d2 <= 8`, the function returns `NaN`', function test( t ) { t.end(); }); -// TODO: Enable tests against Julia once https://github.com/JuliaStats/Distributions.jl/pull/591 has landed - -/* tape( 'the function returns the excess kurtosis of an F distribution', function test( t ) { var expected; var delta; @@ -147,4 +142,3 @@ tape( 'the function returns the excess kurtosis of an F distribution', function } t.end(); }); -*/ diff --git a/base/dists/f/kurtosis/test/test.native.js b/base/dists/f/kurtosis/test/test.native.js index e5d0e8dbd..c6a7e81f6 100644 --- a/base/dists/f/kurtosis/test/test.native.js +++ b/base/dists/f/kurtosis/test/test.native.js @@ -26,11 +26,13 @@ var tryRequire = require( '@stdlib/utils/try-require' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); // FIXTURES // -// var data = require( './fixtures/julia/data.json' ); +var data = require( './fixtures/julia/data.json' ); // VARIABLES // @@ -125,9 +127,6 @@ tape( 'if provided `d2 <= 8`, the function returns `NaN`', opts, function test( t.end(); }); -// TODO: Enable tests against Julia once https://github.com/JuliaStats/Distributions.jl/pull/591 has landed - -/* tape( 'the function returns the excess kurtosis of an F distribution', opts, function test( t ) { var expected; var delta; @@ -152,4 +151,3 @@ tape( 'the function returns the excess kurtosis of an F distribution', opts, fun } t.end(); }); -*/ diff --git a/base/dists/f/mean/README.md b/base/dists/f/mean/README.md index 277eda971..c4e430f5e 100644 --- a/base/dists/f/mean/README.md +++ b/base/dists/f/mean/README.md @@ -57,7 +57,7 @@ var mean = require( '@stdlib/stats/base/dists/f/mean' ); #### mean( d1, d2 ) -Returns the [expected value][expected-value] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Returns the [expected value][expected-value] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```javascript var v = mean( 4.0, 5.0 ); @@ -170,7 +170,7 @@ for ( i = 0; i < 10; i++ ) { #### stdlib_base_dists_f_mean( d1, d2 ) -Evaluates the [expected value][expected-value] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Evaluates the [expected value][expected-value] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```c double out = stdlib_base_dists_f_mean( 3.0, 5.0 ); diff --git a/base/dists/f/mode/README.md b/base/dists/f/mode/README.md index 7909bd8ab..2247088f6 100644 --- a/base/dists/f/mode/README.md +++ b/base/dists/f/mode/README.md @@ -59,7 +59,7 @@ var mode = require( '@stdlib/stats/base/dists/f/mode' ); #### mode( d1, d2 ) -Returns the [mode][mode] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Returns the [mode][mode] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```javascript var v = mode( 4.0, 5.0 ); @@ -172,7 +172,7 @@ for ( i = 0; i < 10; i++ ) { #### stdlib_base_dists_f_mode( d1, d2 ) -Evaluates the [mode][mode] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Evaluates the [mode][mode] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```c double out = stdlib_base_dists_f_mode( 3.0, 5.0 ); diff --git a/base/dists/f/pdf/README.md b/base/dists/f/pdf/README.md index 75fc41a63..ca2615cdc 100644 --- a/base/dists/f/pdf/README.md +++ b/base/dists/f/pdf/README.md @@ -103,7 +103,7 @@ y = pdf( 2.0, 1.0, -1.0 ); #### pdf.factory( d1, d2 ) -Returns a `function` for evaluating the [PDF][pdf] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Returns a `function` for evaluating the [PDF][pdf] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```javascript var mypdf = pdf.factory( 6.0, 7.0 ); diff --git a/base/dists/f/quantile/README.md b/base/dists/f/quantile/README.md index 6951175a5..7cb292297 100644 --- a/base/dists/f/quantile/README.md +++ b/base/dists/f/quantile/README.md @@ -113,7 +113,7 @@ y = quantile( 0.4, 1.0, 0.0 ); #### quantile.factory( d1, d2 ) -Returns a function for evaluating the quantile function of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Returns a function for evaluating the quantile function of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```javascript var myquantile = quantile.factory( 10.0, 2.0 ); diff --git a/base/dists/f/skewness/README.md b/base/dists/f/skewness/README.md index da6f5587e..f05468571 100644 --- a/base/dists/f/skewness/README.md +++ b/base/dists/f/skewness/README.md @@ -59,7 +59,7 @@ var skewness = require( '@stdlib/stats/base/dists/f/skewness' ); #### skewness( d1, d2 ) -Returns the [skewness][skewness] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Returns the [skewness][skewness] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```javascript var v = skewness( 4.0, 7.0 ); @@ -175,7 +175,7 @@ for ( i = 0; i < 10; i++ ) { #### stdlib_base_dists_f_skewness( d1, d2 ) -Evaluates the [skewness][skewness] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Evaluates the [skewness][skewness] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```c double out = stdlib_base_dists_f_skewness( 3.0, 7.0 ); diff --git a/base/dists/f/stdev/README.md b/base/dists/f/stdev/README.md index 69768ceda..3d883d100 100644 --- a/base/dists/f/stdev/README.md +++ b/base/dists/f/stdev/README.md @@ -59,7 +59,7 @@ var stdev = require( '@stdlib/stats/base/dists/f/stdev' ); #### stdev( d1, d2 ) -Returns the [standard deviation][standard-deviation] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Returns the [standard deviation][standard-deviation] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```javascript var v = stdev( 4.0, 5.0 ); diff --git a/base/dists/f/variance/README.md b/base/dists/f/variance/README.md index ed7427372..ed59ef812 100644 --- a/base/dists/f/variance/README.md +++ b/base/dists/f/variance/README.md @@ -59,7 +59,7 @@ var variance = require( '@stdlib/stats/base/dists/f/variance' ); #### variance( d1, d2 ) -Returns the [variance][variance] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Returns the [variance][variance] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```javascript var v = variance( 4.0, 5.0 ); @@ -172,7 +172,7 @@ for ( i = 0; i < 10; i++ ) { #### stdlib_base_dists_f_variance( d1, d2 ) -Evaluates the [variance][variance] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). +Evaluates the [variance][variance] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom). ```c double out = stdlib_base_dists_f_variance( 3.0, 5.0 ); diff --git a/base/dists/normal/stdev/README.md b/base/dists/normal/stdev/README.md index d2fa4a1e6..c624fd683 100644 --- a/base/dists/normal/stdev/README.md +++ b/base/dists/normal/stdev/README.md @@ -200,6 +200,14 @@ int main( void ) { + + +
+ +
+ + + - - - -
- -
- - diff --git a/base/dists/triangular/mean/README.md b/base/dists/triangular/mean/README.md index 7438f675d..e294590d2 100644 --- a/base/dists/triangular/mean/README.md +++ b/base/dists/triangular/mean/README.md @@ -223,8 +223,8 @@ int main( void ) { for ( i = 0; i < 25; i++ ) { a = random_uniform( 0.0, 10.0 ); - b = random_uniform( 0.0, 10.0 ) + a; - c = a + (b - a) * random_uniform( 0.0, 1.0 ); // mode between a and b + b = random_uniform( a, 10.0 + a ); + c = random_uniform( a, b ); // mode between a and b y = stdlib_base_dists_triangular_mean( a, b, c ); printf( "a: %lf, b: %lf, c: %lf, E(X;a,b,c): %lf\n", a, b, c, y ); } diff --git a/base/dists/triangular/mean/benchmark/c/benchmark.c b/base/dists/triangular/mean/benchmark/c/benchmark.c index 44921d25a..44de7c03e 100644 --- a/base/dists/triangular/mean/benchmark/c/benchmark.c +++ b/base/dists/triangular/mean/benchmark/c/benchmark.c @@ -75,13 +75,15 @@ static double tic( void ) { } /** -* Generates a random number on the interval [0,20). +* Generates a random number on the interval [min,max). * -* @return random number +* @param min minimum value (inclusive) +* @param max maximum value (exclusive) +* @return random number */ -static double rand_double( void ) { - int r = rand(); - return 20.0*(double)r / ( (double)RAND_MAX + 1.0 ); +static double random_uniform( const double min, const double max ) { + double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); + return min + ( v*(max-min) ); } /** @@ -96,11 +98,11 @@ static double benchmark( void ) { double t; int i; - // Generate random parameters for the triangular distribution + // Generate random parameters for the triangular distribution: for ( i = 0; i < 100; i++ ) { - a[ i ] = rand_double() * 20.0; // Lower bound - b[ i ] = ( rand_double() * 20.0 ) + a[ i ]; // Upper bound - c[ i ] = ( rand_double() * ( b[i] - a[i] ) ) + a[i]; // Mode + a[ i ] = random_uniform( 0.0, 20.0 ); // Lower bound + b[ i ] = random_uniform( a[i], a[i]+20.0 ); // Upper bound + c[ i ] = random_uniform( a[i], b[i] ); // Mode } t = tic(); diff --git a/base/dists/triangular/mean/examples/c/example.c b/base/dists/triangular/mean/examples/c/example.c index 855158da5..353aff4dd 100644 --- a/base/dists/triangular/mean/examples/c/example.c +++ b/base/dists/triangular/mean/examples/c/example.c @@ -34,8 +34,8 @@ int main( void ) { for ( i = 0; i < 25; i++ ) { a = random_uniform( 0.0, 10.0 ); - b = random_uniform( 0.0, 10.0 ) + a; - c = a + (b - a) * random_uniform( 0.0, 1.0 ); // mode between a and b + b = random_uniform( a, a+10.0 ); + c = random_uniform( a, b ); // mode between a and b y = stdlib_base_dists_triangular_mean( a, b, c ); printf( "a: %lf, b: %lf, c: %lf, E(X;a,b,c): %lf\n", a, b, c, y ); } diff --git a/base/dists/triangular/mean/lib/native.js b/base/dists/triangular/mean/lib/native.js index 2d7c2a6ba..46c432564 100644 --- a/base/dists/triangular/mean/lib/native.js +++ b/base/dists/triangular/mean/lib/native.js @@ -40,7 +40,7 @@ var addon = require( './../src/addon.node' ); * * @example * var v = mean( 2.0, 8.0, 4.0 ); -* // returns 4.666666666666667 +* // returns ~4.667 * * @example * var v = mean( -1.0, 5.0, 6.0 ); diff --git a/base/dists/triangular/mean/src/main.c b/base/dists/triangular/mean/src/main.c index 2dc9c8646..5290e4988 100644 --- a/base/dists/triangular/mean/src/main.c +++ b/base/dists/triangular/mean/src/main.c @@ -20,12 +20,12 @@ #include "stdlib/math/base/assert/is_nan.h" /** -* Evaluates the expected value (mean) of a triangular distribution with lower bound a, upper bound b and mode (peak) c. +* Returns the expected value of a triangular distribution. * -* @param a lower bound -* @param b upper bound -* @param c mode (peak) -* @returns expected value (mean) +* @param a minimum support +* @param b maximum support +* @param c mode +* @returns expected value * * @example * double v = mean( 0.0, 10.0, 5.0 );