STATISTICKÁ ANALÝZA DATDaniel SvozilLaboratoř informatiky a chemie, FCHT
Vojtěch Spiwok, ÚBM, FPBT
Informace• přednášky – základy, opáčko, cvičení – R• http://ich.vscht.cz/~svozil/teaching.html• Další literatura
• D. J. Rumsey, Statistics for Dummies, 2011• D. J. Rumsey, Intermediate Statistics for Dummies, 2007
• zápočet, zkouška – bude oznámeno
Valuing houses
SIZE [ft2] COST [$]1 400 112 0002 400 192 0001 800 144 0001 900 152 0001 300 104 0001 100 88 000
How much money should you expect to pay for 1 300 ft2 house?
104 000 $
Same question now with 1 800 ft2 ?
144 000 $
Valuing houses
SIZE [ft2] COST [$]1 400 112 0002 400 192 0001 800 144 0001 900 152 0001 300 104 0001 100 88 000
How much money should you expect to pay for 2 100 ft2 house?
168 000 $21 is just a half between 18 and 24.
Same question now with 1 500 ft2 ?
120 000 $
What a statistician does?
• Look at data• Program computers• Run statistics software• Drink beer
Linear relationship
SIZE [ft2] COST [$]1 400 98 0002 400 168 0001 800 126 0001 900 133 0001 400 91 0001 100 77 000
Is there a fixed amount per square foot?
No
What if I change 1 400 to 1 300? What is the answer now?
Yes
Scatter plots• Please, take a pen and a
paper and draw a scatter plot of these data.
SIZE [ft2] COST [$]1 400 98 0002 400 168 0001 800 126 0001 900 133 0001 300 91 0001 100 77 000
SIZE
PR
ICE
Scatter plots
SIZE [ft2] COST [$]1 700 53 0002 100 65 0001 900 59 0001 300 41 0001 600 50 0002 200 68 000
Do we believe there is a fixed price per square foot?No
Scatter plots
SIZE [ft2] COST [$] $/ft2
1 700 53 000 31.17652 100 65 000 30.95241 900 59 000 31.05261 300 41 000 31.53851 600 50 000 31.25002 200 68 000 30.9091
What do you think, is the data linear?
Let’s make a scatter plot.
Surprisingly, the data is linear, even if there is no fixed price per square foot!
PRICE = ???? x SIZE + ????
PRICE = 30 x SIZE + 2 000
Scatter plots
SIZE [ft2] COST [$]1 700 53 0002 100 44 0001 900 59 0001 300 82 0001 600 50 0002 200 68 000
Draw scatterplot and tell me if these data are linear (i.e., do they lie in a line?).
outliers
Bar chart
SIZE [ft2] COST [$]1 300 88 0001 400 72 0001 600 94 0001 900 86 0002 100 112 0002 300 98 000
Warm up. Are these data linear?
No
How much to pay for a 2 200 ft2 house? Just simply interpolate.
105 000
Do you have trust in this number?
Bar chart• Take your data and pull them together.
Bar chart
SIZE [ft2] COST [$]1 300 88 0001 400 72 0001 600 94 0001 900 86 0002 100 112 0002 300 98 000
Bar chart• Much finer representation of the data• Bar chart allows you to understand global trends• Statistician uses cumulative tools (such as bar graph) to
gain the understanding of the underlying data.
Let me ask youAre bar charts cool?
Histograms• Special case of bar chart.• Bar chart looks at 2D data, histogram to 1D data. That is
the main difference.
132 784
137 192
122 177
147 121
143 000
126 010
129 200
124 312
128 132
Age distribution• Draw a histogram at the paper
with the bins by 10 years (i.e. 0-10, 11-20, …)
21
179
27
12
39
4
32
14
389
21
143
8 31
29
15
33
29
Věková pyramidavěková pyramida (strom života) grafické znázornění věkové struktury obyvatelstva
source: http://cs.wikipedia.org/wiki/V%C4%9Bkov%C3%A1_pyramida
Pie charts• koláčový graf
• elections• Party A – 50%• Party B – 50%
• Party A – 724 000 votes• Party B – 181 000 votes
• Party A – 175 000• Party B – 50 000• Party C – 25 000• Party D – 50 000
Male
Applied Admitted Rate [%]MAJOR A 900 450MAJOR B 100 10
Male
Applied Admitted Rate [%]MAJOR A 900 450 50MAJOR B 100 10
Male
Applied Admitted Rate [%]MAJOR A 900 450 50MAJOR B 100 10 10
Female
Applied Admitted Rate [%]MAJOR A 100 80MAJOR B 900 180
Female
Applied Admitted Rate [%]MAJOR A 100 80 80MAJOR B 900 180
Female
Applied Admitted Rate [%]MAJOR A 100 80 80MAJOR B 900 180 20
Gender bias
What do you think, is there a gender bias?
Who do you think is favored? Male or female?
Applied Admitted Rate [%]MAJOR A 900 450 50MAJOR B 100 10 10
Applied Admitted Rate [%]MAJOR A 100 80 80MAJOR B 900 180 20
Gender bias
Look at the data independent of major.
Applied Admitted Rate [%]MAJOR A 900 450 50MAJOR B 100 10 10
Applied Admitted Rate [%]MAJOR A 100 80 80MAJOR B 900 180 20
Statistics is ambiguous• This example ilustrates how ambiguous the statistics is.
• In choosing how to graph your data you may majorily impact what people believe to be the case.
“I never believe in statistics I didn’t doctor myself.”
Who said that?Winston Churchill