Appendix A. Datasets
All datasets are stored under src/main/resources/datasets. While Java class codes are stored under src/main/java, user resources are stored under src/main/resources. In general, we use the JAR loader functionality to retrieve contents of a file directly from the JAR, not from the filesystem.
Anscombe’s Quartet
Anscombe’s quartet is a set of four x-y pairs of data with remarkable properties. Although the x-y plots of each pair look completely different, the data has the properties that make statistical measures almost identical. The values for each of the four x-y data series are in Table A-1.
x1 | y1 | x2 | y2 | x3 | y3 | x4 | y4 |
---|---|---|---|---|---|---|---|
10.0 | 8.04 | 10.0 | 9.14 | 10.0 | 7.46 | 8.0 | 6.58 |
8.0 | 6.95 | 8.0 | 8.14 | 8.0 | 6.77 | 8.0 | 5.76 |
13.0 | 7.58 | 13.0 | 8.74 | 13.0 | 12.74 | 8.0 | 7.71 |
9.0 | 8.81 | 9.0 | 8.77 | 9.0 | 7.11 | 8.0 | 8.84 |
11.0 | 8.33 | 11.0 | 9.26 | 11.0 | 7.81 | 8.0 | 8.47 |
14.0 | 9.96 | 14.0 | 8.10 | 14.0 | 8.84 | 8.0 | 7.04 |
6.0 | 7.24 | 6.0 | 6.13 | 6.0 | 6.08 | 8.0 | 5.25 |
4.0 | 4.26 | 4.0 | 3.10 | 4.0 | 5.39 | 19.0 | 12.50 |
12.0 | 10.84 | 12.0 | 9.13 | 12.0 | 8.15 | 8.0 | 5.56 |
7.0 | 4.82 | 7.0 | 7.26 | 7.0 | 6.42 | 8.0 | 7.91 |
5.0 | 5.68 | 5.0 | 4.74 | 5.0 | 5.73 | 8.0 | 6.89 |
We can easily hardcode the data as static members of the class:
public
class
Anscombe
{
public
static
final
double
[]
x1
=
{
10.0
,
8.0
,
13.0
,
9.0
,
11.0
,
14.0
,
6.0
,
4.0
,
12.0
,
7.0
,
5.0
};
public
static
final
double
[]
y1
=
{
8.04
,
6.95
,
7.58
,
8.81
,
8.33
,
9.96
,
7.24
,
4.26
,
10.84
,
4.82
,
5.68
};
public
static
final
double
[]
x2
=
{
10.0
,
8.0
,
13.0
,
9.0
,
11.0
,
14.0
,
6.0
,
4.0
,
12.0
,
7.0
,
5.0
};
public
static
final
double
[]
y2
=
{
9.14
,
8.14
,
8.74
,
8.77
,
9.26
,
8.10
,
6.13
,
3.10
,
9.13
,
7.26
,
4.74
};
public
static
final
double ...
Get Data Science with Java now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.