エラーバーや信頼区間をグラフに出力

元ネタ StatsRUs http://gifi.stat.ucla.edu/R/doc/statsRus.html 5.9 Plot with error bars (11/08/2000 Paul Johnson <pauljohn@ukans.edu>)

x<-c(1,2,3,4,5)
y<-c(1.1, 2.3, 3.0, 3.9, 5.1)
ucl<-c(1.3, 2.4, 3.5, 4.1, 5.3)
lcl<-c(.9, 1.8, 2.7, 3.8, 5.0)
plot(x,y, ylim=range(c(lcl,ucl)))
arrows(x,ucl,x,lcl,length=.05,angle=90,code=3) 
#or
segments(x,ucl,x,lcl)

ポイントはarrowsが使えるということ。

ちなみにlibrary(gregmisc) にある plotCI()という関数があります。 example(plotCI) を参照してください。

plotCI.png

gregmiscにはbarplot2()もあります。

#ref(): File not found: "barplot2.png" at page "Tips/エラーバー・信頼区間"


添付ファイル: fileplotCI.png 4972件 [詳細]

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2023-03-25 (土) 11:19:16