Statisti sis thes ien eof olle ting,organizingandinterpretingthedata.
1. Thedieren ebetweenProbabilityandStatisti s
(a) PopulationvsSample
(b) populationmeanandpopulationvarian eandstandarddeviation.
i. Measuring enter: themean(
µ, x ¯
),median (M
),modeii. Measuringspread: thequartiles,thepth per entile,
Q 1 andQ 3,
theinterquartilerange(IQR)
iii. Theve-numbersummary andboxplots
mean(x);var(x), median(x), quantile(x,0.25),
( ) Skewtoright,Skew toleft,symmetri ;
(d) The(100p)thper entileof adistribution isoften alledthequantile
oforder
p
.q-q quantile-quantileplot,weexpe tthepoints
(y r , ˜ π r )
lie losetoalinethroughtheoriginwithslopequalto1. (ex 3.2-7,3.5-4)
2. Displayingdatawithgraphs: barplot,pie hart,(ordered)stem-and-leaf
plot,histograms,
3. Somebasi R ommands
barand pie hart
>pie.sales<- (0.12, 0.3,0.26,0.16,0.04,0.12)# orpie.sales=s an()
>names(pie.sales)<- ("Blueberry","Cherry","Apple","BostonCream",
"Other","VanillaCream")
>barplot(pie.sales)
>pie(pie.sales)
>stem(pie.sales)
histograms(ex 3.1Mark M Gwire's HomeRuns)
>x= (364,368,364,419,424,347,462,419,437,419,
+371,362,358,527,381,545,478,440,471,451,
+425,366,477,397,433,388,423,409,356,409,
+438,437,449,433,461,431,472,485,405,415,
+511,425,458,452,408,374,464,398,409,369,
+385,477,393,509,501,450,472,497,458,381,
+430,341,385,417,423,375,403,435,377,370)
>plot(x)
>mean(x)
>var(x)
>sqrt(var(x))
>summary(x)
341.0385.0423.0423.8456.5545.0
>venum(x)
[1℄341385423458545
>stem(x)
Thede imalpointis1digit(s)to therightofthe|
34|1768
36|24468901457
38|11558378
40|35899957999
42|3345501335778
44|0901288
46|124122778
48|57
50|191
52|7
54|5
>par(mfrow= (2,2))
>hist(x)
>hist(x,br=seq(337.5,547.5,30))
>hist(x,br=seq(337.5,547.5,30),prob=TRUE)
>hist(x,br=20)
>par(mfrow= (1,1))
>hist(x,br=seq(337.5,547.5,30),prob=TRUE)
>lines(density(x), ol="red")# adensityestimateofx
>rug(x)
q-q plot
>qqnorm(x) #quantilesof xwith respe tto thevaluesof expe ted under
anormallaw
>qqline(x, ol=2) #drawaline withslop=1
>qqplot(y,x);abline(0,1, ol=2)#quantilesofxw.r.t. thequantilesofy
Histogram of x
x
Frequency
350 400 450 500 550
0 2 4 6 8 10 12 14
Histogram of x
x
Frequency
350 400 450 500 550
0 5 10 15
Histogram of x
x
Density
350 400 450 500 550
0.000 0.002 0.004 0.006 0.008
Histogram of x
x
Frequency
350 400 450 500 550
0 2 4 6 8
Figure1: Exampleforhistogram
−2 −1 0 1 2
350 400 450 500 550
Normal Q−Q Plot
Theoretical Quantiles
Sample Quantiles
Figure2: q-qnormalplot