wstępna analiza danych rodzaje prezentacji danych miary

58
Statystyka Opisowa Wstępna analiza danych Rodzaje prezentacji danych Miary tendencji centralnej Miary zmienności (zróżnicowania) Miara asymetrii (skośności) Miara spłaszczenia

Upload: buithien

Post on 11-Jan-2017

221 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Wstępna analiza danych Rodzaje prezentacji danych Miary

Statystyka Opisowa

Wstępna analiza danych Rodzaje prezentacji danych Miary tendencji centralnej Miary zmienności (zróżnicowania) Miara asymetrii (skośności) Miara spłaszczenia

Page 2: Wstępna analiza danych Rodzaje prezentacji danych Miary

Statystyka to nauka o metodach badań (liczbowo wyrażalnych) własności zbiorowości.

Populacja

Próba

Próba

Próba

Page 3: Wstępna analiza danych Rodzaje prezentacji danych Miary

Populacja jest pojmowana jako zbiór wyników wszystkich pomiarów, którymi badacz jest zainteresowany. Próba jest podzbiorem wyników pomiarów wybranych z populacji. Pobierania próby dokonuje się w sposób losowy, tj. w taki sposób, żeby każda możliwa próba złożona z elementów miała taką samą szansę, że zostanie wybrana. Taką wybraną próbę nazywa się prostą próbą losową lub krócej próbą losową.

PopulacjaPróba Wnioskowanie statystyczne - przebiega

od próby do populacji

Page 4: Wstępna analiza danych Rodzaje prezentacji danych Miary

nr kontroli 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

liczba pasażerów 2 0 2 1 2 1 0 3 1 3 3 1 0 3 4 2 2 1 3 1 1 2 1 4 2

prędkość pojazdu [km/h] 64 77 51 70 69 50 72 47 93 52 60 56 63 59 58 82 60 63 65 67 61 71 66 62 68

płeć kierującego k m m m k m m k m k m k m k m m k k m m k m k k m

Przykład 1. W trakcie kontroli drogowej 25 przejeżdżających samochodów zanotowano dane: • o liczbie pasażerów - cecha mierzalna, skokowa; • o zarejestrowanej prędkości - cecha mierzalna, ciągła; • o płci kierowcy - cecha niemierzalna.

Cechy mogą być: mierzalne skokowe (np. liczba pasażerów) mierzalne ciągłe (np. prędkość pojazdu) niemierzalne (jakościowe, np. płeć)

Page 5: Wstępna analiza danych Rodzaje prezentacji danych Miary

Wykres punktowy danych o prędkości

0 10 20 30 40 50 60 70 80 90 100

Wykres punktowy danych o liczbie pasażerów

0 1 2 3 4

Wykres słupkowy danych wg płci kierowców

0

4

8

12

Kobiety Mężczyźni

1411

Page 6: Wstępna analiza danych Rodzaje prezentacji danych Miary

Zakres prędkości [km/h] y0i - y1i

Liczba samochodów ni

Częstość względna wi = ni/n

45 - 55 4 0,16

55 - 65 11 0,44

65 - 75 7 0,28

75 - 85 2 0,08

85 - 95 1 0,04

0

3

6

9

12

45-55 55-65 65-75 75-85 85-95

12

7

11

4

Page 7: Wstępna analiza danych Rodzaje prezentacji danych Miary

Pobieranie próby losowejLosowanie proste ma spełniać następujące warunki:

każda jednostka populacji ma jednakową szansę znalezienia się w próbie,

każda n-elementowa próba ma jednakową szansę bycia wylosowaną.

Istnieją dwa sposoby pobierania próby spełniające powyższe warunki:

losowanie ze zwracaniem (losowanie proste niezależne),

losowanie bez zwracania (losowanie proste zależne).

Stosuje się też inne, bardziej skomplikowane, sposoby losowania. Problemem tym zajmuje się dział statystyki zwany metodą reprezentacyjną.

Page 8: Wstępna analiza danych Rodzaje prezentacji danych Miary

Pobieranie próby losowejTworzenie wykazu wszystkich elementów populacji, tak zwanego operatu losowania.

Losowe generowanie numerów elementów z utworzonego wykazu.

Tablica liczb losowych służąca do generowania numerów57848 24074 96034 56305 49184 79215 95457 6323219942 26742 63840 35139 58715 24679 16877 4401780435 66477 49145 47892 10199 97118 17888 2061995315 29557 42060 93076 13390 75071 13279 8792121836 10822 99832 34898 51845 69402 47330 3409390641 84710 45557 91091 66259 50608 64622 75693

Page 9: Wstępna analiza danych Rodzaje prezentacji danych Miary

Miary opisowe rozkładu cechy

Miary tendencji centralnej (Średnia, Mediana, Dominanta)

Miary zróżnicowania, zmienności (Wariancja, Odchylenie standardowe, Odstęp międzykwartylowy, Współczynnik zmienności)

Miary asymetrii (Współczynnik skośności,Współczynnik asymetrii)

Miary koncentracji (Kurtoza, Współczynnik Giniego)

Page 10: Wstępna analiza danych Rodzaje prezentacji danych Miary

P-tym percentylem w zbiorze liczb uporządkowanych według wielkości jest taka wartość obserwacji, poniżej której znajduje się (co najwyżej) P% liczb z tego zbioru. Miejsce P-tego percentyla określa wzór (n+1)P/100, gdzie n jest liczbą elementów zbioru.

Pierwszy kwartyl Q1= 25-ty percentyl = wartość, poniżej której znajduje się 1/4 wyników obserwacji Drugi kwartyl (mediana) me= 50-ty percentyl = wartość, poniżej której znajduje się połowa obserwacji Trzeci kwartyl Q3= 75-ty percentyl = wartość, poniżej której znajduje się 3/4 wyników obserwacji

