@stdlib/stats-wilcoxon 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.js +18 -10
- package/package.json +26 -44
package/README.md
CHANGED
|
@@ -445,8 +445,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
445
445
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/stats-wilcoxon.svg
|
|
446
446
|
[npm-url]: https://npmjs.org/package/@stdlib/stats-wilcoxon
|
|
447
447
|
|
|
448
|
-
[test-image]: https://github.com/stdlib-js/stats-wilcoxon/actions/workflows/test.yml/badge.svg?branch=v0.2.
|
|
449
|
-
[test-url]: https://github.com/stdlib-js/stats-wilcoxon/actions/workflows/test.yml?query=branch:v0.2.
|
|
448
|
+
[test-image]: https://github.com/stdlib-js/stats-wilcoxon/actions/workflows/test.yml/badge.svg?branch=v0.2.2
|
|
449
|
+
[test-url]: https://github.com/stdlib-js/stats-wilcoxon/actions/workflows/test.yml?query=branch:v0.2.2
|
|
450
450
|
|
|
451
451
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-wilcoxon/main.svg
|
|
452
452
|
[coverage-url]: https://codecov.io/github/stdlib-js/stats-wilcoxon?branch=main
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
"use strict";var V=function(e,i){return function(){return i||e((i={exports:{}}).exports,i),i.exports}};var H=V(function(Oe,W){
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";var V=function(e,i){return function(){return i||e((i={exports:{}}).exports,i),i.exports}};var H=V(function(Oe,W){"use strict";var N=require("@stdlib/assert-contains"),_=require("@stdlib/assert-is-boolean").isPrimitive,B=require("@stdlib/assert-is-number").isPrimitive,te=require("@stdlib/assert-is-plain-object"),C=require("@stdlib/assert-is-string").isPrimitive,j=require("@stdlib/assert-is-nan"),E=require("@stdlib/assert-has-own-property"),d=require("@stdlib/string-format"),I=["two-sided","less","greater"],U=["pratt","wilcox","zsplit"];function ne(e,i){if(!te(i))return new TypeError(d("invalid argument. Options argument must be an object. Value: `%s`.",i));if(E(i,"alpha")){if(e.alpha=i.alpha,!B(e.alpha)||j(e.alpha))return new TypeError(d("invalid option. `%s` option must be a number. Option: `%s`.","alpha",e.alpha));if(e.alpha<0||e.alpha>1)return new RangeError(d("invalid option. `%s` option must be a number on the interval: [0, 1]. Option: `%f`.","alpha",e.alpha))}if(E(i,"alternative")){if(e.alternative=i.alternative,!C(e.alternative))return new TypeError(d("invalid option. `%s` option must be a string. Option: `%s`.","alternative",e.alternative));if(!N(I,e.alternative))return new Error(d('invalid option. `%s` option must be one of the following: "%s". Option: `%s`.',"alternative",I.join('", "'),e.alternative))}if(E(i,"correction")&&(e.correction=i.correction,!_(e.correction)||j(e.correction)))return new TypeError(d("invalid option. `%s` option must be a boolean. Option: `%s`.","correction",e.alpha));if(E(i,"exact")&&(e.exact=i.exact,!_(e.exact)||j(e.exact)))return new TypeError(d("invalid option. `%s` option must be a boolean. Option: `%s`.","exact",e.alpha));if(E(i,"mu")&&(e.mu=i.mu,!B(e.mu)||j(e.mu)))return new TypeError(d("invalid option. `%s` option must be a number. Option: `%s`.","mu",e.mu));if(E(i,"zeroMethod")){if(e.zeroMethod=i.zeroMethod,!C(e.zeroMethod))return new TypeError(d("invalid option. `%s` option must be a string. Option: `%s`.","zeroMethod",e.alternative));if(!N(U,e.zeroMethod))return new Error(d('invalid option. `%s` option must be one of the following: "%s". Option: `%s`.',"zeroMethod",U.join('", "'),e.zeroMethod))}return null}W.exports=ne});var G=V(function(Te,Z){"use strict";function oe(e,i){return e-i}function se(e){var i,o,a,u;for(e=e.slice(),e.sort(oe),i=e.length,a=1,u=0;a<i;a++)o=e[a],e[u]!==o&&(u+=1,e[u]=o);return e.length=u+1,e}Z.exports=se});var X=V(function(ze,Q){"use strict";var le=require("@stdlib/assert-is-positive-integer"),ue=require("@stdlib/assert-is-plain-object"),ve=require("@stdlib/assert-is-boolean").isPrimitive,J=require("@stdlib/assert-has-own-property"),K=require("@stdlib/math-base-special-roundn"),D=require("@stdlib/string-format");function fe(e){var i,o,a;if(o=4,i=!0,arguments.length>0){if(!ue(e))throw new TypeError(D("invalid argument. First argument must be an object. Value: `%s`.",e));if(J(e,"digits")){if(!le(e.digits))throw new TypeError(D("invalid option. `%s` option must be a positive integer. Option: `%s`.","digits",e.digits));o=e.digits}if(J(e,"decision")){if(!ve(e.decision))throw new TypeError(D("invalid option. `%s` option must be a boolean. Option: `%s`.","decision",e.decision));i=e.decision}}switch(a="",a+=this.method,a+="\n\n",a+="Alternative hypothesis: ",this.method==="Paired Wilcoxon signed rank test"?a+="Median of the difference `x - y` is ":a+="Median of `x` is ",this.alternative){case"less":a+="less than ";break;case"greater":a+="greater than ";break;case"two-sided":default:a+="not equal to ";break}return a+=this.nullValue,a+="\n\n",a+=" pValue: "+K(this.pValue,-o)+"\n",a+=" statistic: "+K(this.statistic,-o)+"\n",a+="\n",i&&(a+="Test Decision: ",this.rejected?a+="Reject null in favor of alternative at "+this.alpha*100+"% significance level":a+="Fail to reject null in favor of alternative at "+this.alpha*100+"% significance level",a+="\n"),a}Q.exports=fe});var ae=V(function(Me,ie){"use strict";var Y=require("@stdlib/assert-is-number-array").primitives,$=require("@stdlib/assert-is-typed-array-like"),p=require("@stdlib/utils-define-read-only-property"),ce=require("@stdlib/assert-is-plain-object"),he=require("@stdlib/stats-ranks"),de=require("@stdlib/stats-base-dists-normal-cdf").factory,k=require("@stdlib/stats-base-dists-signrank-cdf"),me=require("@stdlib/utils-tabulate"),ge=require("@stdlib/math-base-special-signum"),pe=require("@stdlib/math-base-special-sqrt"),ee=require("@stdlib/math-base-special-abs"),re=require("@stdlib/array-float64"),L=require("@stdlib/string-format"),we=H(),be=G(),qe=X(),S=de(0,1);function ye(){var e,i,o,a,u,O,T,l,P,z,m,v,f,w,A,t,F,c,R,q,M,y,n,r,g,x,b,s,h;if(s=arguments[0],!$(s)&&!Y(s))throw new TypeError(L("invalid argument. First argument must be a numeric array. Value: `%s`.",s));if(t=s.length,arguments.length>1)if(ce(arguments[1]))o=arguments[1];else{if(h=arguments[1],!$(h)&&!Y(h))throw new TypeError(L("invalid argument. `%s` argument must be a numeric array. Value: `%s`.","y",h));if(t!==h.length)throw new Error("invalid arguments. First and second arguments must have the same length.");arguments.length>2&&(o=arguments[2])}if(v={},o&&(A=we(v,o),A))throw A;if(q=v.mu||0,v.correction===void 0?e=!0:e=v.correction,v.alpha===void 0?z=.05:z=v.alpha,t<2)throw new Error(L("invalid argument. First argument must contain at least two elements. Value: `%s`.",s));if(w=v.alternative||"two-sided",i=v.zeroMethod||"wilcox",i==="wilcox"){if(n=[],h)for(r=0;r<t;r++)b=s[r]-h[r]-q,b!==0&&n.push(b);else for(r=0;r<t;r++)s[r]!==0&&n.push(s[r]-q);l=s.length-n.length}else if(n=new re(t),l=0,h)for(r=0;r<t;r++)n[r]=s[r]-h[r]-q,n[r]===0&&(l+=1);else for(r=0;r<t;r++)n[r]=s[r]-q,n[r]===0&&(l+=1);if(l===t)throw new Error("`x` or `x - y` cannot be zero for all elements.");for(t=n.length,R=new re(t),r=0;r<t;r++)R[r]=ee(n[r]);for(g=he(R),T=0,P=0,r=0;r<t;r++)n[r]>0?T+=g[r]:n[r]===0&&(P+=g[r]);if(a=be(g).length!==g.length,i==="zsplit"&&(T+=P/2),x=T,M=t*(t+1)*.25,y=t*(t+1)*(2*t+1),i==="pratt"){for(F=[],r=0;r<t;r++)n[r]!==0&&F.push(g[r]);g=F,M-=l*(l+1)*.25,y-=l*(l+1)*(2*l+1)}for(u=me(g),O=0,r=0;r<u.length;r++)u[r][1]>1&&(b=u[r][1],O+=b*(b*b-1));if(O>0&&(y-=.5*O),y=pe(y/24),t>50&&!v.exact||l>0||a){if(n=0,e)switch(w){case"two-sided":n=.5*ge(x-M);break;case"less":n=-.5;break;default:n=.5;break}f=(x-M-n)/y,w==="two-sided"?m=2*(1-S(ee(f))):w==="greater"?m=1-S(f):m=S(f)}else f=x,w==="two-sided"?f>t*(t+1)/4?m=2*(1-k(f-1,t)):m=2*k(f,t):w==="greater"?m=1-k(f-1,t):m=k(f,t);return c={},p(c,"rejected",m<=z),p(c,"alpha",z),p(c,"pValue",m),p(c,"statistic",x),p(c,"nullValue",q),p(c,"alternative",w),p(c,"method",(h?"Paired":"One-Sample")+" Wilcoxon signed rank test"),p(c,"print",qe),c}ie.exports=ye});var Ee=ae();module.exports=Ee;
|
|
2
|
+
/**
|
|
3
|
+
* @license Apache-2.0
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2020 The Stdlib Authors.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
11
19
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/stats-wilcoxon",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Wilcoxon signed rank test.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -15,19 +15,12 @@
|
|
|
15
15
|
],
|
|
16
16
|
"main": "./lib",
|
|
17
17
|
"directories": {
|
|
18
|
-
"benchmark": "./benchmark",
|
|
19
18
|
"doc": "./docs",
|
|
20
|
-
"example": "./examples",
|
|
21
19
|
"lib": "./lib",
|
|
22
|
-
"
|
|
20
|
+
"dist": "./dist"
|
|
23
21
|
},
|
|
24
22
|
"types": "./docs/types",
|
|
25
|
-
"scripts": {
|
|
26
|
-
"test": "make test",
|
|
27
|
-
"test-cov": "make test-cov",
|
|
28
|
-
"examples": "make examples",
|
|
29
|
-
"benchmark": "make benchmark"
|
|
30
|
-
},
|
|
23
|
+
"scripts": {},
|
|
31
24
|
"homepage": "https://stdlib.io",
|
|
32
25
|
"repository": {
|
|
33
26
|
"type": "git",
|
|
@@ -37,41 +30,30 @@
|
|
|
37
30
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
31
|
},
|
|
39
32
|
"dependencies": {
|
|
40
|
-
"@stdlib/array-float64": "^0.2.
|
|
41
|
-
"@stdlib/assert-contains": "^0.2.
|
|
42
|
-
"@stdlib/assert-has-own-property": "^0.
|
|
43
|
-
"@stdlib/assert-is-boolean": "^0.2.
|
|
44
|
-
"@stdlib/assert-is-nan": "^0.2.
|
|
45
|
-
"@stdlib/assert-is-number": "^0.2.
|
|
46
|
-
"@stdlib/assert-is-number-array": "^0.2.
|
|
47
|
-
"@stdlib/assert-is-plain-object": "^0.2.
|
|
48
|
-
"@stdlib/assert-is-positive-integer": "^0.2.
|
|
49
|
-
"@stdlib/assert-is-string": "^0.2.
|
|
50
|
-
"@stdlib/assert-is-typed-array-like": "^0.2.
|
|
51
|
-
"@stdlib/math-base-special-abs": "^0.2.
|
|
52
|
-
"@stdlib/math-base-special-roundn": "^0.2.
|
|
53
|
-
"@stdlib/math-base-special-signum": "^0.2.
|
|
54
|
-
"@stdlib/math-base-special-sqrt": "^0.2.
|
|
55
|
-
"@stdlib/stats-base-dists-normal-cdf": "^0.2.
|
|
56
|
-
"@stdlib/stats-base-dists-signrank-cdf": "^0.2.
|
|
57
|
-
"@stdlib/stats-ranks": "^0.2.
|
|
58
|
-
"@stdlib/string-format": "^0.2.
|
|
59
|
-
"@stdlib/
|
|
60
|
-
"@stdlib/utils-
|
|
61
|
-
"@stdlib/
|
|
62
|
-
"@stdlib/error-tools-fmtprodmsg": "^0.1.1"
|
|
63
|
-
},
|
|
64
|
-
"devDependencies": {
|
|
65
|
-
"@stdlib/assert-is-object": "^0.1.1",
|
|
66
|
-
"@stdlib/constants-float64-eps": "^0.1.1",
|
|
67
|
-
"@stdlib/random-base-discrete-uniform": "^0.1.0",
|
|
68
|
-
"@stdlib/random-base-randu": "^0.1.0",
|
|
69
|
-
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
70
|
-
"istanbul": "^0.4.1",
|
|
71
|
-
"tap-min": "git+https://github.com/Planeshifter/tap-min.git",
|
|
72
|
-
"@stdlib/bench-harness": "^0.2.0",
|
|
73
|
-
"@stdlib/bench": "^0.3.1"
|
|
33
|
+
"@stdlib/array-float64": "^0.2.2",
|
|
34
|
+
"@stdlib/assert-contains": "^0.2.2",
|
|
35
|
+
"@stdlib/assert-has-own-property": "^0.2.2",
|
|
36
|
+
"@stdlib/assert-is-boolean": "^0.2.2",
|
|
37
|
+
"@stdlib/assert-is-nan": "^0.2.2",
|
|
38
|
+
"@stdlib/assert-is-number": "^0.2.2",
|
|
39
|
+
"@stdlib/assert-is-number-array": "^0.2.2",
|
|
40
|
+
"@stdlib/assert-is-plain-object": "^0.2.2",
|
|
41
|
+
"@stdlib/assert-is-positive-integer": "^0.2.2",
|
|
42
|
+
"@stdlib/assert-is-string": "^0.2.2",
|
|
43
|
+
"@stdlib/assert-is-typed-array-like": "^0.2.2",
|
|
44
|
+
"@stdlib/math-base-special-abs": "^0.2.2",
|
|
45
|
+
"@stdlib/math-base-special-roundn": "^0.2.2",
|
|
46
|
+
"@stdlib/math-base-special-signum": "^0.2.2",
|
|
47
|
+
"@stdlib/math-base-special-sqrt": "^0.2.2",
|
|
48
|
+
"@stdlib/stats-base-dists-normal-cdf": "^0.2.1",
|
|
49
|
+
"@stdlib/stats-base-dists-signrank-cdf": "^0.2.2",
|
|
50
|
+
"@stdlib/stats-ranks": "^0.2.2",
|
|
51
|
+
"@stdlib/string-format": "^0.2.2",
|
|
52
|
+
"@stdlib/utils-define-read-only-property": "^0.2.2",
|
|
53
|
+
"@stdlib/utils-tabulate": "^0.2.2",
|
|
54
|
+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
|
|
74
55
|
},
|
|
56
|
+
"devDependencies": {},
|
|
75
57
|
"engines": {
|
|
76
58
|
"node": ">=0.10.0",
|
|
77
59
|
"npm": ">2.7.0"
|