{"id":477,"date":"2018-08-31T07:38:24","date_gmt":"2018-08-30T22:38:24","guid":{"rendered":"https:\/\/best-biostatistics.com\/toukei-er\/entry\/how-to-calculate-incidence-rate-ratio-in-r\/"},"modified":"2024-10-13T14:45:10","modified_gmt":"2024-10-13T05:45:10","slug":"how-to-calculate-incidence-rate-ratio-in-r","status":"publish","type":"post","link":"https:\/\/best-biostatistics.com\/toukei-er\/entry\/how-to-calculate-incidence-rate-ratio-in-r\/","title":{"rendered":"R \u3067\u7f79\u60a3\u7387\u6bd4\u3092\u6c42\u3081\u308b\u65b9\u6cd5"},"content":{"rendered":"\n<p>\u7f79\u60a3\u7387\u6bd4\u306e\u8a08\u7b97\u306f\u3001\u3069\u3046\u3084\u308b\u306e\u304b\uff1f<\/p>\n\n\n\n<p>R \u3067\u306e\u8a08\u7b97\u306e\u65b9\u6cd5\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u7f79\u60a3\u3068\u306f\u7f79\u60a3\u7387\u3068\u306f\">\u7f79\u60a3\u30fb\u7f79\u60a3\u7387\u30fb\u7f79\u60a3\u7387\u6bd4\u3068\u306f\uff1f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u7f79\u60a3\u308a\u304b\u3093\u3068\u306f\">\u7f79\u60a3\uff08\u308a\u304b\u3093\uff09\u3068\u306f\uff1f<\/h3>\n\n\n\n<p>\u7f79\u60a3\u3068\u306f\u75c5\u6c17\u306b\u304b\u304b\u308b\u3053\u3068\u3002<\/p>\n\n\n\n<p>\u75c5\u6c17\u306b\u304b\u304b\u3063\u305f\u3053\u3068\u306f\u3001\u8a3a\u65ad\u306b\u3088\u3063\u3066\u308f\u304b\u308b\u5834\u5408\u3068\u3001\u767a\u75c7\u306b\u3088\u3063\u3066\u308f\u304b\u308b\u5834\u5408\u304c\u3042\u308b\u3002<\/p>\n\n\n\n<p>\u8a3a\u65ad\u3068\u306f\u3001\u5916\u6765\u306e\u8a3a\u5bdf\u3067\u4e0b\u3055\u308c\u308b\u5834\u5408\u3084\u3001\u8840\u6db2\u691c\u67fb\u306e\u7d50\u679c\u3084\u3001CT\u3084MRI\u306e\u7d50\u679c\u3067\u5224\u65ad\u3055\u308c\u308b\u5834\u5408\u306a\u3069\u304c\u3042\u308b\u3002<\/p>\n\n\n\n<p>\u767a\u75c7\u3068\u306f\u75c7\u72b6\u304c\u51fa\u308b\u3053\u3068\u3002<\/p>\n\n\n\n<p><span style=\"font-size: 1rem;\">\u51b7\u3084\u6c57\u304c\u51fa\u308b\u307b\u3069\u80f8\u75db\u304c\u8d77\u304d\u3066\u6570\u5341\u5206\u7d9a\u3044\u305f\u3068\u304b\u3001<\/span>\u308d\u308c\u3064\u304c\u56de\u3089\u306a\u304f\u306a\u308a\u3001\u624b\u8db3\u304c\u9ebb\u75fa\u3057\u305f\u3068\u304b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u7f79\u60a3\u7387\u3068\u306f\">\u7f79\u60a3\u7387\u3068\u306f\uff1f<\/h3>\n\n\n\n<p>\u7387\u306f\u901f\u3055\u3092\u8a00\u3046\u3002<\/p>\n\n\n\n<p>\u3042\u308b\u4eba\u304c\u4f55\u5e74\u9593\u304b\u306e\u3046\u3061\u306b\u7f79\u60a3\u3057\u305f\u3068\u3044\u3046\u60c5\u5831\u3092\u96c6\u3081\u3066\u96c6\u8a08\u3059\u308b\u3002<\/p>\n\n\n\n<p>$$ \\frac{\u7f79\u60a3\u4eba\u6570}{\u5168\u4f53\u4eba\u6570 \\times \u4e00\u4eba\u3072\u3068\u308a\u306e\u89b3\u5bdf\u5e74\u6570} $$<\/p>\n\n\n\n\n\n\n\n<p>\u3068\u8a08\u7b97\u3059\u308b\u3002<\/p>\n\n\n\n<p>\u5206\u6bcd\u306f\u4eba\u5e74\uff08\u3058\u3093\u306d\u3093 or \u306b\u3093\u306d\u3093\uff09\u3002<\/p>\n\n\n\n<p>\u7814\u7a76\u30bf\u30a4\u30d7\u304c\u300c\u89b3\u5bdf\u300d\u7814\u7a76\u306a\u306e\u3067\u3001\u89b3\u5bdf\u4eba\u5e74\u3068\u547c\u3070\u308c\u308b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u7f79\u60a3\u7387\u6bd4\u3068\u306f\">\u7f79\u60a3\u7387\u6bd4\u3068\u306f\uff1f<\/h3>\n\n\n\n<p>\u305d\u308c\u3067\u306f\u3001\u7f79\u60a3\u7387\u6bd4\u3068\u306f\uff1f<\/p>\n\n\n\n<p>\u7f79\u60a3\u7387\u6bd4\u306f\u3001\u7f79\u60a3\u7387\u306e\u6bd4\u306e\u3053\u3068\u3002<\/p>\n\n\n\n<p>\u4f8b\u3048\u3070\u3001\u751f\u6d3b\u7fd2\u6163A\u3092\u6301\u3063\u3066\u3044\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u751f\u6d3b\u7fd2\u6163A\u3092\u6301\u3063\u3066\u3044\u306a\u3044\u30b0\u30eb\u30fc\u30d7\u306e\u6bd4\u3092\u3068\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u7f79\u60a3\u7387\u6bd4\u306f\u4f55\u306e\u305f\u3081\u306b\u8a08\u7b97\u3059\u308b\u306e\u304b\">\u7f79\u60a3\u7387\u6bd4\u306f\u4f55\u306e\u305f\u3081\u306b\u8a08\u7b97\u3059\u308b\u306e\u304b\uff1f<\/h2>\n\n\n\n<p>\u7f79\u60a3\u7387\u6bd4\u306f\u3001\u751f\u6d3b\u7fd2\u6163A\u3092\u6301\u3063\u3066\u3044\u308b\u30b0\u30eb\u30fc\u30d7\u304c\u751f\u6d3b\u7fd2\u6163A\u3092\u6301\u3063\u3066\u3044\u306a\u3044\u30b0\u30eb\u30fc\u30d7\u306b\u6bd4\u3079\u3066\u3001\u3069\u306e\u304f\u3089\u3044\u7f79\u60a3\u3057\u3084\u3059\u3044\u304b\u306e\u6307\u6a19\u306b\u306a\u308b\u304b\u3089\u3002<\/p>\n\n\n\n<p>\u751f\u6d3b\u7fd2\u6163A\u3092\u6301\u3063\u3066\u3044\u308b\u30b0\u30eb\u30fc\u30d7\u304c\u7f79\u60a3\u738710\u3060\u3068\u3057\u3066\u3001\u751f\u6d3b\u7fd2\u6163A\u3092\u6301\u3063\u3066\u3044\u306a\u3044\u30b0\u30eb\u30fc\u30d7\u304c\u7f79\u60a3\u73875\u3060\u3068\u3059\u308b\u3068\u300110\u00f75\u3067\u7f79\u60a3\u7387\u6bd4\u306f2\u3002<\/p>\n\n\n\n<p>\u7f79\u60a3\u7387\u6bd42\u306e\u610f\u5473\u306f\u3001\u300c\u751f\u6d3b\u7fd2\u6163A\u3092\u6301\u3063\u3066\u3044\u308b\u30b0\u30eb\u30fc\u30d7\u306f\u3001\u751f\u6d3b\u7fd2\u6163A\u3092\u6301\u3063\u3066\u3044\u306a\u3044\u30b0\u30eb\u30fc\u30d7\u306b\u6bd4\u3079\u3066\u30012\u500d\u7f79\u60a3\u3057\u3084\u3059\u3044\u300d\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u7d50\u679c\u304b\u3089\u306f\u3001\u300c\u3082\u3057\u751f\u6d3b\u7fd2\u6163A\u3092\u6301\u3063\u3066\u3044\u308b\u4eba\u304c\u3001\u751f\u6d3b\u7fd2\u6163A\u3092\u3084\u3081\u305f\u3089\u3001\u7f79\u60a3\u3057\u3084\u3059\u3055\u304c\u534a\u5206\u306b\u306a\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u300d\u3068\u89e3\u91c8\u3067\u304d\u308b\u3002<\/p>\n\n\n\n<p>\u7f79\u60a3\u7387\u6bd4\u306f\u3001\u751f\u6d3b\u7fd2\u6163A\u306a\u3069\u3001\u7f79\u60a3\u3092\u898f\u5b9a\u3057\u3066\u3044\u308b\u8981\u56e0\u3092\u898b\u3064\u3051\u3066\u3001\u6bd4\u306e\u5927\u304d\u3055\uff1d\u305d\u306e\u8981\u56e0\u306e\u95a2\u9023\u6027\u306e\u5f37\u3055\u304b\u3089\u3001\u5bfe\u7b56\u3092\u3068\u308b\u91cd\u8981\u306a\u30ea\u30b9\u30af\u30d5\u30a1\u30af\u30bf\u30fc\u304b\u3069\u3046\u304b\u3092\u898b\u6975\u3081\u308b\u305f\u3081\u306b\u6709\u7528\u306a\u6307\u6a19\u306a\u306e\u3060\u3002<\/p>\n\n\n\n<div id=\"biost-38781710\" class=\"biost- biost-entity-placement\"><p style=\"text-align: center;\"><span style=\"font-size: 20px;\"><strong><a href=\"https:\/\/best-biostatistics.com\/kmhl\">\uff1e\uff1e\u3082\u3046\u7d71\u8a08\u3067\u60a9\u3080\u306e\u306f\u7d42\u308f\u308a\u306b\u3057\u307e\u305b\u3093\u304b\uff1f\u00a0<\/a><\/strong><\/span><\/p>\r\n<a href=\"https:\/\/best-biostatistics.com\/kmhl\"><img class=\"aligncenter wp-image-2794 size-full\" src=\"https:\/\/best-biostatistics.com\/wp\/wp-content\/uploads\/2023\/11\/bn_r_03.png\" alt=\"\" width=\"500\" height=\"327\" \/><\/a>\r\n<p style=\"text-align: center;\"><span style=\"color: #ff0000; font-size: 20px;\"><strong><span class=\"marker2\">\u21911\u4e07\u4eba\u4ee5\u4e0a\u306e\u533b\u7642\u5f93\u4e8b\u8005\u304c\u8cfc\u8aad\u4e2d<\/span><\/strong><\/span><\/p><\/div><h2 class=\"wp-block-heading\" id=\"R\u3067\u7f79\u60a3\u7387\u6bd4\u306f\u3069\u3046\u3084\u3063\u3066\u8a08\u7b97\u3059\u308b\u306e\u304b\">R\u3067\u7f79\u60a3\u7387\u6bd4\u306f\u3069\u3046\u3084\u3063\u3066\u8a08\u7b97\u3059\u308b\u306e\u304b\uff1f<\/h2>\n\n\n\n<p>R\u3067\u306f\u3001epitools\u30d1\u30c3\u30b1\u30fc\u30b8\u306erateratio()\u3092\u4f7f\u3063\u3066\u3001\u7c21\u5358\u306b\u8a08\u7b97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n\n\n\n<p>\u307e\u305a\u6700\u521d\u4e00\u56de\u3060\u3051\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>install.packages(\"epitools\")<\/code><\/pre>\n\n\n\n<p>epitools\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u547c\u3073\u51fa\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>library(epitools)<\/code><\/pre>\n\n\n\n<p>\u3042\u308b\u8981\u56e0\u3078\u306e\u66dd\u9732\u306a\u3057\u30b0\u30eb\u30fc\u30d7\u306e\u7f79\u60a3\u4eba\u6570\u304c15\u4eba\u3001<\/p>\n\n\n\n<p>\u3042\u308b\u8981\u56e0\u3078\u306e\u66dd\u9732\u3042\u308a\u30b0\u30eb\u30fc\u30d7\u306e\u7f79\u60a3\u4eba\u6570\u304c41\u4eba\u3001<\/p>\n\n\n\n<p>\u66dd\u9732\u306a\u3057\u30b0\u30eb\u30fc\u30d7\u306e\u89b3\u5bdf\u4eba\u5e74\u304c19017\u4eba\u5e74\u3001<\/p>\n\n\n\n<p>\u66dd\u9732\u3042\u308a\u30b0\u30eb\u30fc\u30d7\u306e\u89b3\u5bdf\u4eba\u5e74\u304c28010\u4eba\u5e74\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bc &lt;- c(Unexposed = 15, Exposed = 41)\npyears &lt;- c(Unexposed = 19017, Exposed = 28010)\ndd &lt;- matrix(c(41,15,28010,19017),2,2)\ndimnames(dd) &lt;- list(Exposure=c(\"Yes\",\"No\"), Outcome=c(\"BC\",\"PYears\"))<\/code><\/pre>\n\n\n\n<p>\u8a08\u7b97\u7d50\u679c\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>> dd\nOutcome\nExposure BC PYears\nYes 41  28010\nNo  15  19017<\/code><\/pre>\n\n\n\n<p>\u7f79\u60a3\u7387\u6bd4\u306e\u8a08\u7b97\u3092\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rateratio(bc,pyears)<\/code><\/pre>\n\n\n\n<p>\u7d50\u679c\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u51fa\u529b\u3055\u308c\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>> rateratio(bc,pyears)\n$data\n          bc pyears\nUnexposed 15  19017\nExposed   41  28010\nTotal     56  47027\n\n$measure\n                        NA\nrate ratio with 95% C.I. estimate    lower    upper\n               Unexposed 1.000000       NA       NA\n               Exposed   1.842977 1.041036 3.449052\n\n$p.value\n           Outcome\nPredictor   midp.exact       wald\n  Unexposed         NA         NA\n  Exposed   0.03545742 0.03736289\n\nattr(,\"method\")\n&#91;1] \"Median unbiased estimate &amp; mid-p exact CI\"<\/code><\/pre>\n\n\n\n<p>\u7f79\u60a3\u7387\u6bd4\u306f1.842977\u3068\u8a08\u7b97\u3055\u308c\u308b\u3002<\/p>\n\n\n\n<p>\u66dd\u9732\u3042\u308a\u30b0\u30eb\u30fc\u30d7\u306f\u3001\u66dd\u9732\u306a\u3057\u30b0\u30eb\u30fc\u30d7\u306e1.8\u500d\u7f79\u60a3\u3057\u3084\u3059\u3044\u3068\u3044\u3046\u7d50\u679c\u3002<\/p>\n\n\n\n<p>\u7f79\u60a3\u7387\u6bd4\u306f\u3001\u70b9\u63a8\u5b9a\u5024\u3067\u3082\u3042\u308b\u3002<\/p>\n\n\n\n<p>\u533a\u9593\u63a8\u5b9a\u3059\u308b\u3068\u300195\uff05 \u4fe1\u983c\u533a\u9593\u306f\u30011.041036 \u304b\u3089 3.449052 \u3068\u3044\u3046\u533a\u9593\u3067\u63a8\u5b9a\u3055\u308c\u308b\u3002<\/p>\n\n\n\n<p>\u3061\u306a\u307f\u306b\u300195%\u4fe1\u983c\u533a\u9593\u306e\u610f\u5473\u5408\u3044\u306f\u3001\u4eca\u56de\u3068\u540c\u3058\u3088\u3046\u306a\u533a\u9593\u63a8\u5b9a\u3092100\u56de\u884c\u3063\u305f\u6642\u306b\u300195\u56de\u306f\u3001\u6bcd\u96c6\u56e3\u306e\u70b9\u63a8\u5b9a\u5024\u3092\u542b\u3093\u3067\u3044\u308b\u533a\u9593\u306e\u3053\u3068\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<p>95%\u4fe1\u983c\u533a\u9593\u306e\u4e0b\u9650\u304c\u30011\u3092\u8d85\u3048\u3066\u3044\u308b\u306e\u3067\u3001\u7f79\u60a3\u7387\u6bd4 1.842977 \u306f\u7d71\u8a08\u5b66\u7684\u6709\u610f\u306b\u30011 \u3068\u306f\u7570\u306a\u308b\u3068\u8a00\u3048\u308b\u3002<\/p>\n\n\n\n<p>p\u5024\u30820.03545742\u3068\u30010.05\u672a\u6e80\u3067\u3001\u7d71\u8a08\u5b66\u7684\u6709\u610f\u3068\u8a00\u3048\u308b\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h2>\n\n\n\n<p>\u7f79\u60a3\u3068\u306f\u3001\u75c5\u6c17\u306b\u304b\u304b\u308b\u3053\u3068\u3002<\/p>\n\n\n\n<p>\u7f79\u60a3\u7387\u3068\u306f\u3001\u89b3\u5bdf\u4eba\u5e74\u3067\u7f79\u60a3\u4eba\u6570\u3092\u5272\u3063\u305f\u3001\u7f79\u60a3\u3057\u3084\u3059\u3055\uff08\u901f\u5ea6\uff09\u306e\u3053\u3068\u3002<\/p>\n\n\n\n<p>\u7f79\u60a3\u7387\u6bd4\u3068\u306f\u3001\u7f79\u60a3\u7387\u540c\u58eb\u306e\u6bd4\u3067\u3001\u3042\u308b\u8981\u56e0\u3042\u308a\u306e\u8981\u56e0\u306a\u3057\u306b\u5bfe\u3059\u308b\u76f8\u5bfe\u7684\u306a\u7f79\u60a3\u3057\u3084\u3059\u3055\u306e\u3053\u3068\u3002<\/p>\n\n\n\n<p>R\u3067\u306fepitools\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u7f79\u60a3\u7387\u6bd4\u304c\u8a08\u7b97\u3067\u304d\u308b\u3002<\/p>\n\n\n\n<p>\u53c2\u8003\u306b\u306a\u308c\u3070\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7f79\u60a3\u7387\u6bd4\u306e\u8a08\u7b97\u306f\u3001\u3069\u3046\u3084\u308b\u306e\u304b\uff1f R \u3067\u306e\u8a08\u7b97\u306e\u65b9\u6cd5\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,129],"tags":[],"class_list":["post-477","post","type-post","status-publish","format-standard","hentry","category-r","category-129"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts\/477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/comments?post=477"}],"version-history":[{"count":5,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts\/477\/revisions"}],"predecessor-version":[{"id":2779,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts\/477\/revisions\/2779"}],"wp:attachment":[{"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/media?parent=477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/categories?post=477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/tags?post=477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}