Page 11: Wstępna analiza danych Rodzaje prezentacji danych Miary

Przykład. Magazyn Forbes co roku publikuje listę najbogatszych osób na świecie. W roku 2007 majątek netto dwudziestu najbogatszych osób w miliardach dolarów wynosił odpowiednio:

33, 26, 24, 21, 19, 20, 18, 18, 52, 56, 27, 22, 18, 49, 22, 20, 23, 32, 20, 18. Znajdziemy 50-ty i 80-ty percentyl.

Uporządkujmy najpierw dane od najmniejszej do największej: 18, 18, 18, 18, 19, 20, 20, 20, 21, 22, 22, 23, 24, 26, 27, 32, 33, 49, 52, 56

i ponumerujmy:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

18 18 18 18 19 20 20 20 21 22 22 23 24 26 27 32 33 49 52 56

Aby wyznaczyć 50-ty percentyl musimy wyznaczyć jego miesce wg wzoru (n+1)P/100=(20+1)50/100=10,5.

Stąd odszukujemy wartość obserwacji na miejscu 10,5. 10-tą obserwacją jest 22, a 11-tą jest również 22. Zatem obserwacją, która stoi na miejscu 10,5 (w połowie między 10-tą i 11-tą) jest 22. Stąd 50-ty percentyl jest równy 22.

Page 12: Wstępna analiza danych Rodzaje prezentacji danych Miary

16,8 0,8 32 32,8

miejsce 80-tego percentyla

przesunięcie 16-tej wartości

16-ta wartość obserwacji 80-ty percentyl

Podobnie dla 80-tego percentyla

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

18 18 18 18 19 20 20 20 21 22 22 23 24 26 27 32 33 49 52 56

Page 13: Wstępna analiza danych Rodzaje prezentacji danych Miary

ŚredniaŚrednia = średnia arytmetyczna wartości wszystkich wyników obserwacji:

x =x1 + x2 + . . .+ xn

n

1. nx = x1 + x2 + . . .+ xn

2. min

16j6n{xj} 6 x 6 max

16j6n{xj}

3.

nX

j=1

(xj � x) = 0

Page 14: Wstępna analiza danych Rodzaje prezentacji danych Miary

Średnia

W obliczaniu średniej uwzględnione są wszystkie wartości obserwacji. Inaczej mówiąc, zmiana jakiejkolwiek wartości w zbiorze danych pociąga zmianę wartości średniej.

Średnia jest bardzo „wrażliwa“ na skrajne wartości obserwacji (bardzo niskie lub bardzo wysokie). Pojawienie się takich wartości znacznie obciąża wynik i ocenę tendencji centralnej

Page 15: Wstępna analiza danych Rodzaje prezentacji danych Miary

Średnia w populacjiGdy zbiór wyników obserwacji jest tożsamy z całą populacją (próbą jest populacja), to średnią oznaczamy grecką literą . Liczbę elementów populacji oznaczamy przez N nie przez n. Wówczas

µ

µ = x1 +…+ xNN

Page 16: Wstępna analiza danych Rodzaje prezentacji danych Miary

MedianaMediana (wartość środkowa) = 50-ty percentyl. Medianę oznaczamy symbolem me. Jeśli są kolejnymi uporządkowanymi rosnąco wartościami próby, to

Mediana nie jest wrażliwa na skrajne wartości.

Mediana jest lepszą miarą tendencji centralnej w przypadku rozkładów o wyraźnej asymetrii (np. rozkład dochodów obywateli)

x1,…, xn

me =x(n+1)/2 , gdy n nieparzyste(xn/2 + xn/2+1) / 2, gdy n parzyste

⎧⎨⎪

⎩⎪

Page 17: Wstępna analiza danych Rodzaje prezentacji danych Miary

DominantaDominanta (moda) w zbiorze danych jest to wartość, która w tym zbiorze występuje najczęściej.

Do wyznaczenia dominanty potrzebna jest wystarczająco duża liczba obserwacji.

Zasadniczo dominantę należy wyznaczać na podstawie danych pogrupowanych w szereg rozdzielczy o tych samych rozpiętościach.

Page 18: Wstępna analiza danych Rodzaje prezentacji danych Miary

0

1

2

3

6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

x = 15, 85 mediana=dominanta=16

Wartość 6 9 10 12 13 14 15 16 17 18 19 20 21 22 24

Częstość 1 1 1 1 1 2 1 3 2 2 1 1 1 1 1

Page 19: Wstępna analiza danych Rodzaje prezentacji danych Miary

Symetryczny zbiór wyników obserwacji

Średnia=Mediana=Dominanta

Page 20: Wstępna analiza danych Rodzaje prezentacji danych Miary

I zbiór obserwacji 1 2 3 4 5 6 6 7 8 9 10 11

II zbiór obserwacji 4 5 5 5 6 6 6 6 7 7 7 8

I zbiór - dane rozproszone - średnia = 6

0

1

2

1 2 3 4 5 6 7 8 9 10 11

II zbiór - dane skupione - średnia = 6

0

2

4

1 2 3 4 5 6 7 8 9 10 11

Page 21: Wstępna analiza danych Rodzaje prezentacji danych Miary

WariancjaWariancją w zbiorze wyników obserwacji nazywamy przeciętne kwadratowe odchylenie poszczególnych wyników od ich średniej.

Wariancja w próbies

2 =

nPi=1

(xi � x)2

n� 1

Wariancja w populacji�

2 =

NPi=1

(xi � µ)2

N

Page 22: Wstępna analiza danych Rodzaje prezentacji danych Miary

I zbiór obserwacji 1 2 3 4 5 6 6 7 8 9 10 11

II zbiór obserwacji 4 5 5 5 6 6 6 6 7 7 7 8

I zbiór - dane rozproszone, średnia = 6, wariancja = 10

0

1

2

1 2 3 4 5 6 7 8 9 10 11

