Skip to content

Commit 774d1aa

Browse files
committed
Add Anscombe's quartet
1 parent e0745ab commit 774d1aa

File tree

20 files changed

+1339
-0
lines changed

20 files changed

+1339
-0
lines changed

lib/node_modules/@stdlib/datasets/anscombes-quartet/LICENSE

Lines changed: 356 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
# Anscombe's Quartet
2+
3+
> [Anscombe's quartet][anscombes-quartet].
4+
5+
<section class="intro">
6+
7+
[Anscombe's quartet][anscombes-quartet] is a set of `4` datasets which all have nearly identical simple statistical properties but vary considerably when graphed. [Anscombe][francis-anscombe] created the datasets to demonstrate why graphical data exploration should **precede** statistical data analysis and to show the effect of outliers on statistical properties.
8+
9+
</section>
10+
11+
<!-- /.intro -->
12+
13+
<section class="usage">
14+
15+
## Usage
16+
17+
```javascript
18+
var data = require( '@stdlib/datasets/anscombes-quartet' );
19+
```
20+
21+
#### data()
22+
23+
Returns [Anscombe's quartet][anscombes-quartet], which is comprised of `4` individual datasets, which each individual dataset is an `array` of `[x,y]` tuples.
24+
25+
```javascript
26+
var d = data();
27+
/* returns
28+
[
29+
[
30+
[ 10, 8.04 ],
31+
[ 8, 6.95 ],
32+
[ 13, 7.58 ],
33+
[ 9, 8.81 ],
34+
[ 11, 8.33 ],
35+
[ 14, 9.96 ],
36+
[ 6, 7.24 ],
37+
[ 4, 4.26 ],
38+
[ 12, 10.84 ],
39+
[ 7, 4.82 ],
40+
[ 5, 5.68 ]
41+
],
42+
[
43+
[ 10, 9.14 ],
44+
[ 8, 8.14 ],
45+
[ 13, 8.74 ],
46+
[ 9, 8.77 ],
47+
[ 11, 9.26 ],
48+
[ 14, 8.1 ],
49+
[ 6, 6.13 ],
50+
[ 4, 3.1 ],
51+
[ 12, 9.13 ],
52+
[ 7, 7.26 ],
53+
[ 5, 4.74 ]
54+
],
55+
[
56+
[ 10, 7.46 ],
57+
[ 8, 6.77 ],
58+
[ 13, 12.74 ],
59+
[ 9, 7.11 ],
60+
[ 11, 7.81 ],
61+
[ 14, 8.84 ],
62+
[ 6, 6.08 ],
63+
[ 4, 5.39 ],
64+
[ 12, 8.15 ],
65+
[ 7, 6.42 ],
66+
[ 5, 5.73 ]
67+
],
68+
[
69+
[ 8, 6.58 ],
70+
[ 8, 5.76 ],
71+
[ 8, 7.71 ],
72+
[ 8, 8.84 ],
73+
[ 8, 8.47 ],
74+
[ 8, 7.04 ],
75+
[ 8, 5.25 ],
76+
[ 19, 12.5 ],
77+
[ 8, 5.56 ],
78+
[ 8, 7.91 ],
79+
[ 8, 6.89 ]
80+
]
81+
]
82+
*/
83+
```
84+
85+
</section>
86+
87+
<!-- /.usage -->
88+
89+
<section class="examples">
90+
91+
## Examples
92+
93+
<!-- TODO: more interesting example involving stats and plotting once ndarray -->
94+
95+
```javascript
96+
var data = require( './../lib' );
97+
98+
console.log( data() );
99+
```
100+
101+
</section>
102+
103+
<!-- /.examples -->
104+
105+
* * *
106+
107+
<section class="cli">
108+
109+
## CLI
110+
111+
<section class="usage">
112+
113+
### Usage
114+
115+
```text
116+
Usage: anscombes-quartet [options]
117+
118+
Options:
119+
120+
-h, --help Print this message.
121+
-V, --version Print the package version.
122+
```
123+
124+
</section>
125+
126+
<!-- /.usage -->
127+
128+
<section class="notes">
129+
130+
### Notes
131+
132+
- Data is written to `stdout` as comma-separated values ([CSV][csv]), where the first line is a header line.
133+
134+
</section>
135+
136+
<!-- /.notes -->
137+
138+
<section class="examples">
139+
140+
### Examples
141+
142+
```bash
143+
$ anscombes-quartet
144+
x1,y1,x2,y2,x3,y3,x4,y4
145+
10,8.04,10,9.14,10,7.46,8,6.58
146+
8,6.95,8,8.14,8,6.77,8,5.76
147+
13,7.58,13,8.74,13,12.74,8,7.71
148+
9,8.81,9,8.77,9,7.11,8,8.84
149+
11,8.33,11,9.26,11,7.81,8,8.47
150+
14,9.96,14,8.1,14,8.84,8,7.04
151+
6,7.24,6,6.13,6,6.08,8,5.25
152+
4,4.26,4,3.1,4,5.39,19,12.5
153+
12,10.84,12,9.13,12,8.15,8,5.56
154+
7,4.82,7,7.26,7,6.42,8,7.91
155+
5,5.68,5,4.74,5,5.73,8,6.89
156+
```
157+
158+
</section>
159+
160+
<!-- /.examples -->
161+
162+
</section>
163+
164+
<!-- /.cli -->
165+
166+
* * *
167+
168+
<section class="references">
169+
170+
## References
171+
172+
- Anscombe, Francis J. 1973. "Graphs in Statistical Analysis." _The American Statistician_ 27 (1). \[American Statistical Association, Taylor & Francis, Ltd.]: 17–21. <http://www.jstor.org/stable/2682899>.
173+
174+
</section>
175+
176+
<!-- /.references -->
177+
178+
<!-- <license> -->
179+
180+
## License
181+
182+
The data files (databases) are licensed under an [Open Data Commons Public Domain Dedication & License 1.0][pddl-1.0] and their contents are licensed under [Creative Commons Zero v1.0 Universal][cc0]. The software is licensed under [Apache License, Version 2.0][apache-license].
183+
184+
<!-- </license> -->
185+
186+
<section class="links">
187+
188+
[pddl-1.0]: http://opendatacommons.org/licenses/pddl/1.0/
189+
190+
[cc0]: https://creativecommons.org/publicdomain/zero/1.0
191+
192+
[apache-license]: https://www.apache.org/licenses/LICENSE-2.0
193+
194+
[csv]: https://tools.ietf.org/html/rfc4180
195+
196+
[anscombes-quartet]:https://en.wikipedia.org/wiki/Anscombe%27s_quartet
197+
198+
[francis-anscombe]: https://en.wikipedia.org/wiki/Francis_Anscombe
199+
200+
</section>
201+
202+
<!-- /.links -->
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use strict';
2+
3+
// MODULES //
4+
5+
var bench = require( '@stdlib/bench' );
6+
var pkg = require( './../package.json' ).name;
7+
var isArray = require( '@stdlib/assert/is-array' );
8+
var data = require( './../lib/browser.js' );
9+
10+
11+
// MAIN //
12+
13+
bench( pkg+'::browser', function benchmark( b ) {
14+
var d;
15+
var i;
16+
b.tic();
17+
for ( i = 0; i < b.iterations; i++ ) {
18+
d = data();
19+
if ( d.length === 0 ) {
20+
b.fail( 'should have a length greater than 0' );
21+
}
22+
}
23+
b.toc();
24+
if ( !isArray( d ) ) {
25+
b.fail( 'should return an array' );
26+
}
27+
b.pass( 'benchmark finished' );
28+
b.end();
29+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use strict';
2+
3+
// MODULES //
4+
5+
var bench = require( '@stdlib/bench' );
6+
var pkg = require( './../package.json' ).name;
7+
var isArray = require( '@stdlib/assert/is-array' );
8+
var data = require( './../lib' );
9+
10+
11+
// MAIN //
12+
13+
bench( pkg, function benchmark( b ) {
14+
var d;
15+
var i;
16+
b.tic();
17+
for ( i = 0; i < b.iterations; i++ ) {
18+
d = data();
19+
if ( d.length === 0 ) {
20+
b.fail( 'should have a length greater than 0' );
21+
}
22+
}
23+
b.toc();
24+
if ( !isArray( d ) ) {
25+
b.fail( 'should return an array' );
26+
}
27+
b.pass( 'benchmark finished' );
28+
b.end();
29+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use strict';
2+
3+
// MODULES //
4+
5+
var bench = require( '@stdlib/bench' );
6+
var isArray = require( '@stdlib/assert/is-array' );
7+
var pkg = require( './../package.json' ).name;
8+
var data = require( './../lib/main.js' );
9+
10+
11+
// MAIN //
12+
13+
bench( pkg+'::non_browser', function benchmark( b ) {
14+
var d;
15+
var i;
16+
b.tic();
17+
for ( i = 0; i < b.iterations; i++ ) {
18+
d = data();
19+
if ( d.length === 0 ) {
20+
b.fail( 'should have a length greater than 0' );
21+
}
22+
}
23+
b.toc();
24+
if ( !isArray( d ) ) {
25+
b.fail( 'should return an array' );
26+
}
27+
b.pass( 'benchmark finished' );
28+
b.end();
29+
});
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env node
2+
'use strict';
3+
4+
// MODULES //
5+
6+
var resolve = require( 'path' ).resolve;
7+
var createReadStream = require( 'fs' ).createReadStream;
8+
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
9+
var stdout = require( '@stdlib/streams/base/stdout' );
10+
var CLI = require( '@stdlib/tools/cli' );
11+
12+
13+
// MAIN //
14+
15+
/**
16+
* Main execution sequence.
17+
*
18+
* @private
19+
*/
20+
function main() {
21+
var data;
22+
var cli; // eslint-disable-line no-unused-vars
23+
24+
// Create a command-line interface:
25+
cli = new CLI({
26+
'pkg': require( './../package.json' ),
27+
'options': require( './../etc/cli_opts.json' ),
28+
'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), {
29+
'encoding': 'utf8'
30+
})
31+
});
32+
33+
data = resolve( __dirname, '..', 'data', 'data.csv' );
34+
createReadStream( data ).pipe( stdout );
35+
} // end FUNCTION main()
36+
37+
main();
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
x1,y1,x2,y2,x3,y3,x4,y4
2+
10,8.04,10,9.14,10,7.46,8,6.58
3+
8,6.95,8,8.14,8,6.77,8,5.76
4+
13,7.58,13,8.74,13,12.74,8,7.71
5+
9,8.81,9,8.77,9,7.11,8,8.84
6+
11,8.33,11,9.26,11,7.81,8,8.47
7+
14,9.96,14,8.1,14,8.84,8,7.04
8+
6,7.24,6,6.13,6,6.08,8,5.25
9+
4,4.26,4,3.1,4,5.39,19,12.5
10+
12,10.84,12,9.13,12,8.15,8,5.56
11+
7,4.82,7,7.26,7,6.42,8,7.91
12+
5,5.68,5,4.74,5,5.73,8,6.89
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[[[10,8.04],[8,6.95],[13,7.58],[9,8.81],[11,8.33],[14,9.96],[6,7.24],[4,4.26],[12,10.84],[7,4.82],[5,5.68]],[[10,9.14],[8,8.14],[13,8.74],[9,8.77],[11,9.26],[14,8.1],[6,6.13],[4,3.1],[12,9.13],[7,7.26],[5,4.74]],[[10,7.46],[8,6.77],[13,12.74],[9,7.11],[11,7.81],[14,8.84],[6,6.08],[4,5.39],[12,8.15],[7,6.42],[5,5.73]],[[8,6.58],[8,5.76],[8,7.71],[8,8.84],[8,8.47],[8,7.04],[8,5.25],[19,12.5],[8,5.56],[8,7.91],[8,6.89]]]

0 commit comments

Comments
 (0)