プリンキピア

第8章統計学

8.2 Visualizing Data8.2 データを可視化する

A group of people are at a table, with their hands shown holding pens. They're all pointing to data on a piece of paper.
Figure 8.4図8.4
Data visualizations can help people quickly understand important features of a dataset. (credit: "Group of diverse people having a business meeting" by Rawpixel Ltd/Flickr, CC BY 2.0)
英語のヒント
データの可視化は、データセットの重要な特徴をすばやく理解する助けになる。(出典:Rawpixel Ltd/Flickr の "Group of diverse people having a business meeting"、CC BY 2.0)

Learning Objectives学習目標

After completing this section, you should be able to:
英語のヒント
この節を終えると、次のことができるようになる。
  1. Create charts and graphs to appropriately represent data.
    英語のヒント
    データを適切に表す図表やグラフを作る。
  2. Interpret visual representations of data.
    英語のヒント
    データの視覚的な表現を解釈する。
  3. Determine misleading components in data displayed visually.
    英語のヒント
    視覚的に示されたデータのなかで誤解を招く要素を見きわめる。
Summarizing raw data is the first step we must take when we want to communicate the results of a study or experiment to a broad audience. However, even organized data can be difficult to read; for example, if a frequency table is large, it can be tough to compare the first row to the last row. As the old saying goes: a picture is worth a thousand words (or, in this case, summary statistics)! Just as our techniques for organizing data depended on the type of data we were looking at, the methods we’ll use for creating visualizations will vary. Let’s start by considering categorical data.
英語のヒント
生データを要約することは、研究や実験の結果を広い読者に伝えたいときに踏むべき最初の手順である。しかし、整理したデータでも読みにくいことがある。たとえば、度数表が大きいと、最初の行と最後の行を比べるのは難しい。古いことわざのとおり、1枚の絵は千の言葉(この場合は要約統計量)に値する!データを整理する技法が見ているデータの種類によったのと同じように、可視化を作るのに使う方法も変わる。カテゴリカルデータを考えることから始めよう。

Visualizing Categorical Dataカテゴリカルデータを可視化する

If the data we’re visualizing is categorical, then we want a quick way to represent graphically the relative numbers of units that fall in each category. When we created the frequency distributions in the last section, all we did was count the number of units in each category and record that number (this was the frequency of that category). Frequencies are nice when we’re organizing and summarizing data; they’re easy to compute, and they’re always whole numbers. But they can be difficult to understand for an outsider who’s being introduced to your data.
英語のヒント
可視化するデータがカテゴリカルなら、それぞれのカテゴリーに入る単位の相対的な数をグラフで手早く表す方法がほしい。前の節で度数分布を作ったとき、したことは、それぞれのカテゴリーの単位の数を数えて記録するだけだった(これがそのカテゴリーの度数である)。度数はデータを整理して要約するのには都合がよい。計算しやすく、つねに整数である。しかし、あなたのデータを初めて見る外部の人には理解しにくいことがある。
Let’s consider a quick example. Suppose you surveyed some people and asked for their favorite color. You communicated your results using a frequency distribution. Jerry is interested in data on favorite colors, so he reads your frequency distribution. The first row shows that twelve people indicated green was their favorite color. However, Jerry has no way of knowing if that’s a lot of people without knowing how many people total took your survey. Twelve is a pretty significant number if only twenty-five people took the survey, but it’s next to nothing if you recorded a thousand responses. For that reason, we will often summarize categorical data not with frequencies, but with proportions. The proportion of data that fall into a particular category is computed by dividing the frequency for that category by the total number of units in the data.
英語のヒント
手短な例を考えよう。何人かの人を調査して好きな色を尋ねたとする。結果を度数分布で伝えた。ジェリーは好きな色のデータに関心があるので、その度数分布を読む。最初の行によると、12人が緑を好きな色に挙げた。しかし、ジェリーは調査を受けた人の総数を知らなければ、それが多いかどうかを知るすべがない。12は、調査を受けたのが25人だけならかなり大きな数だが、1000の回答を記録したならないに等しい。そのため、カテゴリカルデータを度数ではなく割合で要約することが多い。特定のカテゴリーに入るデータの割合は、そのカテゴリーの度数をデータの単位の総数で割って計算する。
Proportion of a category=Category frequencyTotal number of data units
Proportions can be expressed as fractions, decimals, or percentages.
英語のヒント
割合は、分数、小数、百分率で表せる。
Example 8.5例題 8.5