II zbiór - dane skupione, średnia = 6, wariancja = 1,27

0

2

4

1 2 3 4 5 6 7 8 9 10 11

Page 23: Wstępna analiza danych Rodzaje prezentacji danych Miary

Odchylenie standardoweOdchyleniem standardowym w zbiorze wyników obserwacji nazywamy pierwiastek kwadratowy z wariancji

Odchylenie standardowe w próbie s =ps

2 =

vuuutnP

i=1(xi � x)2

n� 1

Odchylenie standardowe w populacji� =

p�

2 =

vuuutNPi=1

(xi � µ)2

N

Page 24: Wstępna analiza danych Rodzaje prezentacji danych Miary

I zbiór obserwacji 1 2 3 4 5 6 6 7 8 9 10 11

II zbiór obserwacji 4 5 5 5 6 6 6 6 7 7 7 8

I zbiór - dane rozproszone, średnia = 6, wariancja = 10, odchylenie = 3,16

0

1

2

1 2 3 4 5 6 7 8 9 10 11

II zbiór - dane skupione, średnia = 6, wariancja = 1,27, odchylenie = 1,13

0

2

4

1 2 3 4 5 6 7 8 9 10 11

Page 25: Wstępna analiza danych Rodzaje prezentacji danych Miary

RozstępRozstępem w zbiorze wyników obserwacji nazywamy różnicę między największą i najmniejszą zaobserwowaną wartością.

RozstÍp = x

max

� x

min

Page 26: Wstępna analiza danych Rodzaje prezentacji danych Miary

I zbiór - dane rozproszone, średnia = 6, wariancja = 10, odchylenie = 3,16, rozstęp = 11-1=10

0

1

2

1 2 3 4 5 6 7 8 9 10 11

II zbiór - dane skupione, średnia = 6, wariancja = 1,27, odchylenie = 1,13, rozstęp = 8-4=4

0

2

4

1 2 3 4 5 6 7 8 9 10 11

Page 27: Wstępna analiza danych Rodzaje prezentacji danych Miary

Odstęp międzykwartylowyOdstępem międzykwartylowym IQR w zbiorze wyników obserwacji nazywamy różnicę między trzecim (górnym) kwartylem Q3 i pierwszym (dolnym) kwartylem Q1.

Odchylenie ćwiartkowe Q to połowa odstępu IQR

Q = (Q3 �Q1)/2

IQR = Q3 �Q1

Page 28: Wstępna analiza danych Rodzaje prezentacji danych Miary

pozycja kwartyla 3,25 9,75 Odstęp

międzykwartylowy

nr 1 2 3 4 5 6 7 8 9 10 11 12

I zbiór obserwacji 1 2 3 4 5 6 6 7 8 9 10 11

Q1 = 3,25

Q3 = 8,75 IQR=8,75-3,25=5,5

II zbiór obserwacji 4 5 5 5 6 6 6 6 7 7 7 8

Q1 = 5 Q3 = 7 IQR=7-5=2

Page 29: Wstępna analiza danych Rodzaje prezentacji danych Miary

Skośność

Aczel−Sounderpandian: Complete Business Statistics, Seventh Edition

1. Introduction and Descriptive Statistics

Text 25© The McGraw−Hill Companies, 2009

FIGURE 1–7 Skewness of Distributions

f(x)

Symmetricdistribution Right-skewed

distribution

MeanModeMedian

Mean = Median = Mode

f(x)

Left-skeweddistribution

Symmetric distributionwith two modes

x

x

ModeModeMedian Mean = Median

ModeMean

FIGURE 1–8 Kurtosis of Distributions

f (x)

x

Leptokurticdistribution

Platykurticdistribution

always a positive number. The absolute kurtosis of a normal distribution, a famous dis-tribution about which we will learn in Chapter 4, is 3. This value of 3 is taken as thedatum to calculate the relative kurtosis. The two are related by the equation

Introduction and Descriptive Statistics 23

Relative kurtosis ! Absolute kurtosis " 3

The relative kurtosis can be negative. We will always work with relative kurtosis. Asa result, in this book, “kurtosis” means “relative kurtosis.”

A negative kurtosis implies a flatter distribution than the normal distribution, andit is called platykurtic. A positive kurtosis implies a more peaked distribution than thenormal distribution, and it is called leptokurtic. Figure 1–8 shows these examples.

Rozkład symetryczny Rozkład

prawoskośny

Rozkład lewoskośny

Rozkład symetryczny dwumodalny

Średnia = Mediana = Dominanta Dominanta Średnia

Mediana

Mediana

DominantaŚrednia Dominanta Dominanta

Średnia = Mediana

Page 30: Wstępna analiza danych Rodzaje prezentacji danych Miary

Współczynnik asymetrii w populacji

A =

NPi=1

�xi�µ

�3

N

A=0 symetryczny

A>0 prawoskośny

A<0 lewoskośny

Page 31: Wstępna analiza danych Rodzaje prezentacji danych Miary

Kurtoza (spłaszczenie)

Aczel−Sounderpandian: Complete Business Statistics, Seventh Edition

1. Introduction and Descriptive Statistics

Text 25© The McGraw−Hill Companies, 2009

FIGURE 1–7 Skewness of Distributions

f(x)

Symmetricdistribution Right-skewed

distribution

MeanModeMedian

Mean = Median = Mode

f(x)

Left-skeweddistribution

Symmetric distributionwith two modes

x

x

ModeModeMedian Mean = Median

ModeMean

FIGURE 1–8 Kurtosis of Distributions

f (x)

x

Leptokurticdistribution

Platykurticdistribution

always a positive number. The absolute kurtosis of a normal distribution, a famous dis-tribution about which we will learn in Chapter 4, is 3. This value of 3 is taken as thedatum to calculate the relative kurtosis. The two are related by the equation

