{"id":2053,"date":"2026-01-18T11:00:19","date_gmt":"2026-01-18T02:00:19","guid":{"rendered":"https:\/\/info.zanet.biz\/?p=2053"},"modified":"2026-01-18T11:04:17","modified_gmt":"2026-01-18T02:04:17","slug":"%e9%a0%bb%e5%ba%a6%e8%ab%96%e6%b4%be%e3%81%ae%e4%bf%a1%e9%a0%bc%e5%8c%ba%e9%96%93%e3%81%a8%e3%83%99%e3%82%a4%e3%82%ba%e7%b5%b1%e8%a8%88%e3%81%ae%e7%a2%ba%e4%bf%a1%e5%8c%ba%e9%96%93%e3%81%ae%e9%81%95","status":"publish","type":"post","link":"https:\/\/info.zanet.biz\/?p=2053","title":{"rendered":"\u983b\u5ea6\u8ad6\u6d3e\u306e\u4fe1\u983c\u533a\u9593\u3068\u30d9\u30a4\u30ba\u7d71\u8a08\u306e\u78ba\u4fe1\u533a\u9593\u306e\u9055\u3044"},"content":{"rendered":"\n<p>Cochrane\u306e<a href=\"https:\/\/revman.cochrane.org\/info\" target=\"_blank\" rel=\"noreferrer noopener\">RevMan<\/a>, R\u30d1\u30c3\u30b1\u30fc\u30b8\u306e<a href=\"https:\/\/cran.r-project.org\/web\/packages\/meta\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">meta<\/a>, <a href=\"https:\/\/cran.r-project.org\/web\/packages\/metafor\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">metafor<\/a>\u3067\u7528\u3044\u3089\u308c\u3066\u3044\u308b\u30e1\u30bf\u30a2\u30ca\u30ea\u30b7\u30b9\u306e\u624b\u6cd5\u306f\u4f1d\u7d71\u7684\u7d71\u8a08\u5b66\u3059\u306a\u308f\u3061\u983b\u5ea6\u8ad6\u6d3eFrequentist\u306e\u624b\u6cd5\u3067\u3059\u3002\u4e00\u65b9\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30e1\u30bf\u30a2\u30ca\u30ea\u30b7\u30b9\u306e\u305f\u3081\u306eR\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u3042\u308b<a href=\"https:\/\/cran.r-project.org\/web\/packages\/gemtc\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">gemtc<\/a>\u306f\u30d9\u30a4\u30ba\u7d71\u8a08\u5b66\u306b\u57fa\u3065\u304f\u624b\u6cd5\u3092\u7528\u3044\u308b\u30d9\u30a4\u30b8\u30a2\u30f3\u30e1\u30bf\u30a2\u30ca\u30ea\u30b7\u30b9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002Arm-based model\u3092\u7528\u3044\u308b\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30e1\u30bf\u30a2\u30ca\u30ea\u30b7\u30b9\u306e\u305f\u3081\u306eR\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u3042\u308b<a href=\"https:\/\/cran.r-project.org\/web\/packages\/pcnetmeta\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">pcnetmeta<\/a>\u3082\u30d9\u30a4\u30b8\u30a2\u30f3\u30a2\u30d7\u30ed\u30fc\u30c1\u3092\u7528\u3044\u3066\u3044\u307e\u3059\u3002\u30d9\u30a4\u30b8\u30a2\u30f3\u30a2\u30d7\u30ed\u30fc\u30c1\u3067\u30da\u30a2\u30ef\u30a4\u30ba\u306e\u30e1\u30bf\u30a2\u30ca\u30ea\u30b7\u30b9\u3092\u3092\u884c\u3046\u306b\u306f\u3001OpenBUGS\u3001JAGS\u3001Stan\u306a\u3069Markov Chain Monte Carlo (MCMC)\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u304cR\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u3042\u308b<a href=\"https:\/\/cran.r-project.org\/web\/packages\/R2OpenBUGS\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">R2OpenBUGS<\/a>, <a href=\"https:\/\/cran.r-project.org\/web\/packages\/rjags\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">rjags<\/a>, <a href=\"https:\/\/cran.r-project.org\/web\/packages\/rstan\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">rstan<\/a>\u306a\u3069\u3092\u4ecb\u3057\u3066\u7528\u3044\u3089\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u983b\u5ea6\u8ad6\u6d3e\u306e\u624b\u6cd5\u3067\u5f97\u3089\u308c\u308b\u7d71\u5408\u5024\u3068\u4fe1\u983c\u533a\u9593Confidence Interval\u3068\u30d9\u30a4\u30b8\u30a2\u30f3\u306e\u624b\u6cd5\u3067\u5f97\u3089\u308c\u308b\u7d71\u5408\u5024\u3068\u78ba\u4fe1\u533a\u9593\uff08\u4fe1\u7528\u533a\u9593\uff09Credible Interval\u306f\u540c\u3058\u3088\u3046\u306b\u89e3\u91c8\u3059\u3079\u304d\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u3069\u306e\u3088\u3046\u306b\u9055\u3046\u306e\u304b\u3092\u7406\u89e3\u3059\u308b\u305f\u3081\u306b\u3001\u4ee5\u4e0b\u30e1\u30bf\u30a2\u30ca\u30ea\u30b7\u30b9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u30012\u7fa4\u306e\u30a4\u30d9\u30f3\u30c8\u6570\u304b\u3089\u30ea\u30b9\u30af\u6bd4\u3068\u4fe1\u983c\u533a\u9593\u3042\u308b\u3044\u306f\u78ba\u4fe1\u533a\u9593\u3092\u8a08\u7b97\u3059\u308b\u5b9f\u4f8b\u3092\u793a\u3057\u306a\u304c\u3089\u89e3\u8aac\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5bfe\u7167\u7fa4\u306e\u30a4\u30d9\u30f3\u30c8\u5272\u5408\uff08\u7387\uff09\u304c0.5\u3067\u4ecb\u5165\u7fa4\u306e\u30a4\u30d9\u30f3\u30c8\u5272\u5408\uff08\u7387\uff09\u304c0.4\u304c\u771f\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3060\u3068\u3057\u307e\u3059\u3002\u771f\u306e\u30ea\u30b9\u30af\u6bd4\u306e\u5024\u306f0.4\/0.5 = 0.8\u3067\u3059\u304c\u3001\u30b5\u30f3\u30d7\u30eb\u304b\u3089\u5f97\u3089\u308c\u308b\u5024\u306f\u3001\u5fc5\u305a\u3057\u30820.8\u306b\u306f\u306a\u308a\u307e\u305b\u3093\u3002\u4f8b\u3048\u3070\u3001\u5bfe\u7167\u7fa4\u306e\u75c7\u4f8b\u657050\u4f8b\u3001\u4ecb\u5165\u7fa4\u306e\u75c7\u4f8b\u657050\u4f8b\u3067\u30e9\u30f3\u30c0\u30e0\u5316\u6bd4\u8f03\u8a66\u9a13\u304c\u884c\u308f\u308c\u305f\u3068\u3057\u307e\u3059\u3002\u5404\u7fa4\u306e50\u4f8b\u4e2d\u30a4\u30d9\u30f3\u30c8\u304c\u8d77\u304d\u308b\u4eba\u6570\u306f\u3001\u30e9\u30f3\u30c0\u30e0\u30b5\u30f3\u30d7\u30eb\u3067\u3042\u308c\u3070\u3053\u308c\u3089\u306e\u5024\u306f\u4e8c\u9805\u5206\u5e03\u306b\u5f93\u3044\u3001\u5fc5\u305a25\u4eba\u300120\u4eba\u306b\u306a\u308b\u3068\u3044\u3046\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\u306e\u5076\u7136\u306e\u504f\u308a\u3067\u5c11\u3057\u305a\u3064\u9055\u3046\u5024\u306b\u306a\u308a\u307e\u3059\u3002\u305d\u3057\u3066\u3001\u30ea\u30b9\u30af\u6bd4\u3082\u5fc5\u305a0.8\u306b\u306a\u308b\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u3053\u308c\u3092R\u3067\u30b7\u30df\u30e5\u30ec\u30fc\u30c8\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5bfe\u7167\u7fa4\u306e\u75c7\u4f8b\u6570\u3092csampleSize\u3001\u30a4\u30d9\u30f3\u30c8\u7387\u3092cprop\u3001\u4ecb\u5165\u7fa4\u306e\u75c7\u4f8b\u6570\u3092isampleSize\u3001\u30a4\u30d9\u30f3\u30c8\u7387\u3092iprop\u3067\u8868\u3059\u3068\u3001\u5bfe\u7167\u7fa4\u306e\u30a4\u30d9\u30f3\u30c8\u6570cevents\u3068\u4ecb\u5165\u7fa4\u306e\u30e9\u30f3\u30c0\u30e0\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\u3067\u5f97\u3089\u308c\u308b\u30a4\u30d9\u30f3\u30c8\u6570ievents\u3092R\u3067\u306f\u6b21\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>cevents &lt;- rbinom(1, csampleSize, cprop) # \u5bfe\u7167\u7fa4\u30a4\u30d9\u30f3\u30c8\u6570 \u751f\u6210\u56de\u6570\u5206<br>ievents &lt;- rbinom(1, isampleSize, iprop) # \u4ecb\u5165\u7fa4\u30a4\u30d9\u30f3\u30c8\u6570 \u751f\u6210\u56de\u6570\u5206<\/p>\n\n\n\n<p>\u3053\u308c\u306f\u4e8c\u9805\u5206\u5e03\u304b\u3089\u30e9\u30f3\u30c0\u30e0\u30b5\u30f3\u30d7\u30eb\u3092\u5f97\u308brbinom()\u95a2\u6570\u3092\u7528\u3044\u3066\u3044\u307e\u3059\u304c\u6b21\u306e\u3088\u3046\u306a\u8003\u3048\u65b9\u306b\u57fa\u3065\u3044\u3066\u3044\u307e\u3059\u3002\u30e9\u30f3\u30c0\u30e0\u5316\u6bd4\u8f03\u8a66\u9a13\u306e\u53c2\u52a0\u8005\u304c1\u540d\u3044\u305f\u5834\u5408\u3001\u305d\u306e\u4eba\u304c\u4ecb\u5165\u7fa4\u306b\u5272\u308a\u4ed8\u3051\u3089\u308c\u308b\u3068\u30010.5\u306e\u78ba\u7387\u3067\u30a4\u30d9\u30f3\u30c8\u304c\u8d77\u304d\u308b\u8a33\u3067\u3059\u304c\u3001\u7d50\u679c\u3068\u3057\u3066\u8d77\u304d\u308b\u304b\u8d77\u304d\u306a\u3044\u304b\u306f0.5\u306e\u78ba\u7387\u3067\u3059\u3002\u6b21\u306e\u5bfe\u7167\u7fa4\u306e\u53c2\u52a0\u80051\u540d\u306b\u3064\u3044\u3066\u3082\u3001\u540c\u3058\u3053\u3068\u304c\u8a00\u3048\u30010.5\u306e\u78ba\u7387\u3067\u30a4\u30d9\u30f3\u30c8\u304c\u8d77\u304d\u308b\u8a33\u3067\u3059\u304c\u3001\u7d50\u679c\u3068\u3057\u3066\u8d77\u304d\u308b\u304b\u8d77\u304d\u306a\u3044\u304b\u306f0.5\u306e\u78ba\u7387\u3067\u3059\u3002\u3053\u308c\u309250\u4eba\u5206\u7e70\u308a\u8fd4\u3057\u305f\u7d50\u679c\u30a4\u30d9\u30f3\u30c8\u304c\u8d77\u304d\u305f\u4eba\u6570\u306f\u4e8c\u9805\u5206\u5e03\u306b\u5f93\u3046\u306e\u3067\u3001R\u306erbinom()\u95a2\u6570\u3067\u306f\u3001rbinom(\u751f\u6210\u56de\u6570\u3001\u3072\u3068\u3064\u306e\u89b3\u6e2c\u3042\u305f\u308a\u306e\u8a66\u884c\u56de\u6570,\u5404\u8a66\u884c\u306e\u6210\u529f\u78ba\u7387\uff09\u3067\u8a66\u884c\u56de\u6570\u3067\u30a4\u30d9\u30f3\u30c8\u304c\u8d77\u304d\u308b\u56de\u6570\uff1d\u6210\u529f\u56de\u6570\u304c\u5f97\u3089\u308c\u307e\u3059\u3002\u901a\u5e38\u306f\u3001\u540c\u3058\u30e9\u30f3\u30c0\u30e0\u5316\u6bd4\u8f03\u8a66\u9a13\u306f1\u56de\u3057\u304b\u884c\u308f\u306a\u3044\u306e\u3067\u3001\u751f\u6210\u3059\u308b\u4e71\u6570\u306e\u500b\u6570\u306f1\u306b\u3057\u305f\u5834\u5408\u306b\u76f8\u5f53\u3057\u307e\u3059\u304c\u3001\u3053\u306e\u5024\u3092\u5909\u6570cyc\u3067\u8a2d\u5b9a\u3059\u308b\u3068\u3001cyc\u3067\u8a2d\u5b9a\u3057\u305f\u56de\u6570\u5206\u306e\u30a4\u30d9\u30f3\u30c8\u6570\u306e\u30c7\u30fc\u30bf\u304c\u5f97\u3089\u308c\u307e\u3059\u3002cyc\u3092\u4f8b\u3048\u3070\u3001100\u306b\u8a2d\u5b9a\u3059\u308b\u3068\u3001\u540c\u3058\u30e9\u30f3\u30c0\u30e0\u5316\u6bd4\u8f03\u8a66\u9a13\u3092100\u56de\u884c\u3063\u305f\u5834\u5408\u306e\u3001\u5bfe\u7167\u7fa4\u3001\u4ecb\u5165\u7fa4\u306e\u30a4\u30d9\u30f3\u30c8\u6570\u3092\u30b7\u30df\u30e5\u30ec\u30fc\u30c8\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>cyc = 100; csampleSize = 50; cprop = 0.5<br>isampleSize = 50; iprop = 0.4<br>cevents &lt;- rbinom(cyc, csampleSize, cprop) # \u5bfe\u7167\u7fa4\u30a4\u30d9\u30f3\u30c8\u6570 \u8a66\u884c\u56de\u6570\u5206<br>ievents &lt;- rbinom(cyc, isampleSize, iprop) # \u4ecb\u5165\u7fa4\u30a4\u30d9\u30f3\u30c8\u6570 \u8a66\u884c\u56de\u6570\u5206<\/p>\n\n\n\n<p>\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001cevents\u306b\u306f25\u524d\u5f8c\u306e\u5024\u304c\u3001ievents\u306b\u306f20\u524d\u5f8c\u306e\u5024\u304c\u305d\u308c\u305e\u308c100\u500b\u683c\u7d0d\u3055\u308c\u307e\u3059\u3002\u5404\u7fa4\u306e\u30a4\u30d9\u30f3\u30c8\u6570\u304b\u3089\u30ea\u30b9\u30af\u6bd4\u3092\u8a08\u7b97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001100\u500b\u306e\u30ea\u30b9\u30af\u6bd4\u306e\u5024\u3092\u5f97\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3055\u3089\u306b\u3001\u305d\u308c\u305e\u308c\u306e\u30a4\u30d9\u30f3\u30c8\u6570\u3068\u75c7\u4f8b\u6570\u304b\u308995\uff05\u4fe1\u983c\u533a\u9593\u3092\u8a08\u7b97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30ea\u30b9\u30af\u6bd4\u306e\u81ea\u7136\u5bfe\u6570\u306e95%\u4fe1\u983c\u533a\u9593\u306f\u4ee5\u4e0b\u306e\u5f0f\u3067\u8a08\u7b97\u3055\u308c\u307e\u3059\u3002\u3059\u306a\u308f\u3061\u3001\u30ea\u30b9\u30af\u6bd4\u306e\u81ea\u7136\u5bfe\u6570\u306e\u6a19\u6e96\u8aa4\u5dee = 1\/\u5bfe\u7167\u7fa4\u306e\u30a4\u30d9\u30f3\u30c8\u6570 + 1\/\u4ecb\u5165\u7fa4\u306e\u30a4\u30d9\u30f3\u30c8\u6570 &#8211; 1\/\u5bfe\u7167\u7fa4\u306e\u75c7\u4f8b\u6570 &#8211; 1\/\u4ecb\u5165\u7fa4\u306e\u30a4\u30d9\u30f3\u30c8\u6570\u3001\u3092\u307e\u305a\u8a08\u7b97\u3057\u307e\u3059\u3002\u30ea\u30b9\u30af\u6bd4\u306e\u81ea\u7136\u5bfe\u6570\u306b\u6a19\u6e96\u8aa4\u5dee\u00d71.96\u3092\u30d7\u30e9\u30b9\u30de\u30a4\u30ca\u30b9\u3057\u3001\u8a08\u7b97\u7d50\u679c\u306eExponential\u3092\u6c42\u3081\u308b\u3068\u3001\u30ea\u30b9\u30af\u6bd4\u306e\u5024\u306b\u623b\u305b\u307e\u3059\u3002\u306a\u304a\u3001\u30a4\u30d9\u30f3\u30c8\u6570\u304c0\u306e\u5834\u5408\u306f\u30bc\u30ed\u306e\u5272\u308a\u7b97\u304c\u767a\u751f\u3059\u308b\u306e\u3067\u30010\u30920.5\u306b\u7f6e\u304d\u63db\u3048\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>cevents[cevents == 0] = 0.5<br>ievents[ievents == 0] = 0.5<\/p>\n\n\n\n<p>p_c &lt;- cevents \/ csampleSize<br>p_i &lt;- ievents \/ isampleSize<br>rr &lt;- p_i \/ p_c<br>log_rr &lt;- log(rr)<\/p>\n\n\n\n<p>var_log_rr &lt;- (1 \/ cevents + 1 \/ ievents) &#8211; (1 \/ csampleSize + 1 \/ isampleSize)<br>se_log_rr &lt;- sqrt(var_log_rr) #Val(logRR)\u306e\u6a19\u6e96\u8aa4\u5dee<\/p>\n\n\n\n<p>z &lt;- 1.96<br>lower_rr &lt;- exp(log_rr &#8211; z * se_log_rr)<br>upper_rr &lt;- exp(log_rr + z * se_log_rr)<\/p>\n\n\n\n<p>\u30b0\u30e9\u30d5\u8868\u793a\u307e\u3067\u306e\u3059\u3079\u3066\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4ee5\u4e0b\u306b\u793a\u3057\u307e\u3059\u3002\u5909\u6570\u306e\u5024\u3092\u5909\u3048\u3066\u69d8\u3005\u306a\u4f8b\u3092\u30b7\u30df\u30e5\u30ec\u30fc\u30c8\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\uff08\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u4e00\u90e8\u306f\u884c\u982d\u306b#\u3092\u7f6e\u3044\u3066\u5b9f\u884c\u3055\u308c\u306a\u3044\u3088\u3046\u306b\u30b3\u30e1\u30f3\u30c8\u6271\u3044\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u30d7\u30ed\u30c3\u30c8\u4f5c\u6210\u306bggplot\uff12\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002\uff09<\/p>\n\n\n\n<details class=\"wp-block-liquid-accordion\" style=\"border-color:#00aeef\"><summary class=\"liquid-accordion-top\" style=\"color:#333333;background-color:#00aeef\">\u30ea\u30b9\u30af\u6bd4\u306e\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u305f\u3081\u306eR\u30b9\u30af\u30ea\u30d7\u30c8<\/summary><div class=\"liquid-accordion-bottom\">\n<pre class=\"wp-block-code\"><code>###########################\n#\u30ea\u30b9\u30af\u6bd4\u306895\uff05\u4fe1\u983c\u533a\u9593\u306e\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\n\nset.seed(123)\n# \u30d1\u30e9\u30e1\u30fc\u30bf\ncyc        &lt;- 100      # \u751f\u6210\u56de\u6570\uff08\u540c\u3058\u7814\u7a76\u306e\u56de\u6570\uff09\ncsampleSize &lt;- 50       # \u5bfe\u7167\u7fa4 50 \u4eba\nisampleSize &lt;- 50       # \u4ecb\u5165\u7fa4 50 \u4eba\ncprop      &lt;- 0.5\t\t# \u5bfe\u7167\u7fa4\u30a4\u30d9\u30f3\u30c8\u5272\u5408\niprop      &lt;- 0.4\t\t# \u4ecb\u5165\u7fa4\u30a4\u30d9\u30f3\u30c8\u5272\u5408\n\n# cyc\u56de\u3060\u3051\u30a4\u30d9\u30f3\u30c8\u6570\u3092\u751f\u6210 \u4e8c\u9805\u5206\u5e03\ncevents &lt;- rbinom(cyc, csampleSize, cprop)  # \u5bfe\u7167\u7fa4\u30a4\u30d9\u30f3\u30c8\u6570 \u751f\u6210\u56de\u6570\u5206\nievents &lt;- rbinom(cyc, isampleSize, iprop)  # \u4ecb\u5165\u7fa4\u30a4\u30d9\u30f3\u30c8\u6570 \u751f\u6210\u56de\u6570\u5206\n\ncat(\"Control events:\", cevents, \"of\", csampleSize, \"\\n\")\ncat(\"Intervention events:\", ievents, \"of\", isampleSize, \"\\n\")\n\n# RR \u3068 95%CI \u3092\u8a08\u7b97\u3067\u304d\u308b\u304b\u30c1\u30a7\u30c3\u30af\n#if (cevents == 0 | ievents == 0) {\n#  stop(\"\u3069\u3061\u3089\u304b\u306e\u7fa4\u3067\u30a4\u30d9\u30f3\u30c8\u6570\u304c0\u306e\u305f\u3081\u3001\u3053\u306e\u5b9a\u7fa9\u3067\u306fRR\u306895%CI\u3092\u8a08\u7b97\u3067\u304d\u307e\u305b\u3093\u3002\")\n#}\n# \u30bc\u30ed\u30a4\u30d9\u30f3\u30c8\u306e\u5834\u5408\u306e\u51e6\u7406 0.5\u306b\u8a2d\u5b9a\u3059\u308b\u3002\ncevents&#91;cevents == 0] = 0.5\nievents&#91;ievents == 0] = 0.5\n# \u30ea\u30b9\u30af\u6bd4\np_c &lt;- cevents \/ csampleSize\np_i &lt;- ievents \/ isampleSize\nrr  &lt;- p_i \/ p_c\nlog_rr &lt;- log(rr)\n\n# \u30ea\u30b9\u30af\u6bd4\u306e\u81ea\u7136\u5bfe\u6570\u306e\u5206\u6563: Var(logRR) = (1\/cevents + 1\/ievents - 1\/csampleSize - 1\/isampleSize)\nvar_log_rr &lt;- 1 \/ cevents + 1 \/ ievents - 1 \/ csampleSize - 1 \/ isampleSize\nse_log_rr  &lt;- sqrt(var_log_rr)\t\t#Val(logRR)\u306e\u6a19\u6e96\u8aa4\u5dee\n\n# 95%\u4fe1\u983c\u533a\u9593\uff08log\u30b9\u30b1\u30fc\u30eb \u2192 \u5143\u306e\u30b9\u30b1\u30fc\u30eb\uff09\nz &lt;- 1.96\nlower_rr &lt;- exp(log_rr - z * se_log_rr)\nupper_rr &lt;- exp(log_rr + z * se_log_rr)\n\ncat(\"RR =\", rr, \"\\n\")\ncat(\"95% CI = (\", lower_rr, \",\", upper_rr, \")\\n\")\n\n#######\nlibrary(ggplot2)\n\n# \u7406\u8ad6\u4e0a\u306eRR\ntrue_rr &lt;- iprop \/ cprop\n\n# \u7d50\u679c\u3092\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u5316\ndf &lt;- data.frame(\n  iter = 1:cyc,\n  rr = rr,\n  lower = lower_rr,\n  upper = upper_rr\n)\n\n# true_rr \u304c CI \u306e\u5916\u5074\u306b\u3042\u308b\u304b\u3069\u3046\u304b\u306e\u5224\u5b9a\ndf$flag &lt;- ifelse(true_rr &lt; df$lower | true_rr &gt; df$upper, \"out\", \"in\")\n\nggplot(df, aes(x = iter, y = rr)) +\n  geom_point(aes(color = flag), size = 3) +\n  geom_errorbar(aes(ymin = lower, ymax = upper), width = 0.1) +\n  geom_hline(yintercept = true_rr, linetype = \"dashed\", color = \"red\") +\n  coord_flip() +\n  scale_color_manual(values = c(\"in\" = \"black\", \"out\" = \"red\")) +\n  labs(\n    x = \"Iteration\",\n    y = \"Risk Ratio (RR)\",\n    title = \"Risk Ratio with 95% CI (points outside true RR highlighted)\"\n  ) +\n  theme_minimal(base_size = 14) +\n  theme(legend.position = \"none\")\n\n\n########\ndev.new()\nhist(rr, breaks = 30,\n     main = \"100 samples of RR\",\n     xlab = \"RR\",\n     col = \"lightblue\",\n     border = \"white\",\n     freq = FALSE)   # \u5bc6\u5ea6\u30b9\u30b1\u30fc\u30eb\u306b\u3059\u308b\n\n# \u5bc6\u5ea6\u66f2\u7dda\u3092\u8ffd\u52a0\n#lines(density(rr),\n#      col = \"red\",\n#      lwd = 1)\n\n###########################################################<\/code><\/pre>\n<\/div><\/details>\n\n\n\n<p>\u4e0a\u8a18\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u305f\u7d50\u679c\u3067\u3059\u3002\u70b9\u304c\u30ea\u30b9\u30af\u6bd4\u306e\u5024\u3067\u3001\u30d0\u30fc\u306f95%\u4fe1\u983c\u533a\u9593\u3092\u8868\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"626\" height=\"1024\" src=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/100-samples-rr-0.8-ci-626x1024.png\" alt=\"\" class=\"wp-image-2054\" srcset=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/100-samples-rr-0.8-ci-626x1024.png 626w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/100-samples-rr-0.8-ci-183x300.png 183w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/100-samples-rr-0.8-ci.png 682w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>df$rr\u3001df$lower\u3001df$upper\u306b\u306f\u751f\u6210\u56de\u6570\u5206\u306e\u30ea\u30b9\u30af\u6bd4\u300195%\u4fe1\u983c\u533a\u9593\u306e\u4e0b\u9650\u5024\u3001\u4e0a\u9650\u5024\u3001\u3053\u306e\u4f8b\u3067\u306f100\u500b\u306e\u5024\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u4f8b\u3048\u3070\u3001df$rr[24], df$lower[24], df$upper[24]\u306724\u756a\u76ee\u306e\u30ea\u30b9\u30af\u6bd4\u300195%\u4fe1\u983c\u533a\u9593\u306e\u4e0b\u9650\u5024\u3001\u4e0a\u9650\u5024\u306e\u5024\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>1\u56de\u306e\u30e9\u30f3\u30c0\u30e0\u5316\u6bd4\u8f03\u8a66\u9a13\u3067\u5f97\u3089\u308c\u308b\u30ea\u30b9\u30af\u6bd4\u306e\u5024\u306f\u3053\u306e\u5024\u306e\u4e2d\u306e\u3069\u308c\u304b\u4e00\u3064\u306b\u306a\u308a\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u3082\u3057\u3001\u9078\u629e\u30d0\u30a4\u30a2\u30b9\u305d\u306e\u4ed6\u306e\u30d0\u30a4\u30a2\u30b9\u306e\u5f71\u97ff\u3092\u53d7\u3051\u308b\u3068\u3001\u30ea\u30b9\u30af\u6bd4\u306e\u5024\u306f\u904e\u5927\u8a55\u4fa1\u3042\u308b\u3044\u306f\u904e\u5c11\u8a55\u4fa1\u306e\u65b9\u5411\u3078\u5c11\u3057\u305a\u308c\u307e\u3059\u304c\u3001\u3053\u3053\u3067\u306f\u30d0\u30a4\u30a2\u30b9\u306f\u7121\u3044\u3053\u3068\u3092\u524d\u63d0\u3068\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u3001\u305f\u3068\u3048\u3070\u3001\u8d64\u3067\u793a\u3059\u30ea\u30b9\u30af\u6bd4\u306e\u5024\u304c\u5f97\u3089\u308c\u305f\u5834\u5408\u3001\u305d\u306e95%\u4fe1\u983c\u533a\u9593\u306b\u306f\u771f\u306e\u5024\u3067\u3042\u308b0.8\u306f\u542b\u307e\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4eca\u56de\u306e\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u8d64\u3067\u793a\u3059\u30ea\u30b9\u30af\u6bd4\u306f5\u500b\u3042\u308a\u3001100\u56de\u4e2d95\u56de\u306f\u305d\u306e95%\u4fe1\u983c\u533a\u9593\u306b\u771f\u306e\u5024\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u983b\u5ea6\u8ad6\u6d3e\u3067\u5f97\u3089\u308c\u308b95%\u4fe1\u983c\u533a\u9593\u306f\u540c\u3058\u3053\u3068\u3092100\u56de\u7e70\u308a\u8fd4\u3057\u305f\u3089\u300195\u56de\u306f\u771f\u306e\u5024\u3092\u542b\u3093\u3067\u3044\u308b\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002\u305d\u306e\u6642\u5f97\u3089\u308c\u305f\u4fe1\u983c\u533a\u9593\u306b\u306f\u771f\u306e\u5024\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u542b\u307e\u308c\u3066\u3044\u306a\u3044\u304b\u306e\u3069\u3061\u3089\u304b\u3067\u3059\u300295%\u4fe1\u983c\u533a\u9593\u304c\u3042\u305f\u304b\u3082\u771f\u306e\u5024\u306e\u5206\u5e03\u306b\u57fa\u3065\u3044\u3066\u3044\u308b\u3068\u3044\u3046\u98a8\u306b\u89e3\u91c8\u3059\u308b\u306e\u306f\u9593\u9055\u3044\u3067\u3059\u3002\u30ea\u30b9\u30af\u6bd4\u306e\u5024\u3082\u6bce\u56de\u7570\u306a\u308a\u307e\u3059\u304c\u3001\u4fe1\u983c\u533a\u9593\u306e\u5024\u3082\u6bce\u56de\u7570\u306a\u308b\u306e\u3067\u3001\u305d\u308c\u3060\u3051\u3067\u308295%\u4fe1\u983c\u533a\u9593\u304c\u3042\u305f\u304b\u3082\u771f\u306e\u5024\u306e\u5206\u5e03\u306b\u57fa\u3065\u3044\u3066\u3044\u308b\u3068\u3044\u3046\u98a8\u306b\u89e3\u91c8\u3059\u308b\u306e\u306f\u9593\u9055\u3044\u3060\u3068\u3044\u3046\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u983b\u5ea6\u8ad6\u6d3e\u3067\u5f97\u3089\u308c\u308b95%\u4fe1\u983c\u533a\u9593\u306b\u57fa\u3065\u3044\u3066\u3001\u4e00\u5b9a\u306e\u95be\u5024\u3001\u4f8b\u3048\u3070\u3001\u30ea\u30b9\u30af\u6bd41.0\u4ee5\u4e0a\u306e\u78ba\u7387\u3092\u8ad6\u3058\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u4eca\u56de\u306e\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308b100\u500b\u306e\u30ea\u30b9\u30af\u6bd4\u306e\u4f8b\u3092\u898b\u3066\u3082\u308f\u304b\u308b\u901a\u308a\u3001\u30ea\u30b9\u30af\u6bd41.0\u4ee5\u4e0a\u306e\u78ba\u7387\u306f\u6bce\u56de\u7570\u306a\u308a\u307e\u3059\u3002\u4fe1\u983c\u533a\u9593\u306f\u771f\u306e\u5024\u3042\u308b\u3044\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5206\u5e03\u306b\u57fa\u3065\u3044\u3066\u3044\u308b\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u540c\u3058\u8a66\u884c\u3092\u4f55\u56de\u3082\u7e70\u308a\u8fd4\u3057\u3001\u305d\u306e\u305f\u3073\u306b95%\u4fe1\u983c\u533a\u9593\u3092\u8a08\u7b97\u3059\u308b\u306895%\u306e\u5834\u5408\u306f\u3001\u771f\u306e\u5024\u304c\u305d\u306e\u533a\u9593\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4e0a\u8a18\u306e\u56f3\u3092\u898b\u308b\u3068\u3001\u30ea\u30b9\u30af\u6bd4\u306e\u5024\u306f\u771f\u306e\u5024\u3067\u3042\u308b\u30010.8\u306e\u8fd1\u304f\u306b\u591a\u3044\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3059\u3002\u30ea\u30b9\u30af\u6bd4\u306e\u5024\u306e\u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002100\u500b\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u304c\u3001\u751f\u6210\u56de\u6570\u3092\u591a\u304f\u3059\u308b\u3068\u3088\u308a\u9023\u7d9a\u7684\u306a\u30b9\u30e0\u30fc\u30ba\u306a\u78ba\u7387\u5bc6\u5ea6\u5206\u5e03\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"671\" src=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/100-samples-rr-0.8.png\" alt=\"\" class=\"wp-image-2055\" style=\"width:474px;height:auto\" srcset=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/100-samples-rr-0.8.png 672w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/100-samples-rr-0.8-300x300.png 300w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/100-samples-rr-0.8-150x150.png 150w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>\u3082\u3057\u3001\u771f\u306e\u5024\u304c\u5206\u304b\u3063\u3066\u3044\u308b\u306e\u3067\u3042\u308c\u3070\u3001\u30b5\u30f3\u30d7\u30eb\u30b5\u30a4\u30ba\u3068\u30a4\u30d9\u30f3\u30c8\u6570\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u306e\u3088\u3046\u306a\u5206\u5e03\u3092\u77e5\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30b5\u30f3\u30d7\u30eb\u30b5\u30a4\u30ba\u304c\u5927\u304d\u304f\u306a\u308c\u3070\u3001\u771f\u306e\u5024\u306b\u8fd1\u3065\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u8a00\u3048\u307e\u3059\u304c\u3001\u5b9f\u969b\u306b\u306f\u6709\u610f\u3067\u3042\u308b\u3053\u3068\u3092\u8a3c\u660e\u3067\u304d\u308b\u30b5\u30f3\u30d7\u30eb\u30b5\u30a4\u30ba\u3067\u306e1\u56de\u306e\u81e8\u5e8a\u8a66\u9a13\u306e\u5024\u3057\u304b\u77e5\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u3053\u306e\u3088\u3046\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5206\u5e03\u3092\u983b\u5ea6\u8ad6\u6d3e\u306e\u30a2\u30d7\u30ed\u30fc\u30c1\u3067\u306f\u77e5\u308b\u3053\u3068\u306f\u56f0\u96e3\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4e00\u65b9\u3001\u30d9\u30a4\u30b8\u30a2\u30f3\u306e\u30a2\u30d7\u30ed\u30fc\u30c1\u3067\u306f1\u56de\u306e\u8a66\u884c\u306e\u5024\u3092\u77e5\u308b\u3053\u3068\u3067\u3001\u305d\u308c\u306b\u57fa\u3065\u3044\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5206\u5e03\u3092\u77e5\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001\u3053\u3053\u3067\u306f\u30ea\u30b9\u30af\u6bd4\u306e\u771f\u306e\u5024\u306e\u5206\u5e03\u3068\u8003\u3048\u3066\u3082\u3044\u3044\u3067\u3057\u3087\u3046\u3002\u305d\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5206\u5e03\u306f\u305d\u306e\u30c7\u30fc\u30bf\u306b\u57fa\u3065\u3044\u3066\u3044\u3066\u3001\u4e00\u5b9a\u306e\u95be\u5024\u4ee5\u4e0a\u3042\u308b\u3044\u306f\u4ee5\u4e0b\u306e\u3001\u3042\u308b\u3044\u306f\u3042\u308b\u7bc4\u56f2\u306e\u78ba\u7387\u3092\u305d\u306e\u6642\u70b9\u3067\u8b70\u8ad6\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u3082\u3057\u3001\u540c\u3058\u7814\u7a76\u3092\u3082\u3046\u4e00\u5ea6\u884c\u3063\u305f\u5834\u5408\u3001\u305d\u308c\u4ee5\u524d\u306e\u30c7\u30fc\u30bf\u306b\u57fa\u3065\u304f\u5206\u5e03\u3092\u4e8b\u524d\u5206\u5e03\u3068\u3057\u3066\u3001\u305d\u306e\u65b0\u3057\u3044\u30c7\u30fc\u30bf\u3067\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3057\u3066\u4e8b\u5f8c\u5206\u5e03\u3092\u6c42\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>Stan\u3092rstan\u304b\u3089\u52d5\u304b\u3057\u3066\u3001\u5bfe\u7167\u7fa450\u4f8b\u306725\u4f8b\u306b\u30a4\u30d9\u30f3\u30c8\u304c\u8d77\u304d\u3001\u4ecb\u5165\u7fa450\u4f8b\u306720\u4f8b\u306b\u30a4\u30d9\u30f3\u30c8\u304c\u8d77\u304d\u305f\u3068\u3044\u3046\u30c7\u30fc\u30bf\u304c\u5f97\u3089\u308c\u305f\u5834\u5408\u306e\u3001\u30ea\u30b9\u30af\u6bd4\u306e\u4e8b\u5f8c\u5206\u5e03\u3092\u6c42\u3081\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u30a4\u30d9\u30f3\u30c8\u7387\u306e\u4e8b\u524d\u5206\u5e03\u306fbeta(1, 1);\u3067\u3059\u304c\u3001\u533a\u9593[0, 1]\u4e0a\u306e\u4e00\u69d8\u5206\u5e03\u3067\u3059\u3002\u5f93\u3063\u3066\u3001\u4e8b\u524d\u306b\u306f\u6709\u52b9\u6027\u306b\u95a2\u3057\u3066\u5168\u304f\u60c5\u5831\u304c\u306a\u3044\u72b6\u614b\u3067\u3059\u3002Stan, rstan\u306e\u4f7f\u3044\u65b9\u306b\u95a2\u3057\u3066\u306f\u3001<a href=\"\/index.php?p=1710\" target=\"_blank\" rel=\"noreferrer noopener\">\u4ee5\u524d\u306e\u6295\u7a3f<\/a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<details class=\"wp-block-liquid-accordion\" style=\"border-color:#00aeef\"><summary class=\"liquid-accordion-top\" style=\"color:#333333;background-color:#00aeef\">\u30d9\u30a4\u30b8\u30a2\u30f3\u30a2\u30d7\u30ed\u30fc\u30c1\u306b\u3088\u308b\u30ea\u30b9\u30af\u6bd4\u306e\u63a8\u5b9a\uff1aStan, rstan\u3092\u7528\u3044\u3066<\/summary><div class=\"liquid-accordion-bottom\">\n<pre class=\"wp-block-code\"><code>#Bayesian estimation of risk ratio with event rates in intervention group and comparator group.\n\nlibrary(rstan)\n\n# data \u4f8b\uff1a\u5bfe\u7167\u7fa4 25\/50\u3001\u4ecb\u5165\u7fa4 20\/50\u3001\u30ea\u30b9\u30af\u6bd40.8\nsampleSize &lt;- 50\ncevents    &lt;- 25\nievents    &lt;- 20\n\nstan_code &lt;- \"\ndata {\n  int&lt;lower=0&gt; N;        \/\/ \u5404\u7fa4\u306e\u30b5\u30f3\u30d7\u30eb\u30b5\u30a4\u30ba\uff08\u540c\u3058\uff09\n  int&lt;lower=0&gt; y_c;      \/\/ \u5bfe\u7167\u7fa4\u30a4\u30d9\u30f3\u30c8\u6570\n  int&lt;lower=0&gt; y_i;      \/\/ \u4ecb\u5165\u7fa4\u30a4\u30d9\u30f3\u30c8\u6570\n}\nparameters {\n  real&lt;lower=0, upper=1&gt; p_c;  \/\/ \u5bfe\u7167\u7fa4\u30a4\u30d9\u30f3\u30c8\u7387\n  real&lt;lower=0, upper=1&gt; p_i;  \/\/ \u4ecb\u5165\u7fa4\u30a4\u30d9\u30f3\u30c8\u7387\n}\nmodel {\n  \/\/ \u975e\u60c5\u5831\u4e8b\u524d Beta(1,1)\n  p_c ~ beta(1, 1);\n  p_i ~ beta(1, 1);\n  \n  \/\/ \u5c24\u5ea6\n  y_c ~ binomial(N, p_c);\n  y_i ~ binomial(N, p_i);\n}\ngenerated quantities {\n  real rr;\n  real log_rr;\n  rr = p_i \/ p_c;\n  log_rr = log(rr);\n}\n\"\n\n# \u30b3\u30f3\u30d1\u30a4\u30eb\nrstan_options(auto_write = TRUE)\noptions(mc.cores = parallel::detectCores())\n\nbayes_rr_stan &lt;- function(cevents, ievents, sampleSize,\n                          iter = 50000, warmup = 25000, chains = 4) {\n  \n  # Stan \u306b\u6e21\u3059\u30c7\u30fc\u30bf\n  stan_data &lt;- list(\n    N  = sampleSize,\n    y_c = cevents,\n    y_i = ievents\n  )\n  \n  # \u30e2\u30c7\u30eb\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\n  sm &lt;- stan_model(model_code = stan_code)\n  \n  # \u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\n  fit &lt;- sampling(\n    sm,\n    data   = stan_data,\n    iter   = iter,\n    warmup = warmup,\n    chains = chains,\n    seed   = 123\n  )\n  \n  # \u62bd\u51fa\n  post &lt;- rstan::extract(fit)\n  \n  rr_samples     &lt;- post$rr\n  log_rr_samples &lt;- post$log_rr\n  \n  # \u8981\u7d04\u7d71\u8a08\n  rr_mean   &lt;- mean(rr_samples)\n  rr_median &lt;- median(rr_samples)\n  ci_rr     &lt;- quantile(rr_samples, c(0.025, 0.975))\n  \n  list(\n    fit       = fit,          # rstan \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff08\u30c8\u30ec\u30fc\u30b9\u30d7\u30ed\u30c3\u30c8\u7b49\u306b\u4f7f\u3048\u308b\uff09\n    RR_mean   = rr_mean,\n    RR_median = rr_median,\n    RR_CI95   = ci_rr,\n    RR_samples = rr_samples,\n    logRR_samples = log_rr_samples\n  )\n}\n# Stan\u3067MCMC\u5b9f\u884c\nresult &lt;- bayes_rr_stan(cevents, ievents, sampleSize)\n\n# \u7d50\u679c\u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u51fa\u529b\nresult$RR_mean\nresult$RR_median\nresult$RR_CI95\n\n# \u4e8b\u5f8c\u5206\u5e03\u3092\u53ef\u8996\u5316\n#######Risk Ratio\nhist(result$RR_samples, breaks = 50,\n     main = \"Posterior of RR (Stan)\",\n     xlab = \"RR\", col = \"lightblue\", border = \"white\")\n\ndev.new()\nhist(result$RR_samples, breaks = 50,\n     main = \"Posterior of RR (Stan)\",\n     xlab = \"RR\", col = \"lightblue\", border = \"white\",\n     freq = FALSE)   # \u2605 \u5bc6\u5ea6\u8868\u793a\u306b\u3059\u308b\u306e\u304c\u91cd\u8981\n\n# \u5bc6\u5ea6\u66f2\u7dda\u3092\u8ffd\u52a0\nlines(density(result$RR_samples), \n      col = \"red\", lwd = 1)\ntext(1.5,1.5,paste(\"RR median =\",round(result$RR_median,3)))\n\n#######log Risk Ratio\ndev.new()\nhist(result$logRR_samples, breaks = 50,\n     main = \"Posterior of RR (Stan)\",\n     xlab = \"RR\", col = \"lightblue\", border = \"white\")\n\ndev.new()\nhist(result$logRR_samples, breaks = 50,\n     main = \"Posterior of RR (Stan)\",\n     xlab = \"RR\", col = \"lightblue\", border = \"white\",\n     freq = FALSE)   # \u2605 \u5bc6\u5ea6\u8868\u793a\u306b\u3059\u308b\u306e\u304c\u91cd\u8981\n\n# \u5bc6\u5ea6\u66f2\u7dda\u3092\u8ffd\u52a0\nlines(density(result$logRR_samples), \n      col = \"red\", lwd = 1)\ntext(0.5,1.0,paste(\"log RR mean =\",round(mean(result$logRR_samples),3)))\n############################<\/code><\/pre>\n<\/div><\/details>\n\n\n\n<p>\u30ea\u30b9\u30af\u6bd4\u306f\u4ee5\u4e0b\u306e\u56f3\u306e\u69d8\u306b\u306a\u308a\u307e\u3057\u305f\u3002iter = 50000, warmup = 25000, chains = 4\u306a\u306e\u3067\u300110\u4e07\u500b\u306e\u4e8b\u5f8c\u5206\u5e03\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002\u30ea\u30b9\u30af\u6bd4\u306e\u4e8b\u5f8c\u5206\u5e03\u306e\u30b5\u30f3\u30d7\u30eb\u306e\u4e2d\u592e\u50240.8058\u3001\u78ba\u4fe1\u533a\u9593 0.5179~1.2334\u3068\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"671\" src=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-16.png\" alt=\"\" class=\"wp-image-2057\" srcset=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-16.png 672w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-16-300x300.png 300w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-16-150x150.png 150w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>\u81ea\u7136\u5bfe\u6570\u306b\u5909\u63db\u3059\u308b\u3068\u3001\u5de6\u53f3\u5bfe\u79f0\u306e\u5206\u5e03\u3068\u306a\u308a\u6b63\u898f\u5206\u5e03\u306b\u8fd1\u4f3c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"671\" src=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-17.png\" alt=\"\" class=\"wp-image-2058\" srcset=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-17.png 672w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-17-300x300.png 300w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-17-150x150.png 150w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>\u30d9\u30a4\u30b8\u30a2\u30f3\u30a2\u30d7\u30ed\u30fc\u30c1\u306b\u3088\u308b\u30ea\u30b9\u30af\u6bd4\u306e\u5206\u5e03\u3067\u30ea\u30b9\u30af\u6bd4\u304c1.0\u4ee5\u4e0a\u306e\u78ba\u7387\u306f\u4e8b\u5f8c\u5206\u5e03\u306e\u30b5\u30f3\u30d7\u30eb\u304b\u3089\u3001mean(result$RR_samples &gt;= 1.0)\u3067\u6c42\u3081\u3089\u308c\u307e\u3059\u30020.15973\u3067\u3057\u305f\u3002\u304b\u306a\u308a\u306e\u78ba\u7387\u3067\u4ecb\u5165\u7fa4\u306e\u65b9\u3067\u3067\u30a4\u30d9\u30f3\u30c8\u6570\u304c\u3088\u308a\u591a\u304f\u306a\u308b\u3053\u3068\u304c\u3042\u308b\u3068\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3082\u3057\u3001\u5bfe\u7167\u7fa4\u3067\u306f50\u4f8b\u4e2d27\u4f8b\u3001\u4ecb\u5165\u7fa4\u3067\u306f50\u4f8b\u4e2d18\u4f8b\u3067\u30a4\u30d9\u30f3\u30c8\u304c\u8d77\u304d\u305f\u3068\u3044\u3046\u30c7\u30fc\u30bf\u3092\u5f97\u305f\u3068\u3057\u307e\u3059\u3002\u305d\u306e\u5834\u5408\u306e\u30ea\u30b9\u30af\u6bd4\u306e\u5024\u306f0.6899 (95%CI 0.4259~1.0334)\u3067\u30b0\u30e9\u30d5\u3067\u793a\u3059\u3068\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002\u3053\u306eCI\u306fCredible Interval\u3067\u3059\u3002mean(result$RR_samples &lt;= 0.8)\u3067\u30ea\u30b9\u30af\u6bd4\u304c0.8\u4ee5\u4e0b\u306e\u78ba\u7387\u3092\u6c42\u3081\u308b\u30680.78\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"671\" src=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-18.png\" alt=\"\" class=\"wp-image-2060\" srcset=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-18.png 672w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-18-300x300.png 300w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-18-150x150.png 150w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"671\" src=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-20.png\" alt=\"\" class=\"wp-image-2062\" srcset=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-20.png 672w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-20-300x300.png 300w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-20-150x150.png 150w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>\u306a\u304a\u3001\u81ea\u7136\u5bfe\u6570\u306b\u5909\u63db\u3057\u305f\u30b0\u30e9\u30d5\u3067\u306flog RR mean = -0.396\u306e\u63cf\u753b\u306e\u969btext(0.3,1.0,paste(&#8220;log RR mean =&#8221;,round(mean(result$logRR_samples),3)))\u3068\uff58\u5ea7\u6a19\u3092\u5c11\u3057\u5de6\u306b\u305a\u3089\u3057\u3066\u3044\u307e\u3059\u3002\uff09<\/p>\n\n\n\n<p>\u3055\u3089\u306b\u3001\u983b\u5ea6\u8ad6\u6d3e\u30a2\u30d7\u30ed\u30fc\u30c1\u3067100\u500b\u306e\u30ea\u30b9\u30af\u6bd4\u3092\u30b7\u30df\u30e5\u30ec\u30fc\u30c8\u3057\u305f\u7d50\u679c\u306e\u5185\u300195%\u4fe1\u983c\u533a\u9593\u306e\u7bc4\u56f2\u306b\u771f\u306e\u5024\u306e0.8\u304c\u542b\u307e\u308c\u306a\u304b\u3063\u305f\u4f8b\u3001\u5bfe\u7167\u7fa4\u306e\u30a4\u30d9\u30f3\u30c8\u657034\u3001\u4ecb\u5165\u7fa4\u306e\u30a4\u30d9\u30f3\u30c8\u657017\u306e\u5834\u5408\u306e\u30d9\u30a4\u30b8\u30a2\u30f3\u30a2\u30d7\u30ed\u30fc\u30c1\u3067\u306e\u30ea\u30b9\u30af\u6bd4\u3092\u5206\u6790\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u30ea\u30b9\u30af\u6bd40.5192 (95%CI 0.3240~0.7603)\u3068\u306a\u308a\u307e\u3057\u305f\u3002\u30ea\u30b9\u30af\u6bd4\u304c0.8\u4ee5\u4e0b\u306e\u78ba\u7387\u3092\u6c42\u3081\u308b\u30680.987\u3067\u3057\u305f\u3002\u3064\u307e\u308a\u3001\u3053\u306e95%\u78ba\u4fe1\u533a\u9593\u306b\u306f0.8\u306e\u5024\u306f\u542b\u307e\u308c\u306a\u3044\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"671\" src=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-21.png\" alt=\"\" class=\"wp-image-2063\" srcset=\"https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-21.png 672w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-21-300x300.png 300w, https:\/\/info.zanet.biz\/wp\/wp-content\/uploads\/2026\/01\/image-21-150x150.png 150w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>\u30e1\u30bf\u30a2\u30ca\u30ea\u30b7\u30b9\u306f\u307b\u3068\u3093\u3069\u306e\u5834\u5408\u3001\u983b\u5ea6\u8ad6\u6d3e\u306e\u624b\u6cd5\u304c\u7528\u3044\u3089\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u7d71\u5408\u5024\u3068\u305d\u306e95%\u4fe1\u983c\u533a\u9593\u306e\u89e3\u91c8\u3067\u3001\u30d9\u30a4\u30b8\u30a2\u30f3\u30a2\u30d7\u30ed\u30fc\u30c1\u306e\u89e3\u91c8\u306e\u4ed5\u65b9\u3092\u3057\u306a\u3044\u3088\u3046\u306b\u6ce8\u610f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3088\u308a\u5206\u304b\u308a\u3084\u3059\u3044\u89e3\u8aac\u3092Gamma.ai\u3067\u4f5c\u6210\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u3053\u3061\u3089\u3082\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<br>\u300c<a href=\"https:\/\/gamma.app\/docs\/-tg4djiqtm48a1p1?mode=doc\" target=\"_blank\" rel=\"noreferrer noopener\">\u983b\u5ea6\u8ad6\u6d3e\u306e\u4fe1\u983c\u533a\u9593\u3068\u30d9\u30a4\u30ba\u7d71\u8a08\u306e\u78ba\u4fe1\u533a\u9593\u306e\u9055\u3044<\/a>\u300d<\/p>\n\n\n\n<p>\u4ee5\u524d\u4f5c\u6210\u3057\u305fYouTube\u306e\u52d5\u753b\u3067\u3082\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<br>\u300c\u4fe1\u983c\u533a\u9593\u3068\u78ba\u4fe1\u533a\u9593\u306e\u89e3\u91c8\uff1a\u30d9\u30a4\u30b8\u30a2\u30f3\u3068\u983b\u5ea6\u8ad6\u6d3e\u300d<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"\u4fe1\u983c\u533a\u9593\u3068\u78ba\u4fe1\u533a\u9593\u306e\u89e3\u91c8\uff1a\u30d9\u30a4\u30b8\u30a2\u30f3\u3068\u983b\u5ea6\u8ad6\u6d3e\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/gIJfwKiqIP0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cochrane\u306eRevMan, R\u30d1\u30c3\u30b1\u30fc\u30b8\u306emeta, metafor\u3067\u7528\u3044\u3089\u308c\u3066\u3044\u308b\u30e1\u30bf\u30a2\u30ca\u30ea\u30b7\u30b9\u306e\u624b\u6cd5\u306f\u4f1d\u7d71\u7684\u7d71\u8a08\u5b66\u3059\u306a\u308f\u3061\u983b\u5ea6\u8ad6\u6d3eFrequentist\u306e\u624b\u6cd5\u3067\u3059\u3002\u4e00\u65b9\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30e1\u30bf\u30a2\u30ca\u30ea\u30b7\u30b9\u306e\u305f\u3081\u306eR\u30d1\u30c3 &hellip; <a href=\"https:\/\/info.zanet.biz\/?p=2053\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u983b\u5ea6\u8ad6\u6d3e\u306e\u4fe1\u983c\u533a\u9593\u3068\u30d9\u30a4\u30ba\u7d71\u8a08\u306e\u78ba\u4fe1\u533a\u9593\u306e\u9055\u3044&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,2],"tags":[],"class_list":["post-2053","post","type-post","status-publish","format-standard","hentry","category-statistics","category-sr"],"_links":{"self":[{"href":"https:\/\/info.zanet.biz\/index.php?rest_route=\/wp\/v2\/posts\/2053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/info.zanet.biz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/info.zanet.biz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/info.zanet.biz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/info.zanet.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2053"}],"version-history":[{"count":4,"href":"https:\/\/info.zanet.biz\/index.php?rest_route=\/wp\/v2\/posts\/2053\/revisions"}],"predecessor-version":[{"id":2075,"href":"https:\/\/info.zanet.biz\/index.php?rest_route=\/wp\/v2\/posts\/2053\/revisions\/2075"}],"wp:attachment":[{"href":"https:\/\/info.zanet.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/info.zanet.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/info.zanet.biz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}