单组数据的分布可以通过直方图、茎叶图和框须图考察。
Example 4.3.1 程序包DAAG中有内嵌数据集“possum”, 包括从维多利亚南部到皇后区的七个地区的104只负鼠(possum)的年龄、尾巴的长度、总长度等9个特征,考虑其中的43只雌性负鼠的特征,建立子集fpossum,考察雌性负鼠的总长度的频率分布。
First :图形+Code
> library(DAAG) #打开数据库
> data(possum) #调入数据集
> fpossum <- possum[possum$sex=="f",] #提取子集
> par(mfrow = c(1,2)) #绘图区域分成两部分
> attach ( fpossum ) #当前数据集
> hist( totlngth,
+ breaks = 72.5 + (0:5)*5,
+ ylim = c(0,22),
+ xlab = "total length",
+ main = "A:Breaks at 72.5...")
> hist ( totlngth,
+ breaks = 75 + (0:5) * 5,
+ ylim = c(0,22),
+ xlab = "total length",
+ main = "B:Breaks at 75...")
> stem(fpossum$totlngth) #茎叶图
The decimal point is at the |
74 | 0
76 |
78 |
80 | 05
82 | 0500
84 | 05005
86 | 05505
88 | 0005500005555
90 | 5550055
92 | 000
94 | 05
96 | 5
> boxplot(fpossum$totlngth) #框须图
Second:数据集显示
> possum
case site Pop sex age hdlngth skullw totlngth taill footlgth earconch eye chest belly
C3 1 1 Vic m 8 94.1 60.4 89.0 36.0 74.5 54.5 15.2 28.0 36.0
C5 2 1 Vic f 6 92.5 57.6 91.5 36.5 72.5 51.2 16.0 28.5 33.0
C10 3 1 Vic f 6 94.0 60.0 95.5 39.0 75.4 51.9 15.5 30.0 34.0
C15 4 1 Vic f 6 93.2 57.1 92.0 38.0 76.1 52.2 15.2 28.0 34.0
C23 5 1 Vic f 2 91.5 56.3 85.5 36.0 71.0 53.2 15.1 28.5 33.0
C24 6 1 Vic f 1 93.1 54.8 90.5 35.5 73.2 53.6 14.2 30.0 32.0
C26 7 1 Vic m 2 95.3 58.2 89.5 36.0 71.5 52.0 14.2 30.0 34.5
C27 8 1 Vic f 6 94.8 57.6 91.0 37.0 72.7 53.9 14.5 29.0 34.0
C28 9 1 Vic f 9 93.4 56.3 91.5 37.0 72.4 52.9 15.5 28.0 33.0
C31 10 1 Vic f 6 91.8 58.0 89.5 37.5 70.9 53.4 14.4 27.5 32.0
C32 11 1 Vic f 9 93.3 57.2 89.5 39.0 77.2 51.3 14.9 31.0 34.0
C34 12 1 Vic f 5 94.9 55.6 92.0 35.5 71.7 51.0 15.3 28.0 33.0
C36 13 1 Vic m 5 95.1 59.9 89.5 36.0 71.0 49.8 15.8 27.0 32.0
C37 14 1 Vic m 3 95.4 57.6 91.5 36.0 74.3 53.7 15.1 28.0 31.5
C39 15 1 Vic m 5 92.9 57.6 85.5 34.0 69.7 51.8 15.7 28.0 35.0
C40 16 1 Vic m 4 91.6 56.0 86.0 34.5 73.0 51.4 14.4 28.0 32.0
C45 17 1 Vic f 1 94.7 67.7 89.5 36.5 73.2 53.2 14.7 29.0 31.0
C47 18 1 Vic m 2 93.5 55.7 90.0 36.0 73.7 55.4 15.3 28.0 32.0
C48 19 1 Vic f 5 94.4 55.4 90.5 35.0 73.4 53.9 15.2 28.0 32.0
C50 20 1 Vic f 4 94.8 56.3 89.0 38.0 73.8 52.4 15.5 27.0 36.0
C54 21 1 Vic f 3 95.9 58.1 96.5 39.5 77.9 52.9 14.2 30.0 40.0
C55 22 1 Vic m 3 96.3 58.5 91.0 39.5 73.5 52.1 16.2 28.0 36.0
C58 23 1 Vic f 4 92.5 56.1 89.0 36.0 72.8 53.3 15.4 28.0 35.0
C59 24 1 Vic m 2 94.4 54.9 84.0 34.0 75.0 53.5 16.2 27.0 32.0
C60 25 1 Vic m 3 95.8 58.5 91.5 35.5 72.3 51.6 14.9 31.0 35.0
C61 26 1 Vic m 7 96.0 59.0 90.0 36.0 73.6 56.2 15.0 29.0 38.0
C63 27 1 Vic f 2 90.5 54.5 85.0 35.0 70.3 50.8 14.2 23.0 28.0
C64 28 1 Vic m 4 93.8 56.8 87.0 34.5 73.2 53.0 15.3 27.0 30.0
A1 29 1 Vic f 3 92.8 56.0 88.0 35.0 74.9 51.8 14.0 24.0 32.0
A2 30 1 Vic f 2 92.1 54.4 84.0 33.5 70.6 50.8 14.5 24.5 33.0
A3 31 1 Vic m 3 92.8 54.1 93.0 37.0 68.0 52.5 14.5 27.0 31.0
A4 32 1 Vic f 4 94.3 56.7 94.0 39.0 74.8 52.0 14.9 28.0 34.0
AD1 33 1 Vic m 3 91.4 54.6 89.0 37.0 70.8 51.8 14.8 24.0 30.0
BB4 34 2 Vic m 2 90.6 55.7 85.5 36.5 73.1 53.1 14.4 26.0 28.5
BB13 35 2 Vic m 4 94.4 57.9 85.0 35.5 71.2 55.5 16.4 28.0 35.5
BB15 36 2 Vic m 7 93.3 59.3 88.0 35.0 74.3 52.0 14.9 25.5 36.0
BB17 37 2 Vic f 2 89.3 54.8 82.5 35.0 71.2 52.0 13.6 28.0 31.5
BB25 38 2 Vic m 7 92.4 56.0 80.5 35.5 68.4 49.5 15.9 27.0 30.0
BB31 39 2 Vic f 1 84.7 51.5 75.0 34.0 68.7 53.4 13.0 25.0 25.0
BB33 40 2 Vic f 3 91.0 55.0 84.5 36.0 72.8 51.4 13.6 27.0 30.0
BB36 41 2 Vic f 5 88.4 57.0 83.0 36.5 NA 40.3 15.9 27.0 30.5
BB38 42 2 Vic m 3 85.3 54.1 77.0 32.0 62.7 51.2 13.8 25.5 33.0
BB40 43 2 Vic f 2 90.0 55.5 81.0 32.0 72.0 49.4 13.4 29.0 31.0
BB41 44 2 Vic m NA 85.1 51.5 76.0 35.5 70.3 52.6 14.4 23.0 27.0
BB44 45 2 Vic m 3 90.7 55.9 81.0 34.0 71.5 54.0 14.6 27.0 31.5
BB45 46 2 Vic m NA 91.4 54.4 84.0 35.0 72.8 51.2 14.4 24.5 35.0
WW1 47 3 other m 2 90.1 54.8 89.0 37.5 66.0 45.5 15.0 25.0 33.0
WW2 48 3 other m 5 98.6 63.2 85.0 34.0 66.9 44.9 17.0 28.0 35.0
WW3 49 3 other m 4 95.4 59.2 85.0 37.0 69.0 45.0 15.9 29.5 35.5
WW4 50 3 other f 5 91.6 56.4 88.0 38.0 65.0 47.2 14.9 28.0 36.0
WW5 51 3 other f 5 95.6 59.6 85.0 36.0 64.0 43.9 17.4 28.0 38.5
WW6 52 3 other m 6 97.6 61.0 93.5 40.0 67.9 44.3 15.8 28.5 32.5
WW7 53 3 other f 3 93.1 58.1 91.0 38.0 67.4 46.0 16.5 26.0 33.5
BR1 54 4 other m 7 96.9 63.0 91.5 43.0 71.3 46.0 17.5 30.0 36.5
BR2 55 4 other m 2 103.1 63.2 92.5 38.0 72.5 44.9 16.4 30.5 36.0
BR3 56 4 other m 3 99.9 61.5 93.7 38.0 68.7 46.8 16.4 27.5 31.5
BR4 57 4 other f 4 95.1 59.4 93.0 41.0 67.2 45.3 14.5 31.0 39.0
BR5 58 4 other m 3 94.5 64.2 91.0 39.0 66.5 46.4 14.4 30.5 33.0
BR6 59 4 other m 2 102.5 62.8 96.0 40.0 73.2 44.5 14.7 32.0 36.0
BR7 60 4 other f 2 91.3 57.7 88.0 39.0 63.1 47.0 14.4 26.0 30.0
CD1 61 5 other m 7 95.7 59.0 86.0 38.0 63.1 44.9 15.0 26.5 31.0
CD2 62 5 other f 3 91.3 58.0 90.5 39.0 65.5 41.3 16.0 27.0 32.0
CD3 63 5 other f 6 92.0 56.4 88.5 38.0 64.1 46.3 15.2 25.5 28.5
CD4 64 5 other f 3 96.9 56.5 89.5 38.5 63.0 45.1 17.1 25.5 33.0
CD5 65 5 other f 5 93.5 57.4 88.5 38.0 68.2 41.7 14.0 29.0 38.5
CD6 66 5 other f 3 90.4 55.8 86.0 36.5 63.2 44.2 15.7 26.5 34.0
CD7 67 5 other m 4 93.3 57.6 85.0 36.5 64.7 44.1 16.5 27.5 29.5
CD8 68 5 other m 5 94.1 56.0 88.5 38.0 65.9 43.1 17.4 27.0 30.0
CD9 69 5 other m 5 98.0 55.6 88.0 37.5 65.0 45.6 15.0 28.5 34.0
CD10 70 5 other f 7 91.9 56.4 87.0 38.0 65.4 44.1 13.0 27.0 34.0
CD11 71 5 other m 6 92.8 57.6 90.0 40.0 65.7 42.8 15.0 27.5 34.0
CD12 72 5 other m 1 85.9 52.4 80.5 35.0 62.0 42.4 14.1 25.5 30.0
CD13 73 5 other m 1 82.5 52.3 82.0 36.5 65.7 44.7 16.0 23.5 28.0
BSF1 74 6 other f 4 88.7 52.0 83.0 38.0 61.5 45.9 14.7 26.0 34.0
BSF2 75 6 other m 6 93.8 58.1 89.0 38.0 66.2 45.6 16.9 26.0 33.5
BSF3 76 6 other m 5 92.4 56.8 89.0 41.0 64.5 46.4 17.8 26.0 33.0
BSF4 77 6 other m 6 93.6 56.2 84.0 36.0 62.8 42.9 16.2 25.0 35.0
BSF5 78 6 other m 1 86.5 51.0 81.0 36.5 63.0 44.3 13.2 23.0 28.0
BSF6 79 6 other m 1 85.8 50.0 81.0 36.5 62.8 43.0 14.8 22.0 28.5
BSF7 80 6 other m 1 86.7 52.6 84.0 38.0 62.3 44.8 15.0 23.5 30.5
BSF8 81 6 other m 3 90.6 56.0 85.5 38.0 65.6 41.7 17.0 27.5 35.0
BSF9 82 6 other f 4 86.0 54.0 82.0 36.5 60.7 42.9 15.4 26.0 32.0
BSF10 83 6 other f 3 90.0 53.8 81.5 36.0 62.0 43.3 14.0 25.0 29.0
BSF11 84 6 other m 3 88.4 54.6 80.5 36.0 62.6 43.6 16.3 25.0 28.5
BSF12 85 6 other m 3 89.5 56.2 92.0 40.5 65.6 43.5 14.5 27.0 31.5
BSF13 86 6 other f 3 88.2 53.2 86.5 38.5 60.3 43.7 13.6 26.0 31.0
BTP1 87 7 other m 2 98.5 60.7 93.0 41.5 71.7 46.8 15.0 26.0 36.0
BTP3 88 7 other f 2 89.6 58.0 87.5 38.0 66.7 43.5 16.0 25.5 31.5
BTP4 89 7 other m 6 97.7 58.4 84.5 35.0 64.4 46.2 14.4 29.0 30.5
BTP5 90 7 other m 3 92.6 54.6 85.0 38.5 69.8 44.8 14.5 25.5 32.5
BTP6 91 7 other m 3 97.8 59.6 89.0 38.0 65.5 48.0 15.0 26.0 32.0
BTP7 92 7 other m 2 90.7 56.3 85.0 37.0 67.6 46.8 14.5 25.5 31.0
BTP8 93 7 other m 3 89.2 54.0 82.0 38.0 63.8 44.9 12.8 24.0 31.0
BTP9 94 7 other m 7 91.8 57.6 84.0 35.5 64.2 45.1 14.4 29.0 35.0
BTP10 95 7 other m 4 91.6 56.6 88.5 37.5 64.5 45.4 14.9 27.0 31.0
BTP12 96 7 other m 4 94.8 55.7 83.0 38.0 66.5 47.7 14.0 25.0 33.0
BTP13 97 7 other m 3 91.0 53.1 86.0 38.0 63.8 46.0 14.5 25.0 31.5
BTP14 98 7 other m 5 93.2 68.6 84.0 35.0 65.6 44.3 14.5 28.5 32.0
BTP15 99 7 other f 3 93.3 56.2 86.5 38.5 64.8 43.8 14.0 28.0 35.0
BTP16 100 7 other m 1 89.5 56.0 81.5 36.5 66.0 46.8 14.8 23.0 27.0
BTP17 101 7 other m 1 88.6 54.7 82.5 39.0 64.4 48.0 14.0 25.0 33.0
BTP19 102 7 other f 6 92.4 55.0 89.0 38.0 63.5 45.4 13.0 25.0 30.0
BTP20 103 7 other m 4 91.5 55.2 82.5 36.5 62.9 45.9 15.4 25.0 29.0
BTP21 104 7 other f 3 93.6 59.9 89.0 40.0 67.6 46.0 14.8 28.5 33.5