Introduction and Descriptive Statistics 23

Relative kurtosis ! Absolute kurtosis " 3

The relative kurtosis can be negative. We will always work with relative kurtosis. Asa result, in this book, “kurtosis” means “relative kurtosis.”

A negative kurtosis implies a flatter distribution than the normal distribution, andit is called platykurtic. A positive kurtosis implies a more peaked distribution than thenormal distribution, and it is called leptokurtic. Figure 1–8 shows these examples.

Rozkład spiczasty Rozkład spłaszczony

Page 32: Wstępna analiza danych Rodzaje prezentacji danych Miary

Absolutny współczynnik spłaszczenia

Ka

=

NPi=1

�xi�µ

�4

N

Kurtoza względna

K = Ka � 3

K=0 spłaszczenie rozkładu normalnego

K>0 rozkład bardziej spiczasty niż normalny

K<0 rozkład bardziej spłaszczony niż normalny

Page 33: Wstępna analiza danych Rodzaje prezentacji danych Miary

Wstępna analiza danych

Jest to bogaty zestaw technik graficznych, które:

• pozwalają na wielostronne spojrzenie na dane,

• ułatwiają ustalenie trendów i zależności,

• umożliwiają wyodrębnienie wyników istotnych od nietypowych lub odizolowanych,

• pozwalają ma szybki i syntetyczny opis zbioru danych.

Page 34: Wstępna analiza danych Rodzaje prezentacji danych Miary

Zestawienie danych w formie łodyga-liście

• Pozwala na bardzo szybki wgląd w dane.

• Przypomina histogram lub operację „karbowania“.

• Wykorzystuje fakt, że posługujemy się dziesiętnym systemem liczbowym.

• Łodygą jest liczba po opuszczeniu jej ostatniej cyfry (liścia); dla liczb: 105, 106, 107, 107, 109 wykres łodyga-liście ma postać

10|56779

Page 35: Wstępna analiza danych Rodzaje prezentacji danych Miary

Zestawienie danych w formie łodyga-liście

Aczel−Sounderpandian: Complete Business Statistics, Seventh Edition

1. Introduction and Descriptive Statistics

Text32 © The McGraw−Hill Companies, 2009

FIGURE 1–16 Stem-and-Leaf Display of the TaskPerformance Times ofExample 1–8

1 1223555672 01112223467778993 0124574 112575 02366 02

Stem-and-Leaf DisplaysA stem-and-leaf display is a quick way of looking at a data set. It contains someof the features of a histogram but avoids the loss of information in a histogram thatresults from aggregating the data into intervals. The stem-and-leaf display is basedon the tallying principle: | || ||| |||| ||||; but it also uses the decimal base of our numbersystem. In a stem-and-leaf display, the stem is the number without its rightmost digit(the leaf ). The stem is written to the left of a vertical line separating the stem from theleaf. For example, suppose we have the numbers 105, 106, 107, 107, 109. We displaythem as

30 Chapter 1

FVS

10 | 56779

With a more complete data set with different stem values, the last digit of each num-ber is displayed at the appropriate place to the right of its stem digit(s). Stem-and-leaf displays help us identify, at a glance, numbers in our data set that have highfrequency. Let’s look at an example.

Virtual reality is the name given to a system of simulating real situations on a computerin a way that gives people the feeling that what they see on the computer screen isa real situation. Flight simulators were the forerunners of virtual reality programs. Aparticular virtual reality program has been designed to give production engineers expe-rience in real processes. Engineers are supposed to complete certain tasks as responsesto what they see on the screen. The following data are the time, in seconds, it took agroup of 42 engineers to perform a given task:

11, 12, 12, 13, 15, 15, 15, 16, 17, 20, 21, 21, 21, 22, 22, 22, 23, 24, 26, 27, 27, 27, 28, 29, 29,30, 31, 32, 34, 35, 37, 41, 41, 42, 45, 47, 50, 52, 53, 56, 60, 62

Use a stem-and-leaf display to analyze these data.

The data are already arranged in increasing order. We see that the data are in the 10s,20s, 30s, 40s, 50s, and 60s. We will use the first digit as the stem and the second digit ofeach number as the leaf. The stem-and-leaf display of our data is shown in Figure 1–16.

As you can see, the stem-and-leaf display is a very quick way of arranging thedata in a kind of a histogram (turned sideways) that allows us to see what the datalook like. Here, we note that the data do not seem to be symmetrically distributed;rather, they are skewed to the right.

We may feel that this display does not convey very much information becausethere are too many values with first digit 2. To solve this problem, we may split thegroups into two subgroups. We will denote the stem part as 1* for the possible num-bers 10, 11, 12, 13, 14 and as 1. for the possible numbers 15, 16, 17, 18, 19. Similarly, thestem 2* will be used for the possible numbers 20, 21, 22, 23, and 24; stem 2. will beused for the numbers 25, 26, 27, 28, and 29; and so on for the other numbers. Ourstem-and-leaf diagram for the data of Example 1–8 using this convention is shown inFigure 1–17. As you can see from the figure, we now have a more spread-out histogramof the data. The data still seem skewed to the right.

If desired, a further refinement of the display is possible by using the symbol * fora stem followed by the leaf values 0 and 1; the symbol t for leaf values 2 and 3; thesymbol f for leaf values 4 and 5; s for 6 and 7; and . for 8 and 9. Also, the class con-taining the median observation is often denoted with its stem value in parentheses.

E X A M P L E 1 – 8

S o l u t i o n

CHAPTER 1

Aczel−Sounderpandian: Complete Business Statistics, Seventh Edition

1. Introduction and Descriptive Statistics

Text32 © The McGraw−Hill Companies, 2009

FIGURE 1–16 Stem-and-Leaf Display of the TaskPerformance Times ofExample 1–8

1 1223555672 01112223467778993 0124574 112575 02366 02

