102.5
10 10 M 14 69.0 112.5
11 11 M 14 63.5 102.5
12 12 M 15 67.0 133.0
13 13 M 12 57.3 83.0
14 14 M 13 62.5 84.0
15 15 M 12 59.0 99.5
16 16 M 16 72.0 150.0
17 17 M 12 64.8 128.0
18 18 M 11 57.5 85.0
19 19 M 15 66.5 112.0
> # 计算身高的均值,标准差,中位数,最值,偏度,峰度
> height <- student$height
> mean(height)
[1] 62.33684
> sd(height)
[1] 5.127075
> median(height)
[1] 62.8
> max(height)
[1] 72
> min(height)
[1] 51.3
> install.packages("e1071")
> library(e1071)
> skewness(height)
> kurtosis(height)
> # 绘制体重直方图,将密度估计曲线与正态密度曲线比较
> weight <- student$weight
> hist(weight)
> hist(weight,col="lightblue",freq=F)
> lines(weight,dnorm(weight,mean(weight),sd(weight)))#正态密度曲线
Error in plot.xy(xy.coords(x, y), type = type, ...) :
plot.new has not been called yet
> lines(density(weight),col="green",lwd=3)
Error in plot.xy(xy.coords(x, y), type = type, ...) :
plot.new has not been called yet
【无标题】
最新推荐文章于 2025-06-06 16:33:00 发布