以前に書いた連続確率分布について R を利用して可視化してみます。
コード
n = 1000
df = 1
shape = 1
shape1 = 1
shape2 = 1
rate = 10
df1 = 10
df2 = 20
draw <- function (x, image) {
png(image, width = 480, height = 480, pointsize = 12, bg = "white", res = NA)
hist(x)
dev.off()
}
x = runif(n, min=0, max=1)
draw(x, 'runif.png')
x = rnorm(n, mean=0, sd=1)
draw(x, 'rnorm.png')
x = rlnorm(n, meanlog = 0, sdlog = 1)
draw(x, 'rlnorm.png')
x = rgamma(n, shape, rate = 1, scale = 1/rate)
draw(x, 'rgamma.png')
x = rbeta(n, shape1, shape2)
draw(x, 'rbeta.png')
x = rchisq(n, df, ncp=0)
draw(x, 'rchisq.png')
x = rt(n, df)
draw(x, 'rt.png')
x = rf(n, df1, df2)
draw(x, 'rf.png')
x = rcauchy(n, location = 0, scale = 1)
draw(x, 'rcauchy.png')
x = rcauchy(n, location = 0, scale = 1)
draw(x, 'rcauchy.png')
x = rexp(n, rate = 1)
draw(x, 'rexp.png')
x = rlogis(n, location = 0, scale = 1)
draw(x, 'rlogis.png')
x = rweibull(n, shape, scale = 1)
draw(x, 'rweibull.png')
連続一様分布
正規分布
対数正規分布
ガンマ分布
ベータ分布
カイ二乗分布
t 分布
F 分布
コーシー分布
指数分布
ロジスティック分布
ワイブル分布
まとめ
可視化してみると確率分布についてのイメージがよりとらえやすくなったかと思います。
参考
R の確率分布システム
http://www.okada.jp.org/RWiki/?R%A4%CB%A4%AA%A4%B1%A4%EB%B3%CE%CE%A8%CA%AC%C9%DB
確率分布と乱数
http://cse.naro.affrc.go.jp/takezawa/r-tips/r/60.html