R !!!fitdistrplus 分布のあてはまりの確認 {{outline}} ---- !!準備 install.packages("fitdistrplus") library(fitdistrplus) !!扱える分布 "norm", "lnorm", "pois", "exp", "gamma", "nbinom", "geom", "beta", "unif" and "logis" !!descdist() !分布の描写 * これで、どんな分布か、あたりをつける descdist(SbyS.dat.wide$MDD) {{ref_image descdist.png}} * ●が観察データ * 粗い破線がgamma(ガンマ分布) * 細かい破線がlognormal(対数正規分布) * これだけ見ると、細かい破線lognormalに近い ! boot オプション * ブートストラップしたサンプルも追加でプロット descdist(SbyS.dat.wide$MDD, boot=500) {{ref_image descdistboot.png}} * オレンジの分布が、粗い破線と細かい破線の両方にまたがっている * ガンマ分布と対数正規分布の両方の可能性がある !!fitdist() * 分布を当てはめてみる fitdist(SbyS.dat.wide$MDD, "gamma") * 結果をプロットする {{pre MDD.gamma.fit <- fitdist(SbyS.dat.wide$MDD, "gamma") plot(MDD.gamma.fit) }} {{ref_image fitdist.png}} {{pre plot(fitdist(SbyS.dat.wide$MDD, "lnorm")) }} {{ref_image fitdistlnorm.png}} !!Reference https://www.jstatsoft.org/article/view/v064i04