绘制均值、标准差、均值的标准误差和置信区间 [英] Plot mean, standard deviation, standard error of the mean, and confidence interval
本文介绍了绘制均值、标准差、均值的标准误差和置信区间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 R 绘制统计图.我可以绘制简单的图形.但是,我不知道如何绘制复杂的数据.
I'm using R to plot statistical graphs. I can plot simple graphs. However, I not have idea how to plot complex data.
有人可以帮我把所有这些信息放在一张图表上吗?不包括 N(计数).
Someone could help me put together a chart with all this information? Excluding N (count).
我的数据集
$ df <- read.csv("database.csv", header=TRUE, sep=",")
$ df
# df is 'data frame'
# Gives count (N), mean, standard deviation (sd), standard error of the mean (se),
# and confidence interval (ci)
method N mean sd se ci
4 A 100 0.3873552 0.014513971 0.0014513971 0.002879887
6 B 100 0.3873552 0.014513971 0.0014513971 0.002879887
11 C 100 0.3873552 0.014513971 0.0014513971 0.002879887
12 D 100 0.3873552 0.014513971 0.0014513971 0.002879887
10 E 100 0.3757940 0.027337627 0.0027337627 0.005424378
1 F 100 0.3715910 0.006180728 0.0006180728 0.001226391
3 G 100 0.3642126 0.051949010 0.0051949010 0.010307811
5 H 100 0.3615370 0.006790384 0.0006790384 0.001347359
9 I 100 0.3589878 0.010288660 0.0010288660 0.002041493
13 J 100 0.3585191 0.030658287 0.0030658287 0.006083269
2 K 100 0.3570351 0.013531711 0.0013531711 0.002684985
7 L 100 0.3497304 0.078784858 0.0078784858 0.015632625
8 M 100 0.2994054 0.009305584 0.0009305584 0.001846430
我需要一个包含数据集所有信息的简单图表.
I need a simple chart that contains all information of the dataset.
注意:不需要计数 (N) 和平均值的标准误差 (se).
Note: Count (N) and standard error of the mean (se) is not necessary.
例如,如何创建条形图并添加置信区间?
For example, how can I create a bar graph and add confidence interval?
其他例如:
推荐答案
names=data$method
x = 1:13*2-1
CI.up = as.numeric(data$mean)+as.numeric(data$ci)
CI.dn = as.numeric(data$mean)-as.numeric(data$ci)
plot(data$mean~x, cex=1.5,xaxt='n',ylim=c(0.3,0.40), xlab='',ylab='lalala!', main='blahblahblah',col='blue',pch=16)
axis(1, at=x, labels=names)
arrows(x,CI.dn,x,CI.up,code=3,length=0.2,angle=90,col='red')
legend("bottomleft",paste(names,": S.E=",data$se),ncol=6,text.width=1)
输出
这篇关于绘制均值、标准差、均值的标准误差和置信区间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文