有没有办法可以使用R在箱线图中显示“五个值”?
p0.3 = dbinom(0:60, 60, 0.3)
p0.5 = dbinom(0:60, 60, 0.5)
p0.8 = dbinom(0:60, 60, 0.8)
boxplot(p0.3,p0.5,p0.8, names=c("0.3","0.5","0.8"),col=c("red","yellow","blue"),main = "Boxplot of Probability Distribution ", ylab = "Distribution Density", xlab = "Probability")
答案 0 :(得分:0)
我不清楚您是否想要绘制符号或值本身。首先,您可以添加一些内容,如:
abline(h=mean(p0.3), col ="red");
points(sd(p0.3), pch=18, col ="red")
如果是第二个,您可以自己计算这些统计数据,然后将这些值添加为文本:
p0.3 = dbinom(0:60, 60, 0.3)
p0.5 = dbinom(0:60, 60, 0.5)
p0.8 = dbinom(0:60, 60, 0.8)
boxplot(p0.3,p0.5,p0.8, names=c("0.3","0.5","0.8"),col=c("red","yellow","blue"),main = "Boxplot of Probability Distribution ", ylab = "Distribution Density", xlab = "Probability")
means <- mean(p0.3, na.rm = TRUE)
text(x=means, labels = means, y=0.01) # you will need to adjust y