其他分享
首页 > 其他分享> > 统计

统计

作者:互联网

mean 平均数

median 中位数

mode 众数

prctile 四分位数,也称四分位点,是指在统计学中把所有数值由小到大排列并分成四等份,处于三个分割点位置的数值

>> load stockreturns
>> x4=stocks(:,4)

x4 =

    2.9914
    2.6204
   -0.3624
    2.2094
   -2.4079
    2.9277
   -1.0281
   -3.3567
    1.9482
    2.3593
    3.5894
   -0.8645
   -2.1599
   -3.8850
   -0.3494
   -0.8930
    1.7893
   -0.7141
   -1.2013
   -3.3592
    0.6673
    3.7411
    2.1308
    2.6651
    0.9303
   -1.6121
    0.4302
    2.4841
   -1.9898
    4.5561
    2.5903
   -0.1640
    1.3072
   -0.4932
   -4.1415
   -0.1348
    3.2650
   -3.1646
   -0.6340
   -0.7101
   -4.3216
    0.6100
   -1.5280
    0.2114
   -1.4884
    0.9389
    1.1603
   -0.0880
   -2.7591
    3.3299
   -0.2885
    2.2003
   -4.3053
    0.4916
    0.4022
   -0.9178
   -5.8764
   -5.4219
    2.9621
   -3.1092
    2.1127
    0.8175
   -2.1854
    0.6762
    0.4983
    6.4692
    0.7895
    2.4106
    0.6763
   -2.7782
   -1.6733
   -0.2882
   -2.2267
   -1.2758
   -2.3091
    1.4615
   -1.2334
   -1.2778
    1.9237
   -1.3201
    0.4338
    0.5043
   -1.7769
    1.5579
    2.9013
    1.1645
   -0.6437
    1.6442
   -0.8432
   -0.4492
   -2.8875
    1.0591
   -2.0462
    3.6961
    3.9568
   -5.0162
    0.3851
    0.5334
    1.4381
   -0.7173

>> ex.mean=mean(x4)

ex = 

  包含以下字段的 struct:

    mean: -5.8728e-04

>> ex.median=median(x4)

ex = 

  包含以下字段的 struct:

      mean: -5.8728e-04
    median: 0.0617

>> ex.mode=mode(x4)

ex = 

  包含以下字段的 struct:

      mean: -5.8728e-04
    median: 0.0617
      mode: -5.8764

>> ex

ex = 

  包含以下字段的 struct:

      mean: -5.8728e-04
    median: 0.0617
      mode: -5.8764

 

x=1:14;
freqy=[1 0 1 0 4 0 1 0 3 1 0 0 1 1];%频数
subplot(1,3,1);bar(x,freqy);xlim([0 15]);
subplot(1,3,2);area(x,freqy);xlim([0 15]);
subplot(1,3,3);stem(x,freqy);xlim([0 15]);

 boxplot

%boxplot
marks=[80 81 81 84 88 92 92 94 96 97];
boxplot(marks);
prctile(marks,[25 50 75]);%prctile百分数 25% 50% 75%

 

 

 

skewness偏度系数

X = randn 返回一个从标准正态分布中得到的随机标量。

>> x=randn([10 3])*3;
x(x(:,1)<0,1)=0;
x(x(:,3)>0,3)=0;
boxplot(x,{'Right-skewed','Symmetric','Left-skewed'});
y=skewness(x)

y =

    0.6710    0.9900   -1.4245

 

下面的东西感觉暂时用不上,先不看了。。

 

标签:freqy,median,统计,mode,mean,x4,ex
来源: https://www.cnblogs.com/zuiaimiusi/p/11324109.html