matlab第十二课:统计

目标:

  1. 统计

统计

概述:

  • 数据的科学
  • 涉及数据的收集,分析,解释,演示和组织

统计的主要方法:

  • 描述性统计
  • 推理统计 

一、推理统计

数值模式和图形方法查找模式,总结数据集中的信息

Mean, Median, Mode, and Quartile(四分位数):

Range and Interquartile Range

Variance and Standard Deviation:

Figures Are Always More Powerful:

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:

每个位置从左往右分别代表最小值、下四分位点、中位数、上四分位点和最大值。

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

Skewness: skewness()

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 =

    1.0487    0.2193   -1.5381

Kurtosis(峰态):

  • 分布平坦度的一种度量
  • 正态分布的峰度为零。
    • 正峰度:更陡峭的峰
    • 负峰度:更平坦的峰

二、描述性统计

使用样本数据进行估计、决策和预测的方法

Statistical Hypothesis Testing(统计假设检验):

利用数据进行决策的一种方法

例如:我在这个班上能拿到A级吗?

其中H0是空假设,H1是可选择假设。

Hypothesis Testing Procedure(假设检验程序):

  • 为假设检验确定概率,比如0.95
  • 95%是H0的置信区间
  • 检查你的分数是否落入区间

t-test Example:
 

load stockreturns; 
x1 = stocks(:,3);  
x2 = stocks(:,10); 
boxplot([x1, x2], {'3', '10'}); 
[h,p] = ttest2(x1, x2)

h =

     1


p =

    0.0423

Two-tailed Significance Test:

One-tailed Significance Test:

Common Hypothesis Tests:

猜你喜欢

转载自blog.csdn.net/gyt15663668337/article/details/83713206