{"id":29,"date":"2024-06-05T21:44:36","date_gmt":"2024-06-05T12:44:36","guid":{"rendered":"https:\/\/best-biostatistics.com\/toukei-er\/entry\/how-to-pool-wald-chi-squared-from-cox-reg-with-multiple-imputation-in-r\/"},"modified":"2024-08-25T21:33:42","modified_gmt":"2024-08-25T12:33:42","slug":"how-to-pool-wald-chi-squared-from-cox-reg-with-multiple-imputation-in-r","status":"publish","type":"post","link":"https:\/\/best-biostatistics.com\/toukei-er\/entry\/how-to-pool-wald-chi-squared-from-cox-reg-with-multiple-imputation-in-r\/","title":{"rendered":"R \u3092\u4f7f\u3063\u305f\u591a\u91cd\u4ee3\u5165\u6cd5\u3067\u6b20\u640d\u5024\u3092\u88dc\u5b8c\u3057\u305f\u5f8c\u306b Cox \u306e Wald \u691c\u5b9a\u306e\u30ab\u30a4\u4e8c\u4e57\u5024\u3092\u7d71\u5408\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"\n<p>\u591a\u91cd\u4ee3\u5165\u6cd5\u3067\u6b20\u640d\u5024\u3092\u88dc\u5b8c\u3057\u305f\u5f8c\u306b Cox \u56de\u5e30\u306e Wald \u691c\u5b9a\u3092\u7d71\u5408\u3059\u308b\u65b9\u6cd5<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u591a\u91cd\u4ee3\u5165\u6cd5\">\u591a\u91cd\u4ee3\u5165\u6cd5<\/h2>\n\n\n\n<p>\u591a\u91cd\u4ee3\u5165\u6cd5\u3068\u306f\u3001\u6b20\u640d\u5024\u3092\u3001\u53d6\u5f97\u3055\u308c\u3066\u3044\u308b\u5909\u6570\u304b\u3089\u63a8\u6e2c\u3057\u3066\u3001\u3044\u304f\u3064\u304b\u306e\u5024\u3067\u88dc\u5b8c\u3057\u3066\u3001\u3044\u304f\u3064\u304b\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u4f5c\u6210\u3057\u3001\u89e3\u6790\u3057\u305f\u306e\u3061\u3001\u7d50\u679c\u3092\u7d71\u5408\u3059\u308b\u65b9\u6cd5<\/p>\n\n\n\n<p>\u8a73\u3057\u304f\u306f\u3001\u3053\u3061\u3089\u3082\u53c2\u7167\u306e\u3053\u3068<\/p>\n\n\n<div class=\"swell-block-postLink\">\t\t\t<div class=\"p-blogCard -internal\" data-type=\"type1\" data-onclick=\"clickLink\">\n\t\t\t\t<div class=\"p-blogCard__inner\">\n\t\t\t\t\t<span class=\"p-blogCard__caption\">\u3042\u308f\u305b\u3066\u8aad\u307f\u305f\u3044<\/span>\n\t\t\t\t\t<div class=\"p-blogCard__thumb c-postThumb\"><figure class=\"c-postThumb__figure\"><img decoding=\"async\" src=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2024\/08\/1920x1080-video-Excel-300x169.jpg\" alt=\"\" class=\"c-postThumb__img u-obf-cover\" width=\"320\" height=\"180\"><\/figure><\/div>\t\t\t\t\t<div class=\"p-blogCard__body\">\n\t\t\t\t\t\t<a class=\"p-blogCard__title\" href=\"https:\/\/best-biostatistics.com\/toukei-er\/entry\/multiple-imputation-in-ezr\/\">EZR \u3067\u591a\u91cd\u4ee3\u5165\u6cd5\u3092\u884c\u3046\u65b9\u6cd5<\/a>\n\t\t\t\t\t\t<span class=\"p-blogCard__excerpt\">EZR \u3067\u591a\u91cd\u4ee3\u5165\u6cd5\u3092\u884c\u3044\u305f\u3044\u5834\u5408\u3001\u3069\u306e\u3088\u3046\u306b\u3057\u305f\u3089\u3088\u3044\u304b EZR \u306b\u306f\u3001\u591a\u91cd\u4ee3\u5165\u306e\u30e1\u30cb\u30e5\u30fc\u306f\u306a\u3044\u304c\u3001R \u30b9\u30af\u30ea\u30d7\u30c8\u67a0\u306b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u3044\u3066\u3044\u304f\u65b9\u6cd5\u3067\u5b9f\u884c\u3067\u304d\u308b \u306f\u3058\u3081\u306b &#8230;<\/span>\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Cox-\u56de\u5e30\u306e-Wald-\u691c\u5b9a\u306e\u7d71\u5408\">Cox \u56de\u5e30\u306e Wald \u691c\u5b9a\u306e\u7d71\u5408<\/h2>\n\n\n\n<p>Cox \u56de\u5e30\u306e 3 \u5024\u4ee5\u4e0a\u30ab\u30c6\u30b4\u30ea\u3092\u6709\u3059\u308b\u30ab\u30c6\u30b4\u30ea\u30ab\u30eb\u30c7\u30fc\u30bf\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u691c\u5b9a\u306b\u306f\u3001Wald \u691c\u5b9a\u3068\u3044\u3046\u3001\u30ab\u30a4\u4e8c\u4e57\u5024\u3092\u7528\u3044\u305f\u691c\u5b9a\u304c\u4f7f\u308f\u308c\u308b<\/p>\n\n\n\n<p>\u3053\u306e\u691c\u5b9a\u306e\u7d71\u5408\u65b9\u6cd5\u3092\u7d39\u4ecb\u3059\u308b<\/p>\n\n\n\n<div id=\"biost-3039486555\" 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=\"\u30b5\u30f3\u30d7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\">\u30b5\u30f3\u30d7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8<\/h2>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u6d41\u308c\u3092\u7d39\u4ecb\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308b<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3080<\/li>\n\n\n\n<li>\u591a\u91cd\u4ee3\u5165\u3059\u308b<\/li>\n\n\n\n<li>Cox \u56de\u5e30\u3092\u884c\u3046<\/li>\n\n\n\n<li>Wald \u306e\u30ab\u30a4\u4e8c\u4e57\u5024\u3092\u53d6\u308a\u51fa\u3059<\/li>\n\n\n\n<li>Wald \u306e\u30ab\u30a4\u4e8c\u4e57\u5024\u3092\u7d71\u5408\u3057\u3066\u7d50\u679c\u3092\u5f97\u308b<\/li>\n<\/ol>\n\n\n\n<p>\u5b9f\u969b\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a<\/p>\n\n\n\n<p>\u8aad\u307f\u8fbc\u3093\u3060\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u540d\u3001cph \u95a2\u6570\u5185\u306e\u5909\u6570\u540d\u3001\u8aac\u660e\u5909\u6570\u306e\u6570\u306e\u5206\u3060\u3051 anova.values \u3068\u3044\u3046\u7d50\u679c\u683c\u7d0d\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5897\u3084\u3057\u3066\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u3082\u52a0\u7b46\u3059\u308b\u3068\u3001\u540c\u3058\u3088\u3046\u306b\u8a08\u7b97\u3067\u304d\u308b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"synComment\"># load sample data \u30c7\u30fc\u30bf\u8aad\u307f\u8fbc\u307f<\/span>\n<span class=\"synIdentifier\">load(\"C:\/Users\/touke\/OneDrive\/R_Datasets\/lung_rev.RData\")<\/span>\ndf <span class=\"synStatement\">&lt;-<\/span> lung_rev\n<span class=\"synIdentifier\">summary(<\/span>df<span class=\"synSpecial\">)<\/span>\n<span class=\"synComment\"># imputation \u591a\u91cd\u4ee3\u5165<\/span>\n<span class=\"synPreProc\">library(<\/span>mice<span class=\"synSpecial\">)<\/span>\ndf_imputed <span class=\"synStatement\">&lt;-<\/span> <span class=\"synIdentifier\">mice(<\/span>df<span class=\"synSpecial\">,<\/span> seed<span class=\"synStatement\">=0)<\/span>\ndf_imputed\n<span class=\"synComment\"># Initialize a list to store the results \u7d50\u679c\u683c\u7d0d\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u521d\u671f\u5316<\/span>\nanova.values1 <span class=\"synStatement\">&lt;-<\/span> <span class=\"synType\">list()<\/span>\nanova.values2 <span class=\"synStatement\">&lt;-<\/span> <span class=\"synType\">list()<\/span>\n<span class=\"synComment\"># Cox model using cph in rms; rms \u30d1\u30c3\u30b1\u30fc\u30b8\u306e cph \u95a2\u6570\u3092\u4f7f\u3063\u305f Cox \u56de\u5e30\u3092\u5b9f\u65bd<\/span>\n<span class=\"synComment\"># Loop through numbers 1 to 5; \u4ee3\u5165\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8 1 \u304b\u3089 5 \u3092\u30eb\u30fc\u30d7\u51e6\u7406<\/span>\n<span class=\"synPreProc\">library(<\/span>rms<span class=\"synSpecial\">)<\/span>\n<span class=\"synStatement\">for<\/span> <span class=\"synSpecial\">(<\/span>i <span class=\"synStatement\">in<\/span> <span class=\"synConstant\">1:5)<\/span> <span class=\"synSpecial\">{<\/span>\n<span class=\"synComment\"># Complete the data with imputation number i<\/span>\ndf_imp <span class=\"synStatement\">&lt;-<\/span> <span class=\"synIdentifier\">complete(<\/span>df_imputed<span class=\"synSpecial\">,<\/span> i<span class=\"synSpecial\">)<\/span>\n<span class=\"synComment\"># Fit the Cox proportional hazards model<\/span>\ncph_imp <span class=\"synStatement\">&lt;-<\/span> <span class=\"synIdentifier\">with(<\/span>df_imp<span class=\"synSpecial\">,<\/span> <span class=\"synIdentifier\">cph(Surv(<\/span>time<span class=\"synSpecial\">,<\/span> status01<span class=\"synSpecial\">)<\/span> <span class=\"synStatement\">~<\/span> ph.ecog012 <span class=\"synStatement\">+<\/span> meal.cal<span class=\"synSpecial\">))<\/span>\n<span class=\"synComment\"># Perform ANOVA and store the result in the list<\/span>\nanova_result1 <span class=\"synStatement\">&lt;-<\/span> <span class=\"synIdentifier\">anova(<\/span>cph_imp<span class=\"synSpecial\">)&#91;1]<\/span>\nanova_result2 <span class=\"synStatement\">&lt;-<\/span> <span class=\"synIdentifier\">anova(<\/span>cph_imp<span class=\"synSpecial\">)&#91;2]<\/span>\nanova.values1<span class=\"synSpecial\">&#91;&#91;<\/span>i<span class=\"synSpecial\">]]<\/span> <span class=\"synStatement\">&lt;-<\/span> anova_result1\nanova.values2<span class=\"synSpecial\">&#91;&#91;<\/span>i<span class=\"synSpecial\">]]<\/span> <span class=\"synStatement\">&lt;-<\/span> anova_result2\n<span class=\"synSpecial\">}<\/span>\n<span class=\"synComment\"># Combine the ANOVA results into a single vector; Wald \u691c\u5b9a\u306e\u7d50\u679c\u3092\u7d50\u5408<\/span>\nanova_values1 <span class=\"synStatement\">&lt;-<\/span> <span class=\"synIdentifier\">unlist(<\/span>anova.values1<span class=\"synSpecial\">)<\/span>\nanova_values2 <span class=\"synStatement\">&lt;-<\/span> <span class=\"synIdentifier\">unlist(<\/span>anova.values2<span class=\"synSpecial\">)<\/span>\n<span class=\"synComment\"># Display the combined ANOVA results; Wald \u691c\u5b9a\u306e\u7d50\u679c\u3092\u8868\u793a<\/span>\nanova_values1\nanova_values2\n<span class=\"synComment\"># Pool chi-squares \u30ab\u30a4\u4e8c\u4e57\u5024\u306e\u7d71\u5408<\/span>\n<span class=\"synPreProc\">library(<\/span>miceadds<span class=\"synSpecial\">)<\/span>\n<span class=\"synIdentifier\">micombine.chisquare(<\/span>anova_values1<span class=\"synSpecial\">,<\/span> df<span class=\"synStatement\">=2)<\/span>\n<span class=\"synIdentifier\">micombine.chisquare(<\/span>anova_values2<span class=\"synSpecial\">,<\/span> df<span class=\"synStatement\">=1)<\/span>\n<\/code><\/pre>\n\n\n\n<p>\u7d50\u5408\u3057\u305f\u30ab\u30a4\u4e8c\u4e57\u5024\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u306b\u306a\u308b<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"729\" height=\"97\" src=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2024\/06\/20240605213401.png\" alt=\"\" class=\"wp-image-774\" srcset=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2024\/06\/20240605213401.png 729w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2024\/06\/20240605213401-300x40.png 300w\" sizes=\"(max-width: 729px) 100vw, 729px\" \/><\/figure>\n\n\n\n<p><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><\/span><\/p>\n\n\n\n<p>\u7d71\u5408\u3057\u305f\u7d50\u679c\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"744\" height=\"180\" src=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2024\/06\/20240605213417.png\" alt=\"\" class=\"wp-image-775\" srcset=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2024\/06\/20240605213417.png 744w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2024\/06\/20240605213417-300x73.png 300w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><\/figure>\n\n\n\n<p><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><\/span><\/p>\n\n\n\n<p>\u8aac\u660e\u5909\u6570 1 \u756a\u76ee\u306e ph.ecog012 \u306f\u3001\u7d71\u8a08\u5b66\u7684\u306b\u6709\u610f\u3067\u3042\u308b<\/p>\n\n\n\n<p>2 \u756a\u76ee\u306e meal.cal \u306f\u7d71\u8a08\u5b66\u7684\u6709\u610f\u3067\u306f\u306a\u304b\u3063\u305f<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u307e\u3068\u3081\">\u307e\u3068\u3081<\/h2>\n\n\n\n<p>R \u306b\u304a\u3044\u3066\u3001mice \u3067\u591a\u91cd\u4ee3\u5165\u3057\u305f\u306e\u3061\u3001Cox \u56de\u5e30\u306e Wald \u691c\u5b9a\u3092\u7d71\u5408\u3057\u305f\u3044\u3068\u304d\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u7d39\u4ecb\u3057\u305f<\/p>\n\n\n\n<p>rms \u30d1\u30c3\u30b1\u30fc\u30b8\u306e cph \u95a2\u6570\u3068\u3001miceadds \u30d1\u30c3\u30b1\u30fc\u30b8\u306e micobine.chisquare \u95a2\u6570\u3092\u4f7f\u3046\u3068\u5b9f\u884c\u3067\u304d\u308b<\/p>\n\n\n\n<p>\u9014\u4e2d\u3001for loop \u3092\u4f7f\u3063\u3066\u3001\u591a\u91cd\u4ee3\u5165\u30bb\u30c3\u30c8\u3092\u52b9\u7387\u3088\u304f\u51e6\u7406\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b<\/p>\n\n\n\n<p>\u4f55\u3089\u304b\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u53c2\u8003\u30b5\u30a4\u30c8\">\u53c2\u8003\u30b5\u30a4\u30c8<\/h2>\n\n\n\n<p><a href=\"https:\/\/bookdown.org\/mwheymans\/bookmi\/pooling-methods-for-categorical-variables.html\">https:\/\/bookdown.org\/mwheymans\/bookmi\/pooling-methods-for-categorical-variables.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u591a\u91cd\u4ee3\u5165\u6cd5\u3067\u6b20\u640d\u5024\u3092\u88dc\u5b8c\u3057\u305f\u5f8c\u306b Cox \u56de\u5e30\u306e Wald \u691c\u5b9a\u3092\u7d71\u5408\u3059\u308b\u65b9\u6cd5<\/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,21,20],"tags":[],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-r","category-21","category-20"],"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\/29","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=29"}],"version-history":[{"count":3,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":778,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts\/29\/revisions\/778"}],"wp:attachment":[{"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}