绘制多个平均回报与相应的标准偏差

时间:2016-11-07 13:19:26

标签: r plot

我目前正在处理7个不同的数据集,因此我有7个独立变量代表每个数据集的平均回报。 标准偏差也是如此。

我知道如何绘制一个平均回报值和相应的标准差;

plot=(meanr1, stdr1)

如何绘制所有平均回报与相应的标准偏差?

from meanR1 ..to... meanR7 (mean returns)

from stdR1...to...stdR7   (standard deviation)

1 个答案:

答案 0 :(得分:1)

最小解决方案(此处有三种方式和标准)

plot(c(meanR1,meanR2,meanR3),c(stdR1,stdR2,stdR3))

您可能希望首先将均值和标准差放在数据框中,例如

df<-data.frame(means=c(meanR1,meanR2,meanR3),stds=c(stdR1,stdR2,stdR3))

然后使用

绘制它们
plot(df$means,df$stds)