Stem-and-Leaf DisplaysA stem-and-leaf display is a quick way of looking at a data set. It contains someof the features of a histogram but avoids the loss of information in a histogram thatresults from aggregating the data into intervals. The stem-and-leaf display is basedon the tallying principle: | || ||| |||| ||||; but it also uses the decimal base of our numbersystem. In a stem-and-leaf display, the stem is the number without its rightmost digit(the leaf ). The stem is written to the left of a vertical line separating the stem from theleaf. For example, suppose we have the numbers 105, 106, 107, 107, 109. We displaythem as

30 Chapter 1

FVS

10 | 56779

With a more complete data set with different stem values, the last digit of each num-ber is displayed at the appropriate place to the right of its stem digit(s). Stem-and-leaf displays help us identify, at a glance, numbers in our data set that have highfrequency. Let’s look at an example.

Virtual reality is the name given to a system of simulating real situations on a computerin a way that gives people the feeling that what they see on the computer screen isa real situation. Flight simulators were the forerunners of virtual reality programs. Aparticular virtual reality program has been designed to give production engineers expe-rience in real processes. Engineers are supposed to complete certain tasks as responsesto what they see on the screen. The following data are the time, in seconds, it took agroup of 42 engineers to perform a given task:

11, 12, 12, 13, 15, 15, 15, 16, 17, 20, 21, 21, 21, 22, 22, 22, 23, 24, 26, 27, 27, 27, 28, 29, 29,30, 31, 32, 34, 35, 37, 41, 41, 42, 45, 47, 50, 52, 53, 56, 60, 62

Use a stem-and-leaf display to analyze these data.

The data are already arranged in increasing order. We see that the data are in the 10s,20s, 30s, 40s, 50s, and 60s. We will use the first digit as the stem and the second digit ofeach number as the leaf. The stem-and-leaf display of our data is shown in Figure 1–16.

As you can see, the stem-and-leaf display is a very quick way of arranging thedata in a kind of a histogram (turned sideways) that allows us to see what the datalook like. Here, we note that the data do not seem to be symmetrically distributed;rather, they are skewed to the right.

We may feel that this display does not convey very much information becausethere are too many values with first digit 2. To solve this problem, we may split thegroups into two subgroups. We will denote the stem part as 1* for the possible num-bers 10, 11, 12, 13, 14 and as 1. for the possible numbers 15, 16, 17, 18, 19. Similarly, thestem 2* will be used for the possible numbers 20, 21, 22, 23, and 24; stem 2. will beused for the numbers 25, 26, 27, 28, and 29; and so on for the other numbers. Ourstem-and-leaf diagram for the data of Example 1–8 using this convention is shown inFigure 1–17. As you can see from the figure, we now have a more spread-out histogramof the data. The data still seem skewed to the right.

If desired, a further refinement of the display is possible by using the symbol * fora stem followed by the leaf values 0 and 1; the symbol t for leaf values 2 and 3; thesymbol f for leaf values 4 and 5; s for 6 and 7; and . for 8 and 9. Also, the class con-taining the median observation is often denoted with its stem value in parentheses.

E X A M P L E 1 – 8

S o l u t i o n

CHAPTER 1

Page 36: Wstępna analiza danych Rodzaje prezentacji danych Miary

Wykres pudełkowy (box plot)Wykres pudełkowy jest obrazem następujących pięciu charakterystyk rozkładu danych: • mediana, • dolny kwartyl Q1, • górny kwartyl Q3, • najmniejszy wynik obserwacji, • największy wynik obserwacji.

Page 37: Wstępna analiza danych Rodzaje prezentacji danych Miary

Aczel−Sounderpandian: Complete Business Statistics, Seventh Edition

1. Introduction and Descriptive Statistics

Text34 © The McGraw−Hill Companies, 2009

FIGURE 1–19 The Box Plot

IQR

X X

Whisker Whisker

Median

Largestobservationwithin 1.5(IQR)of upper hinge

Upperquartile(hinge)

Lowerquartile(hinge)

Smallestobservationwithin 1.5(IQR)of lower hinge

FIGURE 1–20 The Elements of a Box Plot

O X X *

Outlier

Smallestdata point not below inner fence Half the data are

within the box

Largest data point not exceedinginner fence Suspected

outlier

Outer fenceQ

L – 3(IQR)

Inner fenceQ

L – 1.5(IQR)

Median

IQR

QL

QU

Inner fenceQ

U + 1.5(IQR)

Outer fenceQ

U + 3(IQR)

Second, the whiskers of the box plot are made by extending a line from the upperquartile to the largest observation and from the lower quartile to the smallest observa-tion, only if the largest and smallest observations are within a distance of 1.5 times theinterquartile range from the appropriate hinge (quartile). If one or more observationsare farther away than that distance, they are marked as suspected outliers. If theseobservations are at a distance of over 3 times the interquartile range from the appro-priate hinge, they are marked as outliers. The whisker then extends to the largest orsmallest observation that is at a distance less than or equal to 1.5 times the interquar-tile range from the hinge.

Let us make these definitions clearer by using a picture. Figure 1–19 shows the partsof a box plot and how they are defined. The median is marked as a vertical line acrossthe box. The hinges of the box are the upper and lower quartiles (the rightmost andleftmost sides of the box). The interquartile range (IQR) is the distance from theupper quartile to the lower quartile (the length of the box from hinge to hinge): IQR !Q U " Q L. We define the inner fence as a point at a distance of 1.5(IQR) above theupper quartile; similarly, the lower inner fence is Q L " 1.5(IQR). The outer fencesare defined similarly but are at a distance of 3(IQR) above or below the appropriatehinge. Figure 1–20 shows the fences (these are not shown on the actual box plot; theyare only guidelines for defining the whiskers, suspected outliers, and outliers) anddemonstrates how we mark outliers.

