Graphics Reference
In-Depth Information
c2
GDP laborrate healthexp infmortality
Mongolia
1690.4170
72.9
74.19826
27.8
Canada
39599.0418
67.8 4379.76084
5.2
...
Macedonia, FYR
4510.2380
54.0 313.68971
10.6
Turkmenistan
3710.4536
68.0
77.06955
48.0
The values for GDP are several orders of magnitude larger than the values for, say, infmortal-
ity . Because of this, the effect of infmortality on the clustering will be negligible compared
to the effect of GDP .This probably isn't what we want. To address this issue, we'll scale the data:
c3 <- scale(c2)
c3
GDP laborrate healthexp infmortality
Mongolia
-0.6783472 1.15028714 -0.6341393599 -0.08334689
Canada
1.7504703 0.59747293 1.9736219974 -0.88014885
...
Macedonia, FYR
-0.4976803 -0.89837729 -0.4890859471 -0.68976254
Turkmenistan
-0.5489228 0.61915192 -0.6324002997
0.62883892
attr(, "scaled:center" )
GDP laborrate healthexp infmortality
12277.960
62.288
1121.198
30.164
attr(, "scaled:scale" )
GDP laborrate healthexp infmortality
15607.852864
9.225523 1651.056974
28.363384
By default the scale() function scales each column relative to its standard deviation, but other
methods may be used.
Finally, we're ready to make the dendrogram, as shown in Figure 13-19 :
hc <- hclust(dist(c3))
# Make the dendrogram
plot(hc)
# With text aligned
plot(hc, hang = -1 )
Search WWH ::




Custom Search