Finding Proportions割合を求める

Recall Example 8.2, in which a teacher recorded the responses on the first question of a multiple choice quiz, with five possible responses (A, B, C, D, and E). The raw data was as follows:
英語のヒント
例題8.2を思い出そう。教師が選択式のテストの1問目への回答を記録した。ありうる回答は5つ(A、B、C、D、E)だった。生データは次のとおりである:
AACABBAEACAAAC
EABAACABEEAACC
We computed a frequency distribution that looked like this:
英語のヒント
次のような度数分布を計算した:
Response to First Question1問目への回答Frequency度数
A14
B4
C6
D0
E4
Proportionofacategory=Categoryfrequency/Totalnumberofdataunits
Now, let's compute the proportions for each category.
英語のヒント
では、それぞれのカテゴリーの割合を計算しよう。
Solution解答
Step 1: In order to compute a proportion, we need the frequency (which we have in the table above) and the total number of units that are represented in our data. We can find that by adding up the frequencies from all the categories: 14+4+6+0+4=28.
英語のヒント
手順1:割合を計算するには、度数(上の表にある)とデータが表す単位の総数が必要である。総数は、すべてのカテゴリーの度数を足して求められる。14+4+6+0+4=28である。
Step 2: To find the proportions, we divide the frequency by the total. For the first category (“A”), the proportion is 1428=12=0.5=50%. We can compute the other proportions similarly, filling in the rest of the table:
英語のヒント
手順2:割合を求めるには、度数を総数で割る。最初のカテゴリー(「A」)の割合は1428=12=0.5=50%である。ほかの割合も同様に計算し、表の残りを埋められる:
Response to First Question1問目への回答Frequency度数Proportion割合
A14
1428=50%
B4
428=14.3%
C6
628=21.4%
D0
028=0%
E4
428=14.3%
Step 3: Check your work: If you add up your proportions, you should get 1 (if you’re using fractions or decimals) or 100% (if you’re using percentages). In this case, 50%+14.3%+21.4%+0%+14.3%=100%.
英語のヒント
手順3:確かめる。割合を足すと、1(分数や小数を使っているとき)か100%(百分率を使っているとき)になるはずである。この場合、50%+14.3%+21.4%+0%+14.3%=100%である。
Now that we can compute proportions, let’s turn to visualizations. There are two primary visualizations that we’ll use for categorical data: bar charts and pie charts. Both of these data representations work on the same principle: If proportions are represented as areas, then it’s easy to compare two proportions by assessing the corresponding areas. Let’s look at bar charts first.
英語のヒント
割合を計算できるようになったので、可視化に目を向けよう。カテゴリカルデータに使う主な可視化は2つある。棒グラフと円グラフである。これらのデータの表現はどちらも同じ原理で働く。割合を面積で表すなら、対応する面積を評価して2つの割合を比べるのは簡単である。まず棒グラフを見よう。

Bar Charts棒グラフ