32 Chapter 1

Mediana

WąsWąs

Największy wynik obserwacji w

granicach 1,5 IQR od Q3

Najmniejszy wynik obserwacji w

granicach 1,5 IQR od Q1

Q1 Q3

Page 38: Wstępna analiza danych Rodzaje prezentacji danych Miary

Aczel−Sounderpandian: Complete Business Statistics, Seventh Edition

1. Introduction and Descriptive Statistics

Text34 © The McGraw−Hill Companies, 2009

FIGURE 1–19 The Box Plot

IQR

X X

Whisker Whisker

Median

Largestobservationwithin 1.5(IQR)of upper hinge

Upperquartile(hinge)

Lowerquartile(hinge)

Smallestobservationwithin 1.5(IQR)of lower hinge

FIGURE 1–20 The Elements of a Box Plot

O X X *

Outlier

Smallestdata point not below inner fence Half the data are

within the box

Largest data point not exceedinginner fence Suspected

outlier

Outer fenceQ

L – 3(IQR)

Inner fenceQ

L – 1.5(IQR)

Median

IQR

QL

QU

Inner fenceQ

U + 1.5(IQR)

Outer fenceQ

U + 3(IQR)

Second, the whiskers of the box plot are made by extending a line from the upperquartile to the largest observation and from the lower quartile to the smallest observa-tion, only if the largest and smallest observations are within a distance of 1.5 times theinterquartile range from the appropriate hinge (quartile). If one or more observationsare farther away than that distance, they are marked as suspected outliers. If theseobservations are at a distance of over 3 times the interquartile range from the appro-priate hinge, they are marked as outliers. The whisker then extends to the largest orsmallest observation that is at a distance less than or equal to 1.5 times the interquar-tile range from the hinge.

Let us make these definitions clearer by using a picture. Figure 1–19 shows the partsof a box plot and how they are defined. The median is marked as a vertical line acrossthe box. The hinges of the box are the upper and lower quartiles (the rightmost andleftmost sides of the box). The interquartile range (IQR) is the distance from theupper quartile to the lower quartile (the length of the box from hinge to hinge): IQR !Q U " Q L. We define the inner fence as a point at a distance of 1.5(IQR) above theupper quartile; similarly, the lower inner fence is Q L " 1.5(IQR). The outer fencesare defined similarly but are at a distance of 3(IQR) above or below the appropriatehinge. Figure 1–20 shows the fences (these are not shown on the actual box plot; theyare only guidelines for defining the whiskers, suspected outliers, and outliers) anddemonstrates how we mark outliers.

32 Chapter 1

Obserwacja nietypowa

Obserwacja podejrzana

o nietypowość

Najmniejszy wynik obserwacji wewnątrz płotka wewnętrznego

Największy wynik obserwacji wewnątrz płotka wewnętrznego

Wyniki obserwacji mieszczące się w pudełku

Mediana

Płotek zewnętrzny Q1 - 3 IQR

Płotek zewnętrzny Q3 + 3 IQR

Płotek wewnętrzny Q1 - 1,5 IQR

Płotek wewnętrzny Q3 + 1,5 IQRQ1 Q3

Page 39: Wstępna analiza danych Rodzaje prezentacji danych Miary

Wykres pudełkowy (box plot)Wykres pudełkowy pomaga: • zlokalizować zbiór danych wokół jego podstawowej

charakterystyki, jaką jest mediana, • zidentyfikować rozproszenie danych biorąc pod

uwagę długość pudełka reprezentującą wielkość IQR i długość wąsów reprezentującą rozstęp między wynikami obserwacji, bez brania pod uwagę wyników nietypowych lub podejrzanych o nietypowość,

• zidentyfikować ewentualną skośność rozkładu danych, • zidentyfikować wyniki nietypowe, • porównać dwa zbiory danych.

Page 40: Wstępna analiza danych Rodzaje prezentacji danych Miary

Aczel−Sounderpandian: Complete Business Statistics, Seventh Edition

1. Introduction and Descriptive Statistics

Text 35© The McGraw−Hill Companies, 2009

FIGURE 1–21 Box Plots and Their Uses

Right-skewed

Left-skewed

Symmetric

Small variance

Suspected outlier*

Innerfence

Outerfence

Data sets A and B seem to be similar;sets C and D are not similar.

A

B

C

D

Outlier

Box plots are very useful for the following purposes.

1. To identify the location of a data set based on the median.2. To identify the spread of the data based on the length of the box, hinge to

hinge (the interquartile range), and the length of the whiskers (the range of thedata without extreme observations: outliers or suspected outliers).

3. To identify possible skewness of the distribution of the data set. If the portionof the box to the right of the median is longer than the portion to the left of themedian, and/or the right whisker is longer than the left whisker, the data areright-skewed. Similarly, a longer left side of the box and/or left whisker impliesa left-skewed data set. If the box and whiskers are symmetric, the data aresymmetrically distributed with no skewness.

4. To identify suspected outliers (observations beyond the inner fences but withinthe outer fences) and outliers (points beyond the outer fences).

5. To compare two or more data sets. By drawing a box plot for each data set anddisplaying the box plots on the same scale, we can compare several data sets.

A special form of a box plot may even be used for conducting a test of the equalityof two population medians. The various uses of a box plot are demonstrated inFigure 1–21.

Let us now construct a box plot for the data of Example 1–8. For this data set, themedian is 27, and we find that the lower quartile is 20.75 and the upper quartile is 41.The interquartile range is IQR ! 41 " 20.75 ! 20.25. One and one-half times this dis-tance is 30.38; hence, the inner fences are "9.63 and 71.38. Since no observation liesbeyond either point, there are no suspected outliers and no outliers, so the whiskersextend to the extreme values in the data: 11 on the left side and 62 on the right side.

