{"id":3005,"date":"2024-10-13T22:09:14","date_gmt":"2024-10-13T13:09:14","guid":{"rendered":"https:\/\/secondlife.lol\/?p=3005"},"modified":"2024-10-15T17:56:22","modified_gmt":"2024-10-15T08:56:22","slug":"kaplan-meier-survival-analysis-r-intro","status":"publish","type":"post","link":"https:\/\/secondlife.lol\/ja\/kaplan-meier-survival-analysis-r-intro\/","title":{"rendered":"\u30b5\u30d0\u30a4\u30d0\u30eb\u5206\u6790\uff1f \u96e3\u3057\u304f\u306a\u3044\u3088\uff01R\u3067Kaplan-Meier\u30e2\u30c7\u30eb\u3092\u7c21\u5358\u306b\u7406\u89e3\u3057\u3088\u3046"},"content":{"rendered":"<p class=\"wp-block-paragraph\">\u30b5\u30d0\u30a4\u30d0\u30eb\u5206\u6790\u3068\u3044\u3046\u8a00\u8449\u3092\u805e\u3044\u305f\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u304b\uff1f \u521d\u3081\u3066\u805e\u304f\u3068\u96e3\u3057\u3044\u3068\u611f\u3058\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u5b9f\u306f\u77e5\u3063\u3066\u307f\u308b\u3068\u305d\u308c\u307b\u3069\u8907\u96d1\u306a\u6982\u5ff5\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 \u4eca\u65e5\u306f <strong><a href=\"https:\/\/www.ibm.com\/docs\/ko\/spss-statistics\/saas?topic=statistics-kaplan-meier-survival-analysis\" target=\"_blank\" rel=\"noopener\">Kaplan-Meier \u751f\u5b58\u5206\u6790\u30e2\u30c7\u30eb<\/a>\u3092R\u3092\u4f7f\u3063\u3066\u7c21\u5358\u306b\u7d39\u4ecb<\/strong>\u3084\u3063\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u751f\u5b58\u5206\u6790\u306f\u4e3b\u306b\u30e9\u30a4\u30d5\u30b5\u30a4\u30a8\u30f3\u30b9\u3084\u533b\u5b66\u7814\u7a76\u3067\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u304c\u3001 <strong>\u9867\u5ba2\u96e2\u8131\u5206\u6790<\/strong>\u30a4\u30ca <strong>\u88fd\u54c1\u306e\u5bff\u547d<\/strong>\u3092\u6e2c\u5b9a\u3059\u308b\u306e\u306b\u3082\u3088\u304f\u4f7f\u308f\u308c\u308b\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002\u751f\u5b58\u5206\u6790\u306e\u4ee3\u8868\u7684\u306a\u30e2\u30c7\u30eb\u3067\u3042\u308bKaplan-Meier\u30e2\u30c7\u30eb\u3092\u4f8b\u3068\u3057\u3066\u4e00\u7dd2\u306b\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n<style>.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap{padding-top:var(--global-kb-spacing-sm, 1.5rem);padding-right:var(--global-kb-spacing-sm, 1.5rem);padding-bottom:var(--global-kb-spacing-sm, 1.5rem);padding-left:var(--global-kb-spacing-sm, 1.5rem);border-top:3px solid var(--global-palette2, #2B6CB0);border-right:3px solid var(--global-palette2, #2B6CB0);border-bottom:3px solid var(--global-palette2, #2B6CB0);border-left:3px solid var(--global-palette2, #2B6CB0);border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;box-shadow:0px 0px 14px 0px rgba(0, 0, 0, 0.2);}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title-wrap{padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title-wrap{color:var(--global-palette2, #2B6CB0);}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title{color:var(--global-palette2, #2B6CB0);font-size:28px;font-weight:regular;font-style:normal;}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap .kb-table-of-content-list{color:var(--global-palette1, #3182CE);line-height:2em;font-weight:regular;font-style:normal;margin-top:var(--global-kb-spacing-sm, 1.5rem);margin-right:0px;margin-bottom:0px;margin-left:0px;}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap .kb-table-of-content-list .kb-table-of-contents__entry:hover{color:var(--global-palette6, #718096);}@media all and (max-width: 1024px){.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap{border-top:3px solid var(--global-palette2, #2B6CB0);border-right:3px solid var(--global-palette2, #2B6CB0);border-bottom:3px solid var(--global-palette2, #2B6CB0);border-left:3px solid var(--global-palette2, #2B6CB0);}}@media all and (max-width: 1024px){.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title{font-size:28px;}}@media all and (max-width: 767px){.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap{border-top:3px solid var(--global-palette2, #2B6CB0);border-right:3px solid var(--global-palette2, #2B6CB0);border-bottom:3px solid var(--global-palette2, #2B6CB0);border-left:3px solid var(--global-palette2, #2B6CB0);}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title{font-size:28px;}}<\/style>\n\n\n<h2 class=\"wp-block-heading\">Kaplan-Meier\u751f\u5b58\u5206\u6790\u3068\u306f\uff1f<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u751f\u5b58\u5206\u6790\u306f\u3001\u6642\u9593\u306e\u7d4c\u904e\u3068\u3068\u3082\u306b <strong>\u4e8b\u4ef6\uff08\u4f8b\uff1a\u5ec3\u696d\u3001\u96e2\u8131\u3001\u6b7b\u4ea1\u306a\u3069\uff09\u3002<\/strong>\u304c\u767a\u751f\u3059\u308b\u78ba\u7387\u3092\u63a8\u5b9a\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002 \u3053\u306e\u30e2\u30c7\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u7279\u5b9a\u306e\u30a4\u30d9\u30f3\u30c8\u304c\u767a\u751f\u3059\u308b\u307e\u3067\u306e\u6642\u9593\u3092\u5206\u6790\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u4f8b\u3048\u3070\u3001 <strong>\u9867\u5ba2\u304c\u30b5\u30fc\u30d3\u30b9\u304b\u3089\u96e2\u8131\u3059\u308b\u78ba\u7387<\/strong>\u30a4\u30ca <strong>\u88fd\u54c1\u304c\u6545\u969c\u3059\u308b\u307e\u3067\u306e\u671f\u9593<\/strong>\u3092\u6e2c\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Kaplan-Meier\u30e2\u30c7\u30eb\u306f\u751f\u5b58\u66f2\u7dda\u3092\u4f5c\u3063\u3066 <strong>\u6642\u9593\u306e\u7d4c\u904e\u3068\u3068\u3082\u306b\u30a4\u30d9\u30f3\u30c8\u304c\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027<\/strong>\u3092\u8996\u899a\u7684\u306b\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u66f2\u7dda\u304c\u4e0b\u304c\u308b\u305f\u3073\u306b\u30a4\u30d9\u30f3\u30c8\u304c\u767a\u751f\u3057\u305f\u3053\u3068\u3092\u610f\u5473\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7c21\u5358\u306a\u4f8b\u3067Kaplan-Meier\u30e2\u30c7\u30eb\u3092\u5b66\u3076<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u305d\u308c\u3067\u306f\u3001\u5b9f\u751f\u6d3b\u3067\u5fdc\u7528\u3067\u304d\u308b\u7c21\u5358\u306a\u4f8b\u3092\u6319\u3052\u3066\u307f\u307e\u3057\u3087\u3046\u3002 <strong>\u9867\u5ba2\u96e2\u8131\u5206\u6790<\/strong>\u3092\u4f8b\u306b\u3068\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002 10\u4eba\u306e\u9867\u5ba2\u304c\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u3068\u4eee\u5b9a\u3057\u307e\u3059\u3002\u3053\u306e\u3046\u3061\u4f55\u4eba\u306f\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u3044\u7d9a\u3051\u3001\u4f55\u4eba\u306f\u96e2\u8131\u3059\u308b\u3067\u3057\u3087\u3046\u304b\uff1f Kaplan-Meier\u30e2\u30c7\u30eb\u3092\u4f7f\u3063\u3066\u96e2\u8131\u3059\u308b\u78ba\u7387\u3092\u5206\u6790\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">R\u30b3\u30fc\u30c9\u3092\u4f7f\u3063\u3066\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u3092\u53ef\u8996\u5316\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002\nlibrary(survival)\nlibrary(survminer)\n\n# 10\u4eba\u306e\u9867\u5ba2\u30c7\u30fc\u30bf\u3092\u751f\u6210\u3057\u307e\u3059\u3002\n# \u9867\u5ba2\u304c\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u305f\u5e74\u3068\u96e2\u8131\u3057\u305f\u5e74\u3092\u8a18\u9332\u3057\u307e\u3059\u3002\ndata &lt;- data.frame(\n    customer = 1:10\u3001\n    start_year = rep(2020, 10), # \u3059\u3079\u3066\u306e\u9867\u5ba2\u304c2020\u5e74\u306b\u30b5\u30fc\u30d3\u30b9\u3092\u958b\u59cb\u3057\u307e\u3059\u3002\n    leave_year = c(2021, NA, 2022, NA, 2023, 2024, NA, NA, NA, 2023, 2024) # \u96e2\u8131\u3057\u3066\u3044\u306a\u3044\u5834\u5408 NA\n)\n\n# \u9867\u5ba2\u304c\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u305f\u671f\u9593\u3092\u8a08\u7b97\u3057\u307e\u3059\u3002\ndata$time_in_service &lt;- ifelse(is.na(data$leave_year), 2024 - data$start_year, data$leave_year - data$start_year)\n\n#\u9867\u5ba2\u306e\u96e2\u8131\u306e\u6709\u7121\u30921\u30680\u3067\u8868\u793a\u3057\u307e\u3059(1: \u96e2\u8131\u30010: \u307e\u3060\u4f7f\u7528\u4e2d)\u3002\ndata$status &lt;- ifelse(is.na(data$leave_year), 0, 1)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u30b3\u30fc\u30c9\u306e\u8aac\u660e\uff1a<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30c7\u30fc\u30bf\u751f\u6210<\/strong>\u3092\u4f5c\u6210\u3057\u307e\u3059\uff1a2020\u5e74\u306b\u30b5\u30fc\u30d3\u30b9\u3092\u958b\u59cb\u3057\u305f10\u4eba\u306e\u9867\u5ba2\u30c7\u30fc\u30bf\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u4e00\u90e8\u306e\u9867\u5ba2\u306f2021\u5e74\u304b\u3089\u96e2\u8131\u3057\u59cb\u3081\u3001\u6b8b\u308a\u306e\u9867\u5ba2\u306f\u307e\u3060\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u96e2\u8131\u671f\u9593\u306e\u8a08\u7b97<\/strong>: \u5404\u9867\u5ba2\u304c\u4f55\u5e74\u9593\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u7528\u3057\u305f\u304b\u3092\u8a08\u7b97\u3057\u307e\u3059\u3002\u96e2\u8131\u3057\u3066\u3044\u306a\u3044\u304a\u5ba2\u69d8\u306f\u30012024\u5e74\u307e\u3067\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u305f\u3082\u306e\u3068\u307f\u306a\u3055\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u96e2\u8131\u306e\u6709\u7121<\/strong>: \u9867\u5ba2\u304c\u96e2\u8131\u3057\u305f\u304b\u3069\u3046\u304b\u30921(\u96e2\u8131)\u30680(\u307e\u3060\u4f7f\u7528\u4e2d)\u3067\u8868\u793a\u3057\u307e\u3059\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Kaplan-Meier \u30b5\u30d0\u30a4\u30d0\u30eb\u30ab\u30fc\u30d6\u306e\u53ef\u8996\u5316<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u305d\u308c\u3067\u306f\u3001\u30c7\u30fc\u30bf\u3092\u3082\u3068\u306bKaplan-Meier\u751f\u5b58\u66f2\u7dda\u3092\u63cf\u3044\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u9867\u5ba2\u304c\u3069\u308c\u304f\u3089\u3044\u9577\u304f\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u305f\u304b\u3092\u8996\u899a\u7684\u306b\u793a\u3059\u66f2\u7dda\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Kaplan-Meier \u751f\u5b58\u30e2\u30c7\u30eb\u3092\u9069\u7528\u3057\u307e\u3059\u3002\nfit &lt;- survfit(Surv(time_in_service, status) ~ 1, data = data)\n\n# \u751f\u5b58\u66f2\u7dda\u3092\u53ef\u8996\u5316\u3057\u307e\u3059 (\u30c7\u30fc\u30bf\u3092\u660e\u793a\u7684\u306b\u6e21\u3057\u307e\u3059).\nggsurvplot(fit\u3001\n           data = data, # ggsurvplot\u306b\u30c7\u30fc\u30bf\u3092\u6e21\u3057\u307e\u3059\u3002\n           conf.int = TRUE, #\u4fe1\u983c\u533a\u9593\u3092\u8868\u793a\u3059\u308b\n           xlab = &quot;\u30b5\u30fc\u30d3\u30b9\u4f7f\u7528\u671f\u9593(\u5e74)&quot;, # x\u8ef8\u30e9\u30d9\u30eb\n           ylab = &quot;\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u9867\u5ba2\u306e\u5272\u5408&quot;, # y\u8ef8\u30e9\u30d9\u30eb\n           title = &quot;\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u9867\u5ba2\u306e\u751f\u5b58\u66f2\u7dda&quot;, # \u30b0\u30e9\u30d5\u30bf\u30a4\u30c8\u30eb\n           palette = &quot;blue&quot;\u3001#\u30b0\u30e9\u30d5\u306e\u8272\n           risk.table = TRUE, # \u5404\u5e74\u5ea6\u306e\u30ea\u30b9\u30af\u30c6\u30fc\u30d6\u30eb\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\n           ggtheme = theme_minimal()) #\u30df\u30cb\u30de\u30ea\u30b9\u30c8\u30c6\u30fc\u30de\u9069\u7528<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u30b3\u30fc\u30c9\u306e\u8aac\u660e\uff1a<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Kaplan-Meier\u30e2\u30c7\u30eb\u306e\u9069\u7528<\/strong>: \u9867\u5ba2\u30c7\u30fc\u30bf\u306bKaplan-Meier\u751f\u5b58\u30e2\u30c7\u30eb\u3092\u9069\u7528\u3057\u3001\u96e2\u8131\u78ba\u7387\u3092\u8a08\u7b97\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u751f\u5b58\u66f2\u7dda\u306e\u53ef\u8996\u5316<\/strong>: <code>ggsurvplot<\/code> \u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u3001\u30b5\u30fc\u30d3\u30b9\u5229\u7528\u671f\u9593\u306b\u3088\u308b\u9867\u5ba2\u306e\u751f\u5b58\u66f2\u7dda\u3092\u63cf\u304d\u307e\u3059\u3002 <code>conf.int = TRUE<\/code>\u306f\u4fe1\u983c\u533a\u9593\u3092\u793a\u3057\u3001\u7d50\u679c\u306e\u4fe1\u983c\u6027\u3092\u9ad8\u3081\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30ea\u30b9\u30af\u30c6\u30fc\u30d6\u30eb\u306e\u8ffd\u52a0<\/strong>: \u5404\u5e74\u5ea6\u3054\u3068\u306b\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u9867\u5ba2\u6570\u3092\u8868\u793a\u3059\u308b\u30c6\u30fc\u30d6\u30eb\u3092\u30b0\u30e9\u30d5\u306e\u4e0b\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u53ef\u8996\u5316\u7d50\u679c\u306e\u89e3\u91c8<\/h2>\n\n\n<style>.kb-image3005_40e803-c7 .kb-image-has-overlay:after{opacity:0.3;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;}.kb-image3005_40e803-c7 img.kb-img, .kb-image3005_40e803-c7 .kb-img img{border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;box-shadow:0px 0px 14px 0px rgba(0, 0, 0, 0.2);}<\/style>\n<div class=\"wp-block-kadence-image kb-image3005_40e803-c7\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"1200\" height=\"613\" src=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/10\/image-1-26.jpg\" alt=\"Kaplan-Meier \uc0dd\uc874 \ubd84\uc11d \uc2dc\uac01\ud654\" class=\"kb-img wp-image-3006\" srcset=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/10\/image-1-26.jpg 1200w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/10\/image-1-26-300x153.jpg 300w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/10\/image-1-26-600x307.jpg 600w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/10\/image-1-26-768x392.jpg 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">1.\u30b5\u30d0\u30a4\u30d0\u30eb\u30ab\u30fc\u30d6\u306e\u6982\u8981<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u3053\u306e\u30b0\u30e9\u30d5\u306f\u3001\u30b5\u30fc\u30d3\u30b9\u5229\u7528\u9867\u5ba2\u306e\u751f\u5b58\u66f2\u7dda\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>x\u8ef8<\/strong>\u306f\u30b5\u30fc\u30d3\u30b9\u5229\u7528\u671f\u9593(\u5e74)\u3092\u793a\u3057\u307e\u3059\u3001 <strong>Y\u8ef8<\/strong>\u306f\u3001\u307e\u3060\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u304a\u5ba2\u69d8\u306e\u5272\u5408\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u5f53\u521d\u306f\u3059\u3079\u3066\u306e\u9867\u5ba2(100%)\u304c\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3066\u304a\u308a\u3001\u6642\u9593\u304c\u7d4c\u3064\u306b\u3064\u308c\u3066\u9867\u5ba2\u304c\u96e2\u8131\u3057\u3001\u751f\u5b58\u66f2\u7dda\u304c\u6bb5\u968e\u7684\u306b\u4f4e\u4e0b\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2.\u66f2\u7dda\u306e\u4e3b\u306a\u30dd\u30a4\u30f3\u30c8<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30b0\u30e9\u30d5\u306f <strong>0\u5e74<\/strong>\u304b\u3089\u59cb\u307e\u308a\u3001\u6700\u521d\u306f\u3059\u3079\u3066\u306e\u9867\u5ba2(10\u4eba)\u304c\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>1\u5e74<\/strong>\u304c\u7d4c\u904e\u3057\u3066\u6700\u521d\u306e\u9038\u8131\u304c\u767a\u751f\u3057\u3001\u3053\u306e\u6642\u3001\u751f\u5b58\u66f2\u7dda\u304c100%\u3067\u7d04100%\u3067\u3001\u7d04 <strong>90%<\/strong>\u306b\u843d\u3061\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>2\u5e74<\/strong>\u304c\u904e\u304e\u308b\u3068\u518d\u3073\u96e2\u8131\u304c\u767a\u751f\u3057\u3001\u30b5\u30d0\u30a4\u30d0\u30eb\u66f2\u7dda\u304c <strong>\u7d0480%<\/strong>\u306b\u843d\u3061\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>3\u5e74<\/strong> \u4ee5\u6765\u3001\u751f\u5b58\u66f2\u7dda\u304c\u518d\u3073\u4e0b\u964d\u3057\u3066\u3044\u307e\u3059\u3001 <strong>60%<\/strong>\u306e\u304a\u5ba2\u69d8\u3060\u3051\u304c\u6b8b\u3063\u3066\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u3044\u7d9a\u3051\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>4\u5e74<\/strong> \u6642\u70b9\u3067\u306f\u3001\u751f\u5b58\u66f2\u7dda\u304c\u3055\u3089\u306b\u4e0b\u304c\u308a\u3001\u6700\u7d42\u7684\u306b\u306f\u3001\u7d04 <strong>50%<\/strong>\u306e\u304a\u5ba2\u69d8\u3060\u3051\u304c\u6b8b\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3.\u4fe1\u983c\u533a\u9593\uff08\u30b0\u30ec\u30fc\u30b7\u30a7\u30fc\u30c9\uff09<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u9752\u3044\u751f\u5b58\u66f2\u7dda\u5468\u8fba\u306e <strong>\u30b0\u30ec\u30fc\u306e\u8272\u5408\u3044<\/strong>\u306f <strong>\u4fe1\u983c\u533a\u9593(Confidence Interval)<\/strong>\u3092\u8868\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u3053\u308c\u306f\u3001\u5404\u30dd\u30a4\u30f3\u30c8\u3067\u306e\u751f\u5b58\u78ba\u7387\u306e\u4fe1\u983c\u5ea6\u3092\u793a\u3057\u3001\u9670\u5f71\u304c\u5e83\u3044\u307b\u3069\u4e88\u6e2c\u306e\u4e0d\u78ba\u5b9f\u6027\u304c\u5927\u304d\u3044\u3053\u3068\u3092\u610f\u5473\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u4fe1\u983c\u533a\u9593\u306f\u30b5\u30d0\u30a4\u30d0\u30eb\u30ab\u30fc\u30d6\u304c\u4e0b\u304c\u308b\u305f\u3073\u306b\u5e83\u304c\u308a\u3001\u6642\u9593\u306e\u7d4c\u904e\u3068\u3068\u3082\u306b\u4e88\u6e2c\u306e\u4e0d\u78ba\u5b9f\u6027\u304c\u5927\u304d\u304f\u306a\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">4.\u5371\u967a\u306b\u3055\u3089\u3055\u308c\u3066\u3044\u308b\u6570\uff08Number at Risk\uff09\u8868<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30b0\u30e9\u30d5\u306e\u4e0b\u90e8\u306b\u300cNumber at Risk\u300d\u3068\u3044\u3046\u8868\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u3053\u306e\u8868\u306f\u3001\u5404\u5e74\u5ea6\u3054\u3068\u306b\u307e\u3060\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u304a\u5ba2\u69d8\u306e\u6570\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>0\u5e74<\/strong> \u73fe\u6642\u70b9\u3067\u306f\u300110\u540d\u306e\u304a\u5ba2\u69d8\u5168\u54e1\u304c\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u4e2d\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>1\u5e74<\/strong> \u5f8c\u306f9\u4eba\u306e\u304a\u5ba2\u3055\u3093\u304c\u6b8b\u3063\u3066\u3044\u3066\u3001 <strong>2\u5e74<\/strong> \u5f8c\u306f8\u4eba\u3001 <strong>3\u5e74<\/strong> \u305d\u306e\u5f8c\u30826\u4eba\u304c\u307e\u3060\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">5.\u66f2\u7dda\u89e3\u6790<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u751f\u5b58\u66f2\u7dda\u306e\u4f4e\u4e0b<\/strong>\u66f2\u7dda\u304c\u4e0b\u964d\u3057\u3066\u3044\u308b\u90e8\u5206\u306f\u3001\u9867\u5ba2\u304c\u30b5\u30fc\u30d3\u30b9\u3092\u96e2\u8131\u3057\u305f\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u30b5\u30fc\u30d3\u30b9\u5229\u7528\u671f\u9593\u304c\u9577\u304f\u306a\u308c\u3070\u306a\u308b\u307b\u3069\u3001\u96e2\u8131\u3059\u308b\u9867\u5ba2\u6570\u304c\u5897\u3048\u3001\u305d\u308c\u306b\u5fdc\u3058\u3066\u751f\u5b58\u66f2\u7dda\u304c\u5f90\u3005\u306b\u4e0b\u964d\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u6700\u5f8c\u306e\u751f\u5b58\u7387<\/strong>: 4\u5e74\u5f8c\u3001\u534a\u5206(50%)\u306e\u9867\u5ba2\u304c\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u3044\u7d9a\u3051\u3066\u3044\u307e\u3059\u3002 \u3064\u307e\u308a\u3001\u6b8b\u308a\u306e50%\u306f\u30b5\u30fc\u30d3\u30b9\u304b\u3089\u96e2\u8131\u3057\u305f\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u30b0\u30e9\u30d5\u306f\u3001Kaplan-Meier\u30b5\u30d0\u30a4\u30d0\u30eb\u5206\u6790\u306b\u3088\u308a\u3001\u9867\u5ba2\u306e\u30b5\u30fc\u30d3\u30b9\u5229\u7528\u671f\u9593\u3068\u96e2\u8131\u50be\u5411\u3092\u8996\u899a\u7684\u306b\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u6642\u9593\u306e\u7d4c\u904e\u3068\u3068\u3082\u306b\u30b5\u30fc\u30d3\u30b9\u304b\u3089\u96e2\u8131\u3059\u308b\u9867\u5ba2\u306e\u5272\u5408\u3092\u660e\u78ba\u306b\u628a\u63e1\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081\uff1aKaplan-Meier\u30e2\u30c7\u30ebR\u5206\u6790\u3001\u3082\u3046\u96e3\u3057\u304f\u3042\u308a\u307e\u305b\u3093\uff01<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u4eca\u65e5\u306fKaplan-Meier\u751f\u5b58\u5206\u6790\u30e2\u30c7\u30eb\u3092\u7c21\u5358\u306b\u7406\u89e3\u3057\u3001R\u3092\u4f7f\u3063\u3066\u76f4\u63a5\u8996\u899a\u5316\u307e\u3067\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \u3053\u306e\u30e2\u30c7\u30eb\u306f\u6700\u521d\u306f\u96e3\u3057\u304f\u611f\u3058\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u3053\u306e\u3088\u3046\u306b\u9867\u5ba2\u96e2\u8131\u5206\u6790\u306e\u3088\u3046\u306a\u5b9f\u969b\u306e\u4e8b\u4f8b\u306b\u9069\u7528\u3059\u308b\u3068\u3001\u306f\u308b\u304b\u306b\u7406\u89e3\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002\u4eca\u5f8c\u3082\u69d8\u3005\u306a\u30c7\u30fc\u30bf\u5206\u6790\u306b\u3053\u306e\u30e2\u30c7\u30eb\u3092\u6d3b\u7528\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u5168\u4f53\u3092\u4e00\u5ea6\u306b\u30b3\u30d4\u30fc\u3057\u3066 <a href=\"https:\/\/secondlife.lol\/ja\/r-rstudio-install\/\" data-type=\"post\" data-id=\"454\">RStudio<\/a>\u306b\u8cbc\u308a\u4ed8\u3051\u3066\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u3082\u3057\u304b\u3057\u305f\u3089\u3001\u3053\u306e\u30ab\u30d7\u30e9\u30f3-\u30de\u30a4\u30e4\u30fc\u30e2\u30c7\u30eb\u306e\u5b9f\u969b\u306e\u9069\u7528\u4e8b\u4f8b\u304c\u6c17\u306b\u306a\u308b\u65b9\u306f <a href=\"https:\/\/secondlife.lol\/ja\/black-and-white-chef-michelin-curse-r-analysis\/\" data-type=\"post\" data-id=\"2995\">\u767d\u9ed2\u6599\u7406\u4eba\u3067\u3082\u907f\u3051\u3089\u308c\u306a\u3044\u30df\u30b7\u30e5\u30e9\u30f3\u306e\u546a\u3044: R\u3067\u5206\u6790\u3057\u305f\u7269\u8a9e<\/a> \u305c\u3072\u30dd\u30b9\u30c8\u3092\u30ec\u30d3\u30e5\u30fc\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">#\u30d5\u30ebR\u30b3\u30fc\u30c9<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># \u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002\nlibrary(survival)\nlibrary(survminer)\n\n# 10\u4eba\u306e\u9867\u5ba2\u30c7\u30fc\u30bf\u3092\u751f\u6210\u3057\u307e\u3059\u3002\n# \u9867\u5ba2\u304c\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u305f\u5e74\u3068\u96e2\u8131\u3057\u305f\u5e74\u3092\u8a18\u9332\u3057\u307e\u3059\u3002\ndata &lt;- data.frame(\n    customer = 1:10\u3001\n    start_year = rep(2020, 10), # \u3059\u3079\u3066\u306e\u9867\u5ba2\u304c2020\u5e74\u306b\u30b5\u30fc\u30d3\u30b9\u3092\u958b\u59cb\u3057\u307e\u3059\u3002\n    leave_year = c(2021, NA, 2022, NA, 2023, 2024, NA, NA, NA, 2023, 2024) # \u96e2\u8131\u3057\u3066\u3044\u306a\u3044\u5834\u5408 NA\n)\n\n# \u9867\u5ba2\u304c\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u305f\u671f\u9593\u3092\u8a08\u7b97\u3057\u307e\u3059\u3002\ndata$time_in_service &lt;- ifelse(is.na(data$leave_year), 2024 - data$start_year, data$leave_year - data$start_year)\n\n#\u9867\u5ba2\u306e\u96e2\u8131\u306e\u6709\u7121\u30921\u30680\u3067\u8868\u793a\u3057\u307e\u3059(1: \u96e2\u8131\u30010: \u307e\u3060\u4f7f\u7528\u4e2d)\u3002\ndata$status &lt;- ifelse(is.na(data$leave_year), 0, 1)\n\n# Kaplan-Meier \u751f\u5b58\u30e2\u30c7\u30eb\u3092\u9069\u7528\u3057\u307e\u3059\u3002\nfit &lt;- survfit(Surv(time_in_service, status) ~ 1, data = data)\n\n# \u751f\u5b58\u66f2\u7dda\u3092\u53ef\u8996\u5316\u3057\u307e\u3059 (\u30c7\u30fc\u30bf\u3092\u660e\u793a\u7684\u306b\u6e21\u3057\u307e\u3059).\nggsurvplot(fit\u3001\n           data = data, # ggsurvplot\u306b\u30c7\u30fc\u30bf\u3092\u6e21\u3057\u307e\u3059\u3002\n           conf.int = TRUE, #\u4fe1\u983c\u533a\u9593\u3092\u8868\u793a\u3059\u308b\n           xlab = &quot;\u30b5\u30fc\u30d3\u30b9\u4f7f\u7528\u671f\u9593(\u5e74)&quot;, # x\u8ef8\u30e9\u30d9\u30eb\n           ylab = &quot;\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u9867\u5ba2\u306e\u5272\u5408&quot;, # y\u8ef8\u30e9\u30d9\u30eb\n           title = &quot;\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u9867\u5ba2\u306e\u751f\u5b58\u66f2\u7dda&quot;, # \u30b0\u30e9\u30d5\u30bf\u30a4\u30c8\u30eb\n           palette = &quot;blue&quot;\u3001#\u30b0\u30e9\u30d5\u306e\u8272\n           risk.table = TRUE, # \u5404\u5e74\u5ea6\u306e\u30ea\u30b9\u30af\u30c6\u30fc\u30d6\u30eb\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\n           ggtheme = theme_minimal()) #\u30df\u30cb\u30de\u30ea\u30b9\u30c8\u30c6\u30fc\u30de\u306e\u9069\u7528\n<\/code><\/pre>","protected":false},"excerpt":{"rendered":"<p>\ud639\uc2dc \uc0dd\uc874 \ubd84\uc11d\uc774\ub77c\ub294 \ub9d0\uc744 \ub4e4\uc5b4\ubcf4\uc168\ub098\uc694? \ucc98\uc74c \ub4e4\uc73c\uba74 \uc5b4\ub835\uac8c \ub290\uaef4\uc9c8 \uc218&#8230;<\/p>","protected":false},"author":3,"featured_media":3009,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[6],"tags":[384,300,385,177,382],"class_list":["post-3005","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-r-coding","tag-kaplan-meier-","tag-r-","tag-385","tag-177","tag-382"],"taxonomy_info":{"category":[{"value":6,"label":"\uc54c(R)"}],"post_tag":[{"value":384,"label":"Kaplan-Meier \ubaa8\ub378"},{"value":300,"label":"R \uc2dc\uac01\ud654"},{"value":385,"label":"\uace0\uac1d \uc774\ud0c8 \ubd84\uc11d"},{"value":177,"label":"\ub370\uc774\ud130 \ubd84\uc11d"},{"value":382,"label":"\uc0dd\uc874 \ubd84\uc11d"}]},"featured_image_src_large":["https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/10\/\uc0dd\uc874-\ubd84\uc11d-\ubaa8\ub378-\ud3ec\uc2a4\ud2b8-\uc378\ub124\uc77c-600x600.jpg",600,600,true],"author_info":{"display_name":"TERE","author_link":"https:\/\/secondlife.lol\/ja\/author\/tere\/"},"comment_info":0,"category_info":[{"term_id":6,"name":"\uc54c(R)","slug":"r-coding","term_group":0,"term_taxonomy_id":6,"taxonomy":"category","description":"","parent":20,"count":61,"filter":"raw","cat_ID":6,"category_count":61,"category_description":"","cat_name":"\uc54c(R)","category_nicename":"r-coding","category_parent":20}],"tag_info":[{"term_id":384,"name":"Kaplan-Meier \ubaa8\ub378","slug":"kaplan-meier-%eb%aa%a8%eb%8d%b8","term_group":0,"term_taxonomy_id":384,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":300,"name":"R \uc2dc\uac01\ud654","slug":"r-%ec%8b%9c%ea%b0%81%ed%99%94","term_group":0,"term_taxonomy_id":300,"taxonomy":"post_tag","description":"","parent":0,"count":12,"filter":"raw"},{"term_id":385,"name":"\uace0\uac1d \uc774\ud0c8 \ubd84\uc11d","slug":"%ea%b3%a0%ea%b0%9d-%ec%9d%b4%ed%83%88-%eb%b6%84%ec%84%9d","term_group":0,"term_taxonomy_id":385,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":177,"name":"\ub370\uc774\ud130 \ubd84\uc11d","slug":"%eb%8d%b0%ec%9d%b4%ed%84%b0-%eb%b6%84%ec%84%9d","term_group":0,"term_taxonomy_id":177,"taxonomy":"post_tag","description":"","parent":0,"count":36,"filter":"raw"},{"term_id":382,"name":"\uc0dd\uc874 \ubd84\uc11d","slug":"%ec%83%9d%ec%a1%b4-%eb%b6%84%ec%84%9d","term_group":0,"term_taxonomy_id":382,"taxonomy":"post_tag","description":"","parent":0,"count":2,"filter":"raw"}],"_links":{"self":[{"href":"https:\/\/secondlife.lol\/ja\/wp-json\/wp\/v2\/posts\/3005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/secondlife.lol\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/secondlife.lol\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/secondlife.lol\/ja\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/secondlife.lol\/ja\/wp-json\/wp\/v2\/comments?post=3005"}],"version-history":[{"count":2,"href":"https:\/\/secondlife.lol\/ja\/wp-json\/wp\/v2\/posts\/3005\/revisions"}],"predecessor-version":[{"id":3028,"href":"https:\/\/secondlife.lol\/ja\/wp-json\/wp\/v2\/posts\/3005\/revisions\/3028"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/secondlife.lol\/ja\/wp-json\/wp\/v2\/media\/3009"}],"wp:attachment":[{"href":"https:\/\/secondlife.lol\/ja\/wp-json\/wp\/v2\/media?parent=3005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/secondlife.lol\/ja\/wp-json\/wp\/v2\/categories?post=3005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/secondlife.lol\/ja\/wp-json\/wp\/v2\/tags?post=3005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}