A bar chart is a visualization of categorical data that consists of a series of rectangles arranged side-by-side (but not touching). Each rectangle corresponds to one of the categories. All of the rectangles have the same width. The height of each rectangle corresponds to either the number of units in the corresponding category or the proportion of the total units that fall into the category.
英語のヒント
棒グラフとは、横に並んだ(ただし接しない)一連の長方形でできたカテゴリカルデータの可視化である。それぞれの長方形は1つのカテゴリーに対応する。すべての長方形の幅は同じである。それぞれの長方形の高さは、対応するカテゴリーの単位の数か、そのカテゴリーに入る単位の全体に対する割合に対応する。
Example 8.6例題 8.6
Building a Bar Chart棒グラフを作る
In Example 8.5, we computed the following proportions:
英語のヒント
例題8.5で、次の割合を計算した:
Response to First Question1問目への回答Frequency度数Proportion割合
A1450%
B414.3%
C621.4%
D00%
E414.3%
Draw a bar chart to visualize this frequency distribution.
英語のヒント
この度数分布を可視化する棒グラフを描け。
Solution解答
Step 1: To start, we’ll draw axes with the origin (the point where the axes meet) at the bottom left:
英語のヒント
手順1:まず、原点(軸が交わる点)を左下にして軸を描く:
A blank bar chart with horizontal and vertical axes.
Figure 8.5図8.5
Step 2: Next, we’ll place our categories evenly spaced along the bottom of the horizontal axis. The order doesn’t really matter, but if the categories have some sort of natural order (like in this case, where the responses are labeled A to E), it’s best to maintain that order. We'll also label the horizontal axis:
英語のヒント
手順2:次に、カテゴリーを横軸の下に等間隔で置く。順序はあまり問題にならないが、カテゴリーに何らかの自然な順序があるなら(この場合のように回答にAからEのラベルがついているなら)、その順序を保つのがいちばんよい。横軸にもラベルをつける:
A bar chart. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis is blank.
Figure 8.6図8.6
Step 3: Now, we have a decision to make: Will we use frequencies to define the height of our rectangles, or will we use proportions? Let’s try it both ways. First, let’s use frequencies. Notice that our frequencies run from zero to 14; this will correspond to the scale we put on the vertical axis. If we put a tick mark for every whole number between 0 and 14, the result will be pretty crowded; let’s instead put a mark on the multiples of 3 or 5:
英語のヒント
手順3:ここで決めることがある。長方形の高さを度数で定めるのか、割合で定めるのか。両方やってみよう。まず、度数を使おう。度数は0から14までであることに注意しよう。これが縦軸につける目盛りに対応する。0から14までのすべての整数に目盛りをつけると、かなり混み合う。代わりに3か5の倍数に印をつけよう:
A bar chart. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing frequency ranges from 3 to 15, in increments of 3.
Figure 8.7図8.7
Step 4: Now, let’s draw in the first rectangle. The frequency associated with “A” is 14. So we’ll go to 14 on the vertical axis, and place a mark at that height above the “A” label:
英語のヒント
手順4:では、最初の長方形を描こう。「A」の度数は14である。そこで縦軸の14まで行き、「A」のラベルの上のその高さに印をつける:
A bar chart plots a horizontal dashed line. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing frequency ranges from 3 to 15, in increments of 3. The bar chart infers the following data. A: 14.
Figure 8.8図8.8
Step 5: Then, draw vertical lines straight down from the edges of your mark to make a rectangle:
英語のヒント
手順5:次に、印の端から真下に縦線を引いて長方形を作る:
A bar chart shows a vertical bar. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing frequency ranges from 3 to 15, in increments of 3. The bar chart infers the following data. A: 14.
Figure 8.9図8.9
Step 6: Finally, we can build the rest of the rectangles, making sure that the bases all have the same length of the base = width of the rectangle, and the rectangles don’t touch. Notice that, since the frequency for “D” is zero, that category has no rectangle (but we’ll leave a space there so the reader can see that there is a category with frequency zero). Here’s the result:
英語のヒント
手順6:最後に、残りの長方形を作る。底辺がすべて同じ長さ(底辺 = 長方形の幅)になるようにし、長方形が接しないようにする。「D」の度数は0なので、そのカテゴリーには長方形がないことに注意しよう(ただし、度数0のカテゴリーがあることを読者がわかるように、そこに場所を空けておく)。結果は次のとおりである:
A bar chart plots frequency versus responses. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing frequency ranges from 3 to 15, in increments of 3. The bar graph infers the following data. A: 14; B: 4; C: 6; E: 4.
Figure 8.10図8.10
Step 7: That’s it! Now, let’s use proportions instead of frequencies. We'll label the vertical axis with evenly spaced numbers that run the full range of the percentages in our table: 0% to 50%. We can divide that into five equal parts (so that each has width 10%), and use that to label our vertical axis:
英語のヒント
手順7:これで終わりである!では、度数の代わりに割合を使おう。縦軸に、表の百分率の全範囲0%から50%にわたる等間隔の数のラベルをつける。それを5等分して(それぞれの幅は10%になる)、縦軸のラベルに使える:
A bar chart. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing percent ranges from 10 percent to 50 percent, in increments of 10.
Figure 8.11図8.11
Step 8: Then, we can fill in the rectangles just as we did before. The height of the “A” rectangle is 50%, the “B” rectangle goes up to 14.3%, “C” goes to 21.4%, there is no rectangle for “D” (since its proportion is 0%), and the “E” rectangle also goes up to 14.3%:
英語のヒント
手順8:次に、前と同じように長方形を埋められる。「A」の長方形の高さは50%で、「B」の長方形は14.3%まで、「C」は21.4%まで、「D」には(割合が0%なので)長方形がなく、「E」の長方形も14.3%までである:
A bar chart plots percent versus responses on question 1. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing percent ranges from 10 percent to 50 percent, in increments of 10. The graph infers the following data. A: 50; B: 14.3; C: 21.4; E: 14.3. Note: all values are approximate.
Figure 8.12図8.12
Step 9: Notice that the rectangles are basically identical in our two final bar charts. That’s no coincidence! Bar charts that use proportions and those that use frequencies will always look identical (which is why it doesn’t really matter much which option you choose). Here’s why: look at the bars for “B” and “C”. The frequencies for these are 4 and 6 respectively. Notice that 6 is 50% bigger than 4 (since 6=1.5×4), which means that the “C” bar will be 50% higher than the “B” bar. Now look at the same bars using proportions: since 21.4%=1.5×14.3%, the bar for “C” will be 50% higher than the bar for “B.” The same relationships hold for the other bars, too.
英語のヒント
手順9:2つの最終的な棒グラフの長方形は基本的に同じであることに注意しよう。それは偶然ではない!割合を使う棒グラフと度数を使う棒グラフは、つねに同じに見える(だからどちらを選ぶかはあまり問題にならない)。理由はこうである。「B」と「C」の棒を見よう。これらの度数はそれぞれ4と6である。6は4より50%大きい(6=1.5×4なので)ことに注意しよう。つまり「C」の棒は「B」の棒より50%高くなる。次に割合を使った同じ棒を見よう。21.4%=1.5×14.3%なので、「C」の棒は「B」の棒より50%高くなる。ほかの棒でも同じ関係が成り立つ。
A bar chart plots frequency and percent versus responses on question 1. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis on the left representing frequency ranges from 3 to 15, in increments of 3. The vertical axis on the right representing percent ranges from 10 percent to 50 percent, in increments of 10. The graph infers the following data. A: 14, 50 percent; B: 4, 14.3 percent; C: 6, 21.4 percent; E: 4, 14.3 percent. Note: all values are approximate.
Figure 8.13図8.13
In practice, most graphs are now made with computers. You can use Google Sheets, which is available for free from any web browser.
英語のヒント
実際には、今ではほとんどのグラフをコンピュータで作る。どのウェブブラウザからでも無料で使えるGoogle Sheetsを使える。
Now that we’ve explored how bar graphs are made, let’s get some practice reading bar graphs.
英語のヒント
棒グラフの作り方を調べたので、棒グラフを読む練習をしよう。
Example 8.7例題 8.7
Reading Bar Graphs棒グラフを読む
The bar graph shown gives data on 2020 model year cars available in the United States. Analyze the graph to answer the following questions.
英語のヒント
示した棒グラフは、アメリカで買える2020年モデルの車についてのデータを示している。グラフを分析して次の問いに答えよ。
A bar graph titled, 2020 model year cars available in the US. The horizontal axis represents cars. The vertical axis representing percent ranges from 0 to 50, in increments of 5. The graph infers the following data. Hatchback: 4; Minivan: 6; Sedan: 34; Sports: 10; SUV: 44; Wagon: 4. Note: all values are approximate.
Figure 8.14図8.14
(data source: consumerreports.org/cars)
英語のヒント
(データ出典:consumerreports.org/cars)
  1. What proportion of available cars were sports cars?
    英語のヒント
    買える車のうち、スポーツカーの割合はいくらか。
  2. What proportion of available cars were sedans?
    英語のヒント
    買える車のうち、セダンの割合はいくらか。
  3. Which categories of cars each made up less than 5% of the models available?
    英語のヒント
    どのカテゴリーの車が、それぞれ買えるモデルの5%未満か。