As you can see from the figure, there are no outliers or suspected outliers in thisdata set. The data set is skewed to the right. This confirms our observation of theskewness from consideration of the stem-and-leaf diagrams of the same data set, inFigures 1–16 to 1–18.

Introduction and Descriptive Statistics 33

Prawoskośny

Lewoskośny

Symetryczny

Mała wariancja

Obserwacja podejrzana

Płotek wewnętrzny

Płotek zewnętrzny

Obserwacja nietypowa

Zbiory danych A i B są podobne; zbiory danych C i D nie są podobne

Page 41: Wstępna analiza danych Rodzaje prezentacji danych Miary

Szereg rozdzielczyJest to zbiorowość wyników obserwacji podzielona na klasy według określonej cechy jakościowej lub ilościowej z podaniem liczebności każdej z wyodrębnionych klas.

Histogram to wykres utworzony ze słupków o różnej wysokości. Wysokość słupka reprezentuje częstość, z jaką pojawiały się wyniki obserwacji należące do klasy reprezentowanej przez słupek.

Page 42: Wstępna analiza danych Rodzaje prezentacji danych Miary

0 100 197 284 309 405 5900 100 197 284 309 410 595

12 111,5 197,50 284,50 334,50 410 59813 112,5 197,50 284,50 334,50 410 599

13,50 113,00 197,50 284,50 334,50 42014 113,5 198 285 335 425,50

14,99 114,49 199 286 336 43115 114,5 199 286 336 436,515 114,5 200 287 337 44215 114,5 200 287 337 447,5

15,50 115,00 200 287 337 45315,50 115,00 201,00 288,00 338,00 458,515,75 115,25 201,25 288,25 338,25 46015,90 115,40 201,40 288,40 348,40 47915,90 115,40 201,40 288,40 348,40 48015,90 115,40 201,40 288,40 348,40 490

16 115,5 201,5 288,5 348,5 490,9016 115,5 201,5 288,5 348,5 490,90

17,20 116,70 202,70 289,70 349,70 490,9017,20 116,70 202,70 289,70 349,70 49917,50 117,00 203,00 290,00 350,00 499,99

20 117,5 203,5 290,5 370,5 50025 122,5 203,5 290,5 370,5 51550 147,5 228,5 298,5 378,5 52555 152,5 233,5 299 379 55070 167,5 248,5 299 379 55580 177,5 258,5 299,90 379,90 56090 187,5 268,5 299,99 379,99 57595 192,5 273,5 300 380 58099 196,5 277,5 305 401 590

Page 43: Wstępna analiza danych Rodzaje prezentacji danych Miary

0

150

300

450

600

1 50 184

Page 44: Wstępna analiza danych Rodzaje prezentacji danych Miary

0 100 197 284 309 405 5900 100 197 284 309 410 595

12 111,5 197,50 284,50 334,50 410 59813 112,5 197,50 284,50 334,50 410 599

13,50 113,00 197,50 284,50 334,50 42014 113,5 198 285 335 425,50

14,99 114,49 199 286 336 43115 114,5 199 286 336 436,515 114,5 200 287 337 44215 114,5 200 287 337 447,5

15,50 115,00 200 287 337 45315,50 115,00 201,00 288,00 338,00 458,515,75 115,25 201,25 288,25 338,25 46015,90 115,40 201,40 288,40 348,40 47915,90 115,40 201,40 288,40 348,40 48015,90 115,40 201,40 288,40 348,40 490

16 115,5 201,5 288,5 348,5 490,9016 115,5 201,5 288,5 348,5 490,90

17,20 116,70 202,70 289,70 349,70 490,9017,20 116,70 202,70 289,70 349,70 49917,50 117,00 203,00 290,00 350,00 499,99

20 117,5 203,5 290,5 370,5 50025 122,5 203,5 290,5 370,5 51550 147,5 228,5 298,5 378,5 52555 152,5 233,5 299 379 55070 167,5 248,5 299 379 55580 177,5 258,5 299,90 379,90 56090 187,5 268,5 299,99 379,99 57595 192,5 273,5 300 380 58099 196,5 277,5 305 401 590

Page 45: Wstępna analiza danych Rodzaje prezentacji danych Miary

Klasa wydatków x Częstość, liczba klientów f(x)

0 ≤ x < 100 30

100 ≤ x < 200 38

200 ≤ x < 300 50

300 ≤ x < 400 31

400 ≤ x < 500 22

500 ≤ x < 600 13

Razem 184

Klasa wydatków x Częstość względna

0 ≤ x < 100 30/184 = 0,163

100 ≤ x < 200 38/184 = 0,207

200 ≤ x < 300 50/184 = 0,272

300 ≤ x < 400 31/184 = 0,168

400 ≤ x < 500 22/184 = 0,120

500 ≤ x < 600 13/184 = 0,070

Razem 1,000

Page 46: Wstępna analiza danych Rodzaje prezentacji danych Miary

Histogram częstości absolutnych

Czę

stoś

ć

0

12,5

25

37,5

50

Wydatki klientów w dolarachOd 0 do 100 Od 100 do 200 Od 200 do 300 Od 300 do 400 Od 400 do 500 Od 500 do 600

Page 47: Wstępna analiza danych Rodzaje prezentacji danych Miary

Histogram częstości względnych

Czę

stoś

ć w

zglę

dna

0

0,1

0,2

0,3

Wydatki klientów w dolarachOd 0 do 100 Od 100 do 200 Od 200 do 300 Od 300 do 400 Od 400 do 500 Od 500 do 600

Page 48: Wstępna analiza danych Rodzaje prezentacji danych Miary

Ustalenie liczby klas - k

k ≈ nk ≈1+ 3,322 lognk ≈ 184 ≈14k ≈1+ 3,322 log10184 ≈ 9

Page 49: Wstępna analiza danych Rodzaje prezentacji danych Miary

