数据为随机选取的100只家蝇翅膀的长度,数据特征为:μ= 45.5,σ = 3.92。数据来源:http://www.seattlecentral.edu/qelp/sets/057/057.html
fw <- read.csv("Housefly Wing.csv", header = F)
as.numeric(fw$V1)
## [1] 36 37 38 38 39 39 40 40 40 40 41 41 41 41 41 41 42 42 42 42 42 42 42
## [24] 43 43 43 43 43 43 43 43 44 44 44 44 44 44 44 44 44 45 45 45 45 45 45
## [47] 45 45 45 45 46 46 46 46 46 46 46 46 46 46 47 47 47 47 47 47 47 47 47
## [70] 48 48 48 48 48 48 48 48 49 49 49 49 49 49 49 50 50 50 50 50 50 51 51
## [93] 51 51 52 52 53 53 54 55
hist(fw$V1, freq = F, breaks = seq(36, 56, 2), xaxt = "n", xlab = "Wing Length",
main = "Histogram of Housefly Wing")
axis(side = 1, at = seq(36, 56, 2))
mean = mean(fw$V1)
SD = sd(fw$V1)
x = seq(min(fw$V1), max(fw$V1), by = 1)
norm = dnorm(x, mean = mean, sd = SD)
lines(x, norm, type = "l", col = "red")
abline(v = c(mean - 2 * SD, mean + 2 * SD), col = "blue")