Solution解答
  1. The bar for sports cars goes up to 10%, so the proportion of models that are considered sports cars is 10%.
    英語のヒント
    スポーツカーの棒は10%まで伸びているので、スポーツカーと見なされるモデルの割合は10%である。
  2. The bar corresponding to sedan goes up past 30% but not quite to 35%. It looks like the proportion we want is between 33% and 34%.
    英語のヒント
    セダンの棒は30%を超えるが35%には届かない。求める割合は33%と34%のあいだのようである。
  3. We’re looking for the bars that don’t make it all the way to the 5% line. Those categories are hatchback and wagon.
    英語のヒント
    5%の線まで届かない棒を探している。それらのカテゴリーはハッチバックとワゴンである。

Pie Charts円グラフ

A pie chart consists of a circle divided into wedges, with each wedge corresponding to a category. The proportion of the area of the entire circle that each wedge represents corresponds to the proportion of the data in that category. Pie charts are difficult to make without technology because they require careful measurements of angles and precise circles, both of which are tasks better left to computers.
英語のヒント
円グラフは扇形に分けた円でできていて、それぞれの扇形が1つのカテゴリーに対応する。それぞれの扇形が表す円全体の面積の割合は、そのカテゴリーのデータの割合に対応する。円グラフは、角度の注意深い測定と正確な円が必要なので、計算機器なしで作るのは難しい。どちらもコンピュータに任せるのがよい作業である。
Pie charts are sometimes embellished with features like labels in the slices (which might be the categories, the frequencies in each category, or the proportions in each category) or a legend that explains which colors correspond to which categories. When making your own pie chart, you can decide which of those to include. The only rule is that there has to be some way to connect the slices to the categories (either through labels or a legend).
英語のヒント
円グラフには、切れ目のなかのラベル(カテゴリー、それぞれのカテゴリーの度数、それぞれのカテゴリーの割合など)や、どの色がどのカテゴリーに対応するかを説明する凡例のような飾りをつけることがある。自分で円グラフを作るときは、そのうちどれを入れるかを決められる。唯一の決まりは、切れ目とカテゴリーを結びつける方法(ラベルか凡例)がなければならないということである。
Example 8.8例題 8.8
Making Pie Charts円グラフを作る
Use the data that follows to generate a pie chart.
英語のヒント
次のデータを使って円グラフを作れ。
Table 8.1表8.1
(data source: www.consumerreports.org/cars)
英語のヒント
(データ出典:www.consumerreports.org/cars)
Type種類PercentパーセントType種類Percentパーセント
SUVSUV43.6%Minivanミニバン5.5%
Sedanセダン33.6%Hatchbackハッチバック3.6%
Sportsスポーツ10.0%Wagonワゴン3.6%
Solution解答
First, enter the chart above into a new sheet in Google Sheets. Next, click and drag to select the full table (including the header row). Click on the “Insert” menu, then select “Chart.” The result may be a pie chart by default; if it isn’t, you can change it to a pie chart using the “Chart type” drop-down menu in the Chart Editor.
英語のヒント
まず、上の表をGoogle Sheetsの新しいシートに入力する。次に、クリックしてドラッグし、表全体(見出しの行を含む)を選ぶ。「挿入」メニューをクリックし、「グラフ」を選ぶ。結果は初期設定で円グラフになるかもしれない。ならなければ、グラフエディタの「グラフの種類」のドロップダウンメニューを使って円グラフに変えられる。
A pie chart titled, 2020 model year cars available in the US. The circle graph infers the following data. SUV: 43.6 percentage; Sedan: 33.6 percentage; Sports: 10.0 percentage; Minivan: 5.5 percentage; Hatchback: 3.6 percentage; Wagon: 3.6 percentage.
Figure 8.15図8.15
(data source: consumerreports.org/cars)
英語のヒント
(データ出典:consumerreports.org/cars)
You can choose to use a legend to identify the categories, as well as label the slices with the relevant percentages.
英語のヒント
凡例を使ってカテゴリーを示したり、切れ目に関連する百分率のラベルをつけたりすることを選べる。