Klasa wydatków x Częstość, liczba klientów f(x)0 ≤ x < 50 23

50 ≤ x < 100 7100 ≤ x < 150 24150 ≤ x < 200 14200 ≤ x < 250 18250 ≤ x < 300 32300 ≤ x < 350 22350 ≤ x < 400 9400 ≤ x < 450 11450 ≤ x < 500 11500 ≤ x < 550 3550 ≤ x < 600 10

Razem 184

Page 50: Wstępna analiza danych Rodzaje prezentacji danych Miary

Histogram częstości absolutnychC

zęst

ość

0

10

20

30

40

Wydatki klientów w dolarach

Od 0 do 5

0

Od 50 do 1

00

Od 100 d

o 150

Od 150 d

o 200

Od 200 d

o 250

Od 250 d

o 300

Od 300 d

o 350

Od 350 d

o 400

Od 400 d

o 450

Od 450 d

o 500

Od 500 d

o 550

Od 550 d

o 600

Page 51: Wstępna analiza danych Rodzaje prezentacji danych Miary

Klasa dominującaTo klasa, do której częstość należenia jest największa.

Histogram częstości absolutnych

Czę

stoś

ć

0

12,5

25

37,5

50

Wydatki klientów w dolarachOd 0 do 100 Od 100 do 200 Od 200 do 300 Od 300 do 400 Od 400 do 500 Od 500 do 600

klasa dominująca: od 200 do mniej niż 300

Page 52: Wstępna analiza danych Rodzaje prezentacji danych Miary

Klasa medialnaMedianą w zbiorze danych pogrupowanych jest taka wartość na osi poziomej, która dzieli powierchnię histogramu na dwie równe części.

Histogram częstości absolutnych

Czę

stoś

ć

0

12,5

25

37,5

50

Wydatki klientów w dolarachOd 0 do 100 Od 100 do 200 Od 200 do 300 Od 300 do 400 Od 400 do 500 Od 500 do 600

50% 50%

Page 53: Wstępna analiza danych Rodzaje prezentacji danych Miary

Klasa medialnaKlasą medialną jest klasa zawierająca medianę.

Histogram częstości absolutnych

Czę

stoś

ć

0

12,5

25

37,5

50

Wydatki klientów w dolarachOd 0 do 100 Od 100 do 200 Od 200 do 300 Od 300 do 400 Od 400 do 500 Od 500 do 600

Page 54: Wstępna analiza danych Rodzaje prezentacji danych Miary

Klasa medialnaMedianę dla pogrupowanych danych szacuje się wg wzoru:

L + ( j/f )W, gdzie: • L - dolna granica klasy medialnej, • f - liczebność klasy medialnej, • W - rozpiętość przedziału wartości odpowiadającego

klasie medialnej, • j - liczba danych, które trzeba minąć po osiągnięciu L, żeby dojść do mediany.

Miejsce mediany = (n+1)/2 = 185/2 = 92,5

Page 55: Wstępna analiza danych Rodzaje prezentacji danych Miary

Klasa medialnaMedianę dla pogrupowanych danych szacuje się wg wzoru:

L + ( j/f )W, gdzie: • L - dolna granica klasy medialnej, • f - liczebność klasy medialnej, • W - rozpiętość przedziału wartości odpowiadającego klasie medialnej, • j - liczba danych, które trzeba minąć po osiągnięciu L, żeby dojść do mediany.

Miejsce mediany = (n+1)/2 = 185/2 = 92,5

Klasa wydatków x Częstość

0 ≤ x < 100 30

100 ≤ x < 200 38

200 ≤ x < 300 50

300 ≤ x < 400 31

400 ≤ x < 500 22

500 ≤ x < 600 13

Razem 184

30+38=6830+38+50=118

Klasa medialna: od 200 do mniej niż 300.

68<92,5<118

Page 56: Wstępna analiza danych Rodzaje prezentacji danych Miary

Klasa medialnaMedianę dla pogrupowanych danych szacuje się wg wzoru:

L + ( j/f )W, gdzie: • L - dolna granica klasy medialnej, • f - liczebność klasy medialnej, • W - rozpiętość przedziału wartości odpowiadającego klasie medialnej, • j - liczba danych, które trzeba minąć po osiągnięciu L, żeby dojść do mediany.

Klasa wydatków x Częstość

0 ≤ x < 100 30

100 ≤ x < 200 38

200 ≤ x < 300 50

300 ≤ x < 400 31

400 ≤ x < 500 22

500 ≤ x < 600 13

Razem 184

Klasa medialna: od 200 do mniej niż 300.

L = 200, f = 50, W = 100, j = 92,5 - 68 = 24,5

me = L + ( j/f )W = 249

Page 57: Wstępna analiza danych Rodzaje prezentacji danych Miary

Średnia i wariancjaŚrednią i wariancję dla pogrupowanych danych szacuje się wg wzorów:

gdzie: • k - liczba wyróżnionych klas, • - częstość (liczebność) klasy o numerze i, • - środek i-tej klasy.

x =fimi

i=1

k

∑n s2 =

fi (mi )2

i=1

k

∑ − nx 2

n −1

fimi

Page 58: Wstępna analiza danych Rodzaje prezentacji danych Miary

Średnia i wariancja

x =fimi

i=1

k

∑n

s2 =fi (mi )

2

i=1

k

∑ − nx 2

n −1

Klasa wydatków x Częstość

0 ≤ x < 100 30

100 ≤ x < 200 38

200 ≤ x < 300 50

300 ≤ x < 400 31

400 ≤ x < 500 22

500 ≤ x < 600 13

Razem 184

x = 30 ⋅50 + 38 ⋅150 +…+13⋅550184

= 258,70

s2 = 30 ⋅502 + 38 ⋅1502 +…+13⋅5502 −184 ⋅258,702

184 −1= 21454,03

s = s2 = 21454,03 = 146,47