V1

2022/05/21阅读：21主题：极简黑

# 计量资料统计描述

## 统计描述

``library(readxl)E02_01 <- read_excel( "E02_01.xls" )#载入数据E02_01#查看数据> E02_01# A tibble: 138 x 1       x   <dbl> 1  3.96 2  4.23 3  4.42 4  3.59 5  5.12 6  4.02 7  4.32 8  3.72 9  4.7610  4.16# ... with 128 more rows> summary(E02_01)#描述性分析       x         Min.   :3.070   1st Qu.:3.962   Median :4.230   Mean   :4.227   3rd Qu.:4.527   Max.   :5.460 ``

``> library(pastecs)> stat.desc(E02_01)#使用pastecs函数进行描述性分析                        xnbr.val      138.00000000nbr.null       0.00000000nbr.na         0.00000000min            3.07000000max            5.46000000range          2.39000000sum          583.33000000median         4.23000000mean           4.22702899SE.mean        0.03794304CI.mean.0.95   0.07502975var            0.19867505std.dev        0.44572980coef.var       0.10544754> ``

``> length(E02_01\$x)#查看数量[1] 138> max(E02_01\$x)#最大值[1] 5.46> min(E02_01\$x)#最小值[1] 3.07> mean(E02_01\$x)#均值[1] 4.227029> median(E02_01\$x)#中位数[1] 4.23> sd(E02_01\$x)#计算标准差[1] 0.4457298> var(E02_01\$x)#计算方差[1] 0.1986751> sd(E02_01\$x)/sqrt(length(E02_01\$x))#计算标准误[1] 0.03794304> range(E02_01\$x)[1] 3.07 5.46> quantile(E02_01\$x,c(0.025, 0.25, 0.5, 0.75, 0.975))#求分位数， 2.5%, 25%, 50%, 75%, 97.5 %的分位点   2.5%     25%     50%     75%   97.5% 3.40275 3.96250 4.23000 4.52750 5.18325 > IQR(E02_01\$x)#四分位数间距[1] 0.565``

``> shapiro.test(E02_01\$x)# 夏皮洛-威尔克正态性检验 Shapiro-Wilk normality testdata:  E02_01\$xW = 0.98908, p-value = 0.3524``

P=0.3524>0.05，可表示数据符合正态分布

QQ图

``qqnorm( E02_01\$x )# 画出E02_01的Q-Q图``

``hist(E02_01\$x)#直方图``

``plot(density(E02_01\$x))#密度图``

### 参考资料

[1]

《医学统计学》[第五版]: 孙振球，徐勇勇，人民卫生出版社

- END -

V1