# # Chapter 16. Statistics # # # 16.1 Introduction # # # # MAPLE SESSION 1 # > with(stats); # # 16.2 Data Sets # # # # MAPLE SESSION 2 # > with(stats): > data1 := importdata("data1.dat",2): # # # MAPLE SESSION 3 # > life := data1[1]: > amount := data1[2]: # # # MAPLE SESSION 4 # > example_dataset := [10, 20, 30, 30, 30, missing]; # # # MAPLE SESSION 5 # > example_dataset:=[10,20, Weight(30,3), missing]; # # # MAPLE SESSION 6 # > describe[count](life); > describe[count](example_dataset); # # # MAPLE SESSION 7 # > describe[countmissing](life); > describe[countmissing](example_dataset); # # 16.3 Numerical methods for describing data # 16.3.1 Describing the center of a data set # # # # MAPLE SESSION 8 # > with(stats): > data1:=importdata("data1.dat",2): > life:=data1[1]: > amount:=data1[2]: > describe[mean](life); > describe[mean](amount); # # # MAPLE SESSION 9 # > describe[mean]([10, 20, 30, 30, 30, missing]); # # # MAPLE SESSION 10 # > describe[median](life); > describe[median](amount); > describe[median]([10, 20, 30]); > describe[median]([10, 20, 30, 40]); # # # MAPLE SESSION 11 # > describe[mean]([10, 20, 30, 40]), > describe[mean]([10, 20, 30, 1000]); > describe[median]([10, 20, 30, 40]), > describe[median]([10, 20, 30, 1000]); # # # MAPLE SESSION 12 # > with(stats): > describe[mode]([10, 20, 30, 30, 30, missing]); # # # MAPLE SESSION 13 # > with(stats): > H := describe[harmonicmean]([10, 20, 30, 30, 30, missing]); > G := describe[geometricmean]([10, 20, 30, 30, 30, missing]); > Q := describe[quadraticmean]([10, 20, 30, 30, 30, missing]); # # 16.3.2 Describing the dispersion of a data set # # # # MAPLE SESSION 14 # > with(stats): > describe[range]([10, 20, 30, 30, 30, missing]); # # # MAPLE SESSION 15 # > with(stats): > describe[variance[1]]([10, 20, 30, 30, 30, missing]); # # # MAPLE SESSION 16 # > with(stats): > describe[variance [0]]([1, 0,-1]), > describe[variance[1]]([1,0,-1]); # # # MAPLE SESSION 17 # > with(stats): > describe[standarddeviation[1]]([10, 20, 30, 30, 30, missing]); # # # MAPLE SESSION 18 # > with(stats): > describe[standarddeviation[0]]([1, 0,-1]), > describe[standarddeviation[1]]([1,0, > -1]); # # # MAPLE SESSION 19 # > with(stats): > data1:=importdata("data1.dat",2): > life:=data1[1]: > describe[range](life); > describe[variance[1]](life); > describe[standarddeviation[1]](life); # # # MAPLE SESSION 20 # > with(stats): > describe[meandeviation]([10, 20, 30, 30, 30, missing]); # # # MAPLE SESSION 21 # > with(stats): > describe[percentile[37]]([seq(i,i=1..100)]); > describe[percentile[50]]([seq(i,i=1..100)]), > describe[median]([seq(i,i=1..100)]); # # # MAPLE SESSION 22 # > with(stats): > describe[decile[6]]([70,10,80,20,30,40,100,50,60,90]); > describe[percentile[2]]([seq(i,i=1..100)]), > describe[percentile[20]]([seq(i,i=1..100)]), > describe[decile[2]]([seq(i,i=1..100)]); # # # MAPLE SESSION 23 # > with(stats): > describe[quantile[1/2]]([1,2,3]); > describe[quantile[1/2,1/2]]([1,2,3])= > describe[median]([1,2,3]); > describe[percentile[20]]([seq(i,i=1..100)])= > describe[quantile[20/100]]([seq(i,i=1..100)]); > describe[percentile[21]]([seq(i,i=1..100)]), > describe[quantile[20/100,.9]]([seq(i,i=1..100)]); # # # MAPLE SESSION 24 # > with(stats): > describe[quartile[1]]([seq(i,i=1..100)])= > describe[percentile[25]]([seq(i,i=1..100)]); > describe[quartile[2]]([seq(i,i=1..100)])= > describe[percentile[50]]([seq(i,i=1..100)]); > describe[median]([seq(i,i=1..100)]); > describe[quartile[3]]([seq(i,i=1..100)])= > describe[percentile[75]]([seq(i,i=1..100)]); # # # MAPLE SESSION 25 # > with(stats): > IQR1 := describe[quartile[3]]([10, 20, 30, 40]) > - describe[quartile[1]]([10, 20,30, 40]); > IQR2 := describe[quartile[3]]([10, 20, 30, 1000]) > - describe[quartile[1]]([10, 20, 30, 1000]); # # 16.3.3 Describing characteristics of a data set # # # # MAPLE SESSION 26 # > with(stats): > describe[moment[3,0,1]]([10,20,30])=(1/2)*(10^3+20^3+30^3); > describe[moment[4,20,1]]([10,20,30])= > describe[moment[4,mean,1]]([10,20,30]); # # # MAPLE SESSION 27 # > with(stats): > describe[moment[3]]([10,20,30])=(1/3)*(10^3+20^3+30^3); # # # MAPLE SESSION 28 # > with(stats): > describe[sumdata[3]]([10,20,30])=(10^3+20^3+30^3); > describe[sumdata]([10,20,30])=(10+20+30); > 3*describe[moment[4,1,0]]([10,20,30]) > = describe[sumdata[4,1]]([10,20,30]); > `` = ( (10-1)^4+(20-1)^4+(30-1)^4 ); # # # MAPLE SESSION 29 # > with(stats): > describe[skewness[1]]([-1,0,1]); > describe[skewness[1]]([-1,0,1000]): > evalf(%); # # # MAPLE SESSION 30 # > with(stats): > describe[skewness[1]]([-1000,0,1]): > sk1 := evalf(%); > describe[skewness[0]]([-1000,0,1]): > sk2 := evalf(%); > describe[skewness]([-1000,0,1]): > sk3 := evalf(%); > sk1 <> sk2; > `` = sk3; # # # MAPLE SESSION 31 # > with(stats): > data1:=importdata("data1.dat",2): > life:=data1[1]: > amount:=data1[2]: > describe[skewness[1]](life),describe[skewness[1]](amount); # # # MAPLE SESSION 32 # > describe[kurtosis[1]](life), describe[kurtosis[1]](amount); # # # MAPLE SESSION 33 # > with(stats): > describe[standarddeviation[1]]([10,20,30]) > = describe[standarddeviation[1]]([110,120,130]); # # # MAPLE SESSION 34 # > with(stats): > data1:=importdata("data1.dat",2): > life:=data1[1]: > amount:=data1[2]: > describe[coefficientofvariation[1]]([10,20,30]) > <> describe[coefficientofvariation[1]]([110,120,130]); > describe[coefficientofvariation[1]](life), > describe[coefficientofvariation[1]](amount); # # # MAPLE SESSION 35 # > with(stats): > describe[covariance]([-1,0,1],[-1,0,1]); > describe[covariance]([-1,0,1],[1,0,-1]); # # # MAPLE SESSION 36 # > with(stats): > x1:=[seq(i,i=-10..10)]: > y1:=[seq(i*2,i=-10..10)]: > statplots[scatterplot](x1,y1); > describe[linearcorrelation](x1,y1); # # # MAPLE SESSION 37 # > x2:=[seq(i,i=-10..10)]: > y2:=[seq(-i,i=-10..10)]: > statplots[scatterplot](x2,y2); > describe[linearcorrelation](x2,y2); # # # MAPLE SESSION 38 # > x3:=[-1,-1,0,1,1]: > y3:=[1,-1, 0,-1,1]: > statplots[scatterplot](x3,y3): > describe[linearcorrelation](x3,y3); # # # MAPLE SESSION 39 # > describe[linearcorrelation](life, amount); # # 16.4 Graphical methods for describing data # # # # MAPLE SESSION 40 # > with(stats);