{"id":482,"date":"2023-07-29T18:17:31","date_gmt":"2023-07-29T18:17:31","guid":{"rendered":"https:\/\/statorials.org\/ja\/r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99\/"},"modified":"2023-07-29T18:17:31","modified_gmt":"2023-07-29T18:17:31","slug":"r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99","status":"publish","type":"post","link":"https:\/\/statorials.org\/ja\/r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99\/","title":{"rendered":"R \u3067 ancova \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001R \u3067<a href=\"https:\/\/statorials.org\/ja\/r\u306e\u30a2\u30f3\u30b3\u30cf\u3099\/\" target=\"_blank\" rel=\"noopener noreferrer\">ANCOVA<\/a>\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002<\/span><\/p>\n<h3><span style=\"color: #000000;\"><strong>\u4f8b: R \u306e ANCOVA<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u6b21\u306e\u5909\u6570\u3092\u4f7f\u7528\u3057\u3066\u3001ANCOVA \u3092\u5b9f\u884c\u3057\u3066\u3001\u5b66\u7fd2\u30c6\u30af\u30cb\u30c3\u30af\u304c\u8a66\u9a13\u7d50\u679c\u306b\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u304b\u3069\u3046\u304b\u3092\u30c6\u30b9\u30c8\u3057\u307e\u3059\u3002<\/span><\/p>\n<ul>\n<li><span style=\"color: #000000;\"><strong>\u6280\u8853\u7684\u691c\u8a0e<\/strong>\uff1a\u5206\u6790\u3057\u305f\u3044\u72ec\u7acb\u5909\u6570<\/span><\/li>\n<li><span style=\"color: #000000;\"><strong>\u73fe\u5728\u306e\u751f\u5f92\u306e\u5b66\u5e74<\/strong>: \u8003\u616e\u3057\u305f\u3044\u5171\u5909\u91cf<\/span><\/li>\n<li><span style=\"color: #000000;\"><strong>\u30ec\u30d3\u30e5\u30fc\u30b9\u30b3\u30a2<\/strong>: \u5206\u6790\u3057\u305f\u3044\u5fdc\u7b54\u5909\u6570<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\">\u6b21\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306b\u306f\u300130 \u4eba\u305a\u3064 3 \u3064\u306e\u30b0\u30eb\u30fc\u30d7\u306b\u30e9\u30f3\u30c0\u30e0\u306b\u5206\u5272\u3055\u308c\u305f 90 \u4eba\u306e\u751f\u5f92\u306b\u95a2\u3059\u308b\u60c5\u5831\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306b\u306f\u3001\u5404\u751f\u5f92\u304c\u4f7f\u7528\u3057\u305f\u5b66\u7fd2\u624b\u6cd5<em>(A\u3001B<\/em> \u3001\u307e\u305f\u306f<em>C)<\/em> <em>\u3001<\/em>\u305d\u306e\u5b66\u7fd2\u624b\u6cd5\u3092\u4f7f\u7528\u3057\u59cb\u3081\u305f\u3068\u304d\u306e\u30af\u30e9\u30b9\u5185\u3067\u306e\u73fe\u5728\u306e\u6210\u7e3e\u3001\u304a\u3088\u3073\u6e96\u5099\u306e\u305f\u3081\u306b 1 \u304b\u6708\u9593\u305d\u306e\u5b66\u7fd2\u624b\u6cd5\u3092\u4f7f\u7528\u3057\u305f\u5f8c\u306e\u8a66\u9a13\u3067\u53d7\u3051\u53d6\u3063\u305f\u6210\u7e3e\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u8a66\u9a13\u306e\u305f\u3081\u306b\u3002\u30c6\u30b9\u30c8\uff1a<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#make this example reproducible<\/span>\nset.seed(10)\n\n<span style=\"color: #008080;\">#create dataset<\/span>\ndata &lt;- data.frame(technique = rep(c(\"A\", \"B\", \"C\"), each = 30),\n                   current_grade = runif(90, 65, 95),\n                   exam = c(runif(30, 80, 95), runif(30, 70, 95), runif(30, 70, 90)))\n\n<span style=\"color: #008080;\">#view first six lines of dataset<\/span>\nhead(data)\n\n# technical current_grade exam\n#1 A 80.22435 87.32759\n#2 A 74.20306 90.67114\n#3 A 77.80723 88.87902\n#4 A 85.79306 87.75735\n#5 A 67.55408 85.72442\n#6 A 71.76310 92.52167\n<\/strong><\/pre>\n<h3><span style=\"color: #000000;\"><strong>\u30b9\u30c6\u30c3\u30d7 1: \u30c7\u30fc\u30bf\u3092\u63a2\u7d22\u3059\u308b<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">ANCOVA \u30e2\u30c7\u30eb\u3092\u5f53\u3066\u306f\u3081\u308b\u524d\u306b\u3001\u307e\u305a\u30c7\u30fc\u30bf\u3092\u8abf\u67fb\u3057\u3066\u7406\u89e3\u3092\u6df1\u3081\u3001\u7d50\u679c\u3092\u6b6a\u3081\u308b\u53ef\u80fd\u6027\u306e\u3042\u308b\u6975\u7aef\u306a\u5916\u308c\u5024\u304c\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u307e\u305a\u3001\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u5185\u306e\u5404\u5909\u6570\u306e\u6982\u8981\u3092\u8868\u793a\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong>summary(data)\n\n# technical current_grade exam      \n#A:30 Min. :65.43 Min. :71.17  \n# B:30 1st Qu.:71.79 1st Qu.:77.27  \n# C:30 Median:77.84 Median:84.69  \n# Mean:78.15 Mean:83.38  \n# 3rd Qu.:83.65 3rd Qu.:89.22  \n# Max. :93.84 Max. :94.76  \n<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u5404\u5b66\u7fd2\u30c6\u30af\u30cb\u30c3\u30af\u306e\u5024 ( <em>A\u3001B<\/em> \u3001 <em>C)<\/em>\u304c\u30c7\u30fc\u30bf\u5185\u306b 30 \u56de\u51fa\u73fe\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u307e\u305f\u3001\u8abf\u67fb\u958b\u59cb\u6642\u306b\u751f\u5f92\u306e\u73fe\u5728\u306e\u30b9\u30b3\u30a2\u304c\u3069\u306e\u3088\u3046\u306b\u5206\u5e03\u3057\u3066\u3044\u305f\u304b\u3082\u308f\u304b\u308a\u307e\u3059\u3002\u30af\u30e9\u30b9\u306e\u6700\u4f4e\u70b9\u306f 65.43\u3001\u6700\u9ad8\u70b9\u306f 93.84\u3001\u5e73\u5747\u306f 78.15 \u3067\u3057\u305f\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u540c\u69d8\u306b\u3001\u8a66\u9a13\u3067\u5f97\u3089\u308c\u305f\u6700\u5c0f\u30b9\u30b3\u30a2\u306f 71.17\u3001\u6700\u5927\u30b9\u30b3\u30a2\u306f 94.76\u3001\u5e73\u5747\u306f 83.38 \u3067\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u6b21\u306b\u3001 <strong>dplyr<\/strong>\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u7528\u3057\u3066\u3001\u5404\u5b66\u7fd2\u624b\u6cd5\u306e\u73fe\u5728\u306e\u6210\u7e3e\u3068\u8a66\u9a13\u7d50\u679c\u306e\u5e73\u5747\u3068\u6a19\u6e96\u504f\u5dee\u3092\u7c21\u5358\u306b\u898b\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#load <em>dplyr<\/em><\/span>\nlibrary(dplyr)\n\ndata %&gt;%\n  <span style=\"color: #800080;\">group_by<\/span> (technical) %&gt;%\n  <span style=\"color: #800080;\">summarize<\/span> (mean_grade = mean(current_grade),\n            sd_grade = sd(current_grade),\n            mean_exam = mean(exam),\n            sd_exam = sd(exam))\n\n# A tibble: 3 x 5\n# technique mean_grade sd_grade mean_exam sd_exam                      \n#1 A 79.0 7.00 88.5 3.88\n#2 B 78.5 8.33 81.8 7.62\n#3 C 76.9 8.24 79.9 5.71<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u5404\u5b66\u7fd2\u624b\u6cd5\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u751f\u5f92\u306e\u73fe\u5728\u306e\u5b66\u5e74\u306e\u5e73\u5747\u3068\u6a19\u6e96\u504f\u5dee\u306f\u3001\u307b\u307c\u540c\u69d8\u3067\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u307e\u305f\u3001\u5b66\u7fd2\u624b\u6cd5<em>A<\/em>\u3092\u4f7f\u7528\u3057\u305f\u751f\u5f92\u306e\u8a66\u9a13\u306e\u5e73\u5747\u70b9\u304c\u3001\u624b\u6cd5<em>B<\/em>\u304a\u3088\u3073<em>C<\/em>\u306b\u6bd4\u3079\u3066\u5927\u5e45\u306b\u9ad8\u304b\u3063\u305f\u3053\u3068\u3082\u308f\u304b\u308a\u307e\u3059\u3002<\/span><\/p>\n<p> <span style=\"color: #000000;\"><a href=\"https:\/\/statorials.org\/ja\/-10\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u7bb1\u3072\u3052\u56f3<\/a>\u3092\u4f7f\u7528\u3057\u3066\u3001\u5b66\u7fd2\u624b\u6cd5\u306b\u57fa\u3065\u3044\u305f\u8a66\u9a13\u7d50\u679c\u306e\u5206\u5e03\u3092\u8996\u899a\u5316\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong>boxplot(exam ~ technique,\ndata = data,\nmain = \"Exam Score by Studying Technique\",\nxlab = \"Studying Technique\",\nylab = \"Exam Score\",\ncol = \"steelblue\",\nborder = \"black\"\n)<\/strong><\/pre>\n<h3><\/h3>\n<p><span style=\"color: #000000;\">\u540c\u69d8\u306b\u3001\u7bb1\u3072\u3052\u56f3\u3092\u4f7f\u7528\u3057\u3066\u3001\u5b66\u7fd2\u624b\u6cd5\u306b\u57fa\u3065\u3044\u3066<em>\u73fe\u5728\u306e\u6210\u7e3e<\/em>\u306e\u5206\u5e03\u3092\u8996\u899a\u5316\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong>boxplot(current_grade ~ technical,\ndata = data,\nmain = \"Current Grade by Studying Technique\",\nxlab = \"Studying Technique\",\nylab = \"Current Grade\",\ncol = \"steelblue\",\nborder = \"black\"\n)<\/strong><\/pre>\n<h3><span style=\"color: #000000;\"><strong>\u30b9\u30c6\u30c3\u30d7 2: \u30e2\u30c7\u30eb\u306e\u4eee\u5b9a\u3092\u78ba\u8a8d\u3059\u308b<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u57fa\u672c\u7684\u306a\u30c7\u30fc\u30bf\u63a2\u7d22\u3092\u5b9f\u884c\u3057\u3001\u30c7\u30fc\u30bf\u306b\u7cbe\u901a\u3057\u305f\u3089\u3001ANCOVA \u306e\u6b21\u306e\u524d\u63d0\u304c\u6e80\u305f\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/span><\/p>\n<ul>\n<li><span style=\"color: #000000;\"><strong>\u5171\u5909\u91cf\u3068\u6cbb\u7642\u6cd5\u306f\u72ec\u7acb\u3057\u3066\u3044\u307e\u3059<\/strong>\u2013 \u30e2\u30c7\u30eb\u306b\u5171\u5909\u91cf\u9805\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u306f\u3001\u5171<em>\u5909\u91cf<\/em>\u3068\u6cbb\u7642<em>\u6cd5<\/em>\u304c\u4e92\u3044\u306b\u72ec\u7acb\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u6cbb\u7642\u306f\u5fdc\u7b54\u5909\u6570 (<em>\u691c\u67fb<\/em>) \u306b\u72ec\u7acb\u3057\u3066\u4f5c\u7528\u3057\u307e\u3059\u3002<\/span><\/li>\n<li><span style=\"color: #000000;\"><strong>\u5206\u6563\u306e\u5747\u4e00\u6027<\/strong>\u2013 \u30b0\u30eb\u30fc\u30d7\u9593\u306e\u5206\u6563\u304c\u7b49\u3057\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\">\u5171\u5909\u91cf\u3068\u6cbb\u7642\u304c\u72ec\u7acb\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u691c\u8a3c\u3059\u308b\u306b\u306f\u3001<em>\u73fe\u5728\u306e\u6210\u7e3e\u3092<\/em>\u5fdc\u7b54\u5909\u6570\u3068\u3057\u3066\u3001<em>\u5b66\u7fd2\u6280\u8853\u3092<\/em>\u4e88\u6e2c\u5909\u6570\u3068\u3057\u3066\u4f7f\u7528\u3057\u3066 ANOVA \u3092\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#fit anova model\n<\/span>anova_model &lt;- aov(current_grade ~ technique, data = data)\n<span style=\"color: #008080;\">#view summary of anova model\n<\/span>summary(anova_model)\n\n# Df Sum Sq Mean Sq F value Pr(&gt;F)\n#technical 2 74 37.21 0.599 0.552\n#Residuals 87 5406 62.14    \n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">p \u5024\u306f 0.05 \u3088\u308a\u5927\u304d\u3044\u305f\u3081\u3001\u5171\u5909\u91cf (<em>\u73fe\u5728\u306e\u6210\u7e3e)<\/em>\u3068\u6cbb\u7642 (<em>\u5b66\u7fd2\u6280\u8853<\/em>) \u306f\u72ec\u7acb\u3057\u3066\u3044\u308b\u3088\u3046\u306b\u898b\u3048\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u6b21\u306b\u3001\u30b0\u30eb\u30fc\u30d7\u9593\u306e\u5206\u6563\u304c\u5747\u4e00\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001Levene \u691c\u5b9a\u3092\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#load <em>car<\/em> library to conduct Levene's Test<\/span>\nlibary(car)\n\n<span style=\"color: #008080;\">#conduct Levene's Test<\/span>\nleveneTest(technical exam, data = data)\n\n#Levene's Test for Homogeneity of Variance (center = median)\n# Df F value Pr(&gt;F)    \n#group 2 9.4324 0.0001961 ***\n#87   \n<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u691c\u5b9a\u306e p \u5024\u306f 0.0001961 \u306b\u7b49\u3057\u304f\u3001\u30b0\u30eb\u30fc\u30d7\u9593\u306e\u5206\u6563\u304c\u7b49\u3057\u304f\u306a\u3044\u3053\u3068\u3092\u793a\u3057\u307e\u3059\u3002\u3053\u306e\u554f\u984c\u3092\u4fee\u6b63\u3059\u308b\u305f\u3081\u306b\u30c7\u30fc\u30bf\u306e\u5909\u63db\u3092\u8a66\u307f\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u304c\u3001\u73fe\u6642\u70b9\u3067\u306f\u5206\u6563\u306e\u5dee\u306b\u3064\u3044\u3066\u306f\u3042\u307e\u308a\u5fc3\u914d\u3057\u307e\u305b\u3093\u3002<\/span><\/p>\n<h3><span style=\"color: #000000;\"><strong>\u30b9\u30c6\u30c3\u30d7 3: ANCOVA \u30e2\u30c7\u30eb\u3092\u8abf\u6574\u3059\u308b<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u6b21\u306b\u3001<em>\u8a66\u9a13\u306e\u30b9\u30b3\u30a2\u3092<\/em>\u5fdc\u7b54\u5909\u6570\u3068\u3057\u3066\u3001<em>\u5b66\u7fd2\u6280\u8853\u3092<\/em>\u4e88\u6e2c\u5909\u6570 (\u307e\u305f\u306f\u300c\u6cbb\u7642\u300d) \u5909\u6570\u3068\u3057\u3066\u3001<em>\u73fe\u5728\u306e\u6210\u7e3e\u3092<\/em>\u5171\u5909\u91cf\u3068\u3057\u3066\u4f7f\u7528\u3057\u3066\u3001ANCOVA \u30e2\u30c7\u30eb\u3092\u5f53\u3066\u306f\u3081\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u30d1\u30c3\u30b1\u30fc\u30b8\u5185\u306e Anova() \u95a2\u6570\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3053\u308c\u3092\u884c\u3046\u306b\u306f\u3001\u30e2\u30c7\u30eb\u306b\u30bf\u30a4\u30d7 III \u306e\u4e8c\u4e57\u548c\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3092\u6307\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u3060\u3051\u3067\u3059\u3002\u30bf\u30a4\u30d7 I \u306e\u4e8c\u4e57\u548c\u306f\u3001\u6b21\u306e\u9806\u5e8f\u306b\u4f9d\u5b58\u3059\u308b\u305f\u3081\u3067\u3059\u3002\u4e88\u6e2c\u5b50\u304c\u30e2\u30c7\u30eb\u306b\u5165\u529b\u3055\u308c\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#load <em>car<\/em> library<\/span>\nlibrary(car)\n\n<span style=\"color: #008080;\">#fit ANCOVA model\n<\/span>ancova_model &lt;- aov(exam ~ technique + current_grade, data = data)\n\n<span style=\"color: #008080;\">#view summary of model\n<\/span>Anova(ancova_model, type=\"III\") \n\n#Answer: exam\n# Sum Sq Df F value Pr(&gt;F)    \n#(Intercept) 7161.2 1 201.4621 &lt; 2.2e-16 ***\n#technical 1242.9 2 17.4830 4.255e-07 ***\n#current_grade 12.3 1 0.3467 0.5576    \n#Residuals 3057.0 86         \n<\/strong><\/pre>\n<p><span style=\"color: #000000;\"><em>\u30c6\u30af\u30cb\u30c3\u30af<\/em>\u306e p \u5024\u304c\u975e\u5e38\u306b\u4f4e\u3044\u3053\u3068\u304c\u308f\u304b\u308a\u3001\u73fe\u5728\u306e\u6210\u7e3e\u3092\u8abf\u6574\u3057\u305f\u5f8c\u3067\u3082\u3001\u52c9\u5f37\u30c6\u30af\u30cb\u30c3\u30af\u304c\u8a66\u9a13\u306e\u5f97\u70b9\u306b\u7d71\u8a08\u7684\u306b\u6709\u610f\u306a\u5f71\u97ff\u3092\u4e0e\u3048\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/span><\/p>\n<h3><span style=\"color: #000000;\"><strong>\u30b9\u30c6\u30c3\u30d7 4: \u4e8b\u5f8c\u30c6\u30b9\u30c8<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">ANCOVA \u306e\u7d50\u679c\u304b\u3089\u3001<em>\u5b66\u7fd2\u624b\u6cd5\u304c<\/em>\u8a66\u9a13\u306e\u30b9\u30b3\u30a2\u306b\u7d71\u8a08\u7684\u306b\u6709\u610f\u306a\u5f71\u97ff\u3092\u4e0e\u3048\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u305f\u304c\u3001\u3069\u306e\u5b66\u7fd2\u624b\u6cd5\u304c\u4e92\u3044\u306b\u7570\u306a\u308b\u304b\u3092\u5224\u65ad\u3059\u308b\u306b\u306f\u3001<a href=\"https:\/\/statorials.org\/ja\/-10\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u4e8b\u5f8c\u30c6\u30b9\u30c8<\/a>\u3092\u5b9f\u65bd\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u3053\u308c\u3092\u884c\u3046\u306b\u306f\u3001R \u306e<strong>multcomp<\/strong>\u30d1\u30c3\u30b1\u30fc\u30b8\u306e glht() \u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u3001\u591a\u91cd\u6bd4\u8f03\u306e Tukey \u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#load the <em>multcomp<\/em> library<\/span>\nlibrary(multicomp)\n\n<span style=\"color: #008080;\">#fit the ANCOVA model\n<\/span>ancova_model &lt;- aov(exam ~ technique + current_grade, data = data)\n\n<span style=\"color: #008080;\">#define the post hoc comparisons to make\n<\/span>postHocs &lt;- glht(ancova_model, linfct = mcp(technique = \"Tukey\"))\n\n<span style=\"color: #008080;\">#view a summary of the post hoc comparisons\n<\/span>summary(postHocs)\n\n#Multiple Comparisons of Means: Tukey Contrasts\n#\n#Fit: aov(formula = exam ~ technique + current_grade, data = data)\n#\n#Linear Assumptions:\n#Estimate Std. Error t value Pr(&gt;|t|)    \n#B - A == 0 -6.711 1.540 -4.358 0.000109 ***\n#C - A == 0 -8.736 1.549 -5.640 &lt; 1e-04 ***\n#C - B == 0 -2.025 1.545 -1.311 0.393089    \n\n<span style=\"color: #008080;\">#view the confidence intervals associated with the multiple comparisons\n<\/span>confint(postHocs)\n\n# Simultaneous Confidence Intervals\n#\n#Multiple Comparisons of Means: Tukey Contrasts\n#\n#Fit: aov(formula = exam ~ technique + current_grade, data = data)\n#\n#Quantile = 2.3845\n#95% family-wise confidence level\n#\n#Linear Assumptions:\n# Estimate lwr upr     \n#B - A == 0 -6.7112 -10.3832 -3.0392\n#C - A == 0 -8.7364 -12.4302 -5.0426\n#C - B == 0 -2.0252 -5.7091 1.6588\n<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u3053\u306e\u7d50\u679c\u304b\u3089\u3001\u52c9\u5f37\u6cd5<em>A<\/em>\u3068\u52c9\u5f37\u6cd5<em>B<\/em>\u306e\u9593\u3001\u304a\u3088\u3073\u624b\u6cd5<em>A<\/em>\u3068\u624b\u6cd5<em>C<\/em>\u306e\u9593\u306b\u306f\u3001\u8a66\u9a13\u7d50\u679c\u306b\u7d71\u8a08\u7684\u306b\u6709\u610f\u306a\u5dee (\u03b1 = 0.05) \u304c\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059 (p \u5024: 0,000109)\u3002 (p \u5024: &lt;1e-04)\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u307e\u305f\u3001\u624b\u6cd5<em>B<\/em>\u3068<em>C<\/em>\u306e\u9593\u306b\u7d71\u8a08\u7684\u306b\u6709\u610f\u306a\u5dee\u304c<em>\u306a\u3044<\/em>\u3053\u3068\u3082\u308f\u304b\u308a\u307e\u3059 (\u03b1 = 0.05)\u3002<\/span><span style=\"color: #000000;\">\u624b\u6cd5\u9593\u306e\u4fe1\u983c\u533a\u9593\u3082\u3053\u308c\u3089\u306e\u7d50\u679c\u3092\u88cf\u4ed8\u3051\u3066\u3044\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u3057\u305f\u304c\u3063\u3066\u3001\u30af\u30e9\u30b9\u5185\u3067\u306e\u751f\u5f92\u306e\u73fe\u5728\u306e\u6210\u7e3e\u3092\u8abf\u6574\u3057\u305f\u5f8c\u3067\u3082\u3001\u5b66\u7fd2\u30c6\u30af\u30cb\u30c3\u30af<em>A<\/em>\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u30c6\u30af\u30cb\u30c3\u30af<em>B<\/em>\u304a\u3088\u3073<em>C<\/em>\u3068\u6bd4\u8f03\u3057\u3066\u7d71\u8a08\u7684\u306b\u6709\u610f\u306b\u9ad8\u3044\u8a66\u9a13\u6210\u7e3e\u304c\u5f97\u3089\u308c\u308b\u3068\u7d50\u8ad6\u4ed8\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001R \u3067ANCOVA\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002 \u4f8b: R \u306e ANCOVA \u6b21\u306e\u5909\u6570\u3092\u4f7f\u7528\u3057\u3066\u3001ANCOVA \u3092\u5b9f\u884c\u3057\u3066\u3001\u5b66\u7fd2\u30c6\u30af\u30cb\u30c3\u30af\u304c\u8a66\u9a13\u7d50\u679c\u306b\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u304b\u3069\u3046\u304b\u3092\u30c6\u30b9\u30c8\u3057\u307e\u3059\u3002 \u6280\u8853\u7684\u691c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-482","post","type-post","status-publish","format-standard","hentry","category-16"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>R \u3067 ANCOVA \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 - Statology<\/title>\n<meta name=\"description\" content=\"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001R \u3067 ANCOVA (\u5171\u5206\u6563\u5206\u6790) \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/ja\/r\u306e\u30a2\u30f3\u30b3\u30cf\u3099\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"R \u3067 ANCOVA \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 - Statology\" \/>\n<meta property=\"og:description\" content=\"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001R \u3067 ANCOVA (\u5171\u5206\u6563\u5206\u6790) \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/ja\/r\u306e\u30a2\u30f3\u30b3\u30cf\u3099\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-29T18:17:31+00:00\" \/>\n<meta name=\"author\" content=\"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/ja\/r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99\/\",\"url\":\"https:\/\/statorials.org\/ja\/r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99\/\",\"name\":\"R \u3067 ANCOVA \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 - Statology\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/ja\/#website\"},\"datePublished\":\"2023-07-29T18:17:31+00:00\",\"dateModified\":\"2023-07-29T18:17:31+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/ja\/#\/schema\/person\/86b92d2dd87368b26360d19d9c6a5d83\"},\"description\":\"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001R \u3067 ANCOVA (\u5171\u5206\u6563\u5206\u6790) \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/ja\/r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/ja\/r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/ja\/r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u5bb6\",\"item\":\"https:\/\/statorials.org\/ja\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"R \u3067 ancova \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/ja\/#website\",\"url\":\"https:\/\/statorials.org\/ja\/\",\"name\":\"Statorials\",\"description\":\"\u7d71\u8a08\u80fd\u529b\u3078\u306e\u30ac\u30a4\u30c9\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/ja\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/ja\/#\/schema\/person\/86b92d2dd87368b26360d19d9c6a5d83\",\"name\":\"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/statorials.org\/ja\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/statorials.org\/ja\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"http:\/\/statorials.org\/ja\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb\"},\"description\":\"\u79c1\u306f\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u3067\u3059\u3002\u9000\u8077\u3057\u305f\u7d71\u8a08\u6559\u6388\u304b\u3089\u3001\u5c02\u4efb\u306e Statorials \u6559\u80b2\u8005\u306b\u306a\u308a\u307e\u3057\u305f\u3002 \u7d71\u8a08\u5206\u91ce\u306b\u304a\u3051\u308b\u8c4a\u5bcc\u306a\u7d4c\u9a13\u3068\u5c02\u9580\u77e5\u8b58\u3092\u6d3b\u304b\u3057\u3066\u3001\u79c1\u306f Statorials \u3092\u901a\u3058\u3066\u5b66\u751f\u306b\u529b\u3092\u4e0e\u3048\u308b\u305f\u3081\u306b\u81ea\u5206\u306e\u77e5\u8b58\u3092\u5171\u6709\u3059\u308b\u3053\u3068\u306b\u5c3d\u529b\u3057\u3066\u3044\u307e\u3059\u3002\u3082\u3063\u3068\u77e5\u308b\",\"sameAs\":[\"http:\/\/statorials.org\/ja\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"R \u3067 ANCOVA \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 - Statology","description":"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001R \u3067 ANCOVA (\u5171\u5206\u6563\u5206\u6790) \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/statorials.org\/ja\/r\u306e\u30a2\u30f3\u30b3\u30cf\u3099\/","og_locale":"ja_JP","og_type":"article","og_title":"R \u3067 ANCOVA \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 - Statology","og_description":"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001R \u3067 ANCOVA (\u5171\u5206\u6563\u5206\u6790) \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002","og_url":"https:\/\/statorials.org\/ja\/r\u306e\u30a2\u30f3\u30b3\u30cf\u3099\/","og_site_name":"Statorials","article_published_time":"2023-07-29T18:17:31+00:00","author":"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"2\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/ja\/r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99\/","url":"https:\/\/statorials.org\/ja\/r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99\/","name":"R \u3067 ANCOVA \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 - Statology","isPartOf":{"@id":"https:\/\/statorials.org\/ja\/#website"},"datePublished":"2023-07-29T18:17:31+00:00","dateModified":"2023-07-29T18:17:31+00:00","author":{"@id":"https:\/\/statorials.org\/ja\/#\/schema\/person\/86b92d2dd87368b26360d19d9c6a5d83"},"description":"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001R \u3067 ANCOVA (\u5171\u5206\u6563\u5206\u6790) \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/statorials.org\/ja\/r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/ja\/r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/ja\/r%e3%81%ae%e3%82%a2%e3%83%b3%e3%82%b3%e3%83%8f%e3%82%99\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u5bb6","item":"https:\/\/statorials.org\/ja\/"},{"@type":"ListItem","position":2,"name":"R \u3067 ancova \u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/ja\/#website","url":"https:\/\/statorials.org\/ja\/","name":"Statorials","description":"\u7d71\u8a08\u80fd\u529b\u3078\u306e\u30ac\u30a4\u30c9","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/ja\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/statorials.org\/ja\/#\/schema\/person\/86b92d2dd87368b26360d19d9c6a5d83","name":"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/statorials.org\/ja\/#\/schema\/person\/image\/","url":"http:\/\/statorials.org\/ja\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"http:\/\/statorials.org\/ja\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb"},"description":"\u79c1\u306f\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u3067\u3059\u3002\u9000\u8077\u3057\u305f\u7d71\u8a08\u6559\u6388\u304b\u3089\u3001\u5c02\u4efb\u306e Statorials \u6559\u80b2\u8005\u306b\u306a\u308a\u307e\u3057\u305f\u3002 \u7d71\u8a08\u5206\u91ce\u306b\u304a\u3051\u308b\u8c4a\u5bcc\u306a\u7d4c\u9a13\u3068\u5c02\u9580\u77e5\u8b58\u3092\u6d3b\u304b\u3057\u3066\u3001\u79c1\u306f Statorials \u3092\u901a\u3058\u3066\u5b66\u751f\u306b\u529b\u3092\u4e0e\u3048\u308b\u305f\u3081\u306b\u81ea\u5206\u306e\u77e5\u8b58\u3092\u5171\u6709\u3059\u308b\u3053\u3068\u306b\u5c3d\u529b\u3057\u3066\u3044\u307e\u3059\u3002\u3082\u3063\u3068\u77e5\u308b","sameAs":["http:\/\/statorials.org\/ja"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/posts\/482","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/comments?post=482"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/posts\/482\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/media?parent=482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/categories?post=482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/tags?post=482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}