{"id":17247,"date":"2023-05-25T06:00:00","date_gmt":"2023-05-24T21:00:00","guid":{"rendered":"https:\/\/www.muscle-hypertrophy.com\/?p=17247"},"modified":"2023-05-25T07:36:20","modified_gmt":"2023-05-24T22:36:20","slug":"%e5%9b%9e%e5%b8%b0%e6%9b%b2%e7%b7%9a%e3%81%ae95%e4%bf%a1%e9%a0%bc%e5%8c%ba%e9%96%93%e3%82%92r%e3%81%a7%e6%b1%82%e3%82%81%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.muscle-hypertrophy.com\/?p=17247","title":{"rendered":"\u56de\u5e30\u66f2\u7dda\u306e95%\u4fe1\u983c\u533a\u9593\u3092R\u3067\u6c42\u3081\u308b"},"content":{"rendered":"\n<p>\u3000\u524d\u56de\u306e\u8a18\u4e8b\u3067\u306f<a href=\"https:\/\/www.muscle-hypertrophy.com\/?p=17240\" target=\"_blank\" rel=\"noopener\">\u71b1\u4e2d\u75c7\u642c\u9001\u4eba\u54e1\u6570\u306b\u5bfe\u3059\u308b\u65e5\u6700\u9ad8\u6c17\u6e29\u306e\u56de\u5e30\u66f2\u7dda\u3092\u63cf<\/a>\u3044\u305f\uff0e\u4eca\u56de\u306f\u30dd\u30a2\u30bd\u30f3\u5206\u5e03\u306b\u57fa\u3065\u304f\u642c\u9001\u4eba\u54e1\u6570\u306e95%\u4fe1\u983c\u533a\u9593\u3092\u6c42\u3081\u308b\uff0e<\/p>\n<p><!--more--><\/p>\n<h2>\u30c7\u30fc\u30bf\u306e\u30a4\u30f3\u30dd\u30fc\u30c8<\/h2>\n<p>\u3000\u3053\u306e\u6bb5\u968e\u306f\u30e6\u30fc\u30b6\u30fc\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u306e\u4f5c\u696d\u306e\u8a18\u9332\u3067\u3042\u308b\uff0e<\/p>\n<pre>&gt; library(readxl)\n&gt; HeatStroke &lt;- read_excel(\"C:\/Users\/***\/HeatStroke.xlsx\", \n+     col_types = c(\"date\", \"numeric\", \"text\", \n+         \"numeric\", \"numeric\", \"numeric\"))<\/pre>\n<h2>\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u30e2\u30c7\u30eb\u306b\u3088\u308b\u4e00\u822c\u5316\u7dda\u5f62\u56de\u5e30<\/h2>\n<p>\u3000\u65e5\u6700\u9ad8\u6c17\u6e29\u3092x, \u642c\u9001\u4eba\u54e1\u6570\u3092y\u3068\u3057\u3066\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u30e2\u30c7\u30eb\u306b\u3066\u4e00\u822c\u5316\u7dda\u5f62\u56de\u5e30\u3092\u884c\u3046\uff0e\u56de\u5e30\u4fc2\u6570\u304c\u6c42\u307e\u308b\uff0e<\/p>\n<pre>&gt; y = HeatStroke$HeatStroke\n&gt; x = HeatStroke$Temp\n&gt; z = glm(y ~ x, family = poisson(link = \"log\"))\n&gt; z\nCall:  glm(formula = y ~ x, family = poisson(link = \"log\"))\nCoefficients:\n(Intercept)            x  \n     -7.475        0.306  \nDegrees of Freedom: 82784 Total (i.e. Null);  82783 Residual\nNull Deviance:\t    1464000 \nResidual Deviance: 698400 \tAIC: 915500<\/pre>\n<h2>\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u4f5c\u6210<\/h2>\n<p>\u3000p\u3068\u3044\u3046\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u3092\u4f5c\u6210\u3057\uff0cTemp\u306b\u306f\uff11\u304b\u308931\u307e\u3067\u306e\u6574\u6570\u3092\u683c\u7d0d\u3059\u308b\uff0eNum\u306b\u306f\u524d\u6bb5\u3067\u5f97\u3089\u308c\u305f\u56de\u5e30\u4fc2\u6570\u3092\u3082\u3068\u306b\u95a2\u6570\u3092\u4f5c\u6210\u3057\uff0c\u56de\u5e30\u5f0f\u304b\u3089\u4e88\u60f3\u3055\u308c\u308b\u642c\u9001\u4eba\u54e1\u6570\u3092\u683c\u7d0d\u3057\u3066\u3044\u308b\uff0e\u3055\u3089\u306bLow\u306b\u306f95%\u4fe1\u983c\u4e0b\u9650\u3092\uff0cUpp\u306b\u306f95%\u4fe1\u983c\u4e0a\u9650\u3092\u683c\u7d0d\u3057\u3066\u3044\u308b\uff0e\u30dd\u30a2\u30bd\u30f3\u5206\u5e03\u3067\u306f\u5206\u6563\u306f\u5e73\u5747\u5024\u306b\u7b49\u3057\u3044\u3053\u3068\uff0c\u30b5\u30f3\u30d7\u30eb\u30b5\u30a4\u30ba\u304c\u5341\u5206\u306b\u5927\u304d\u3044\u5834\u5408\u306b\u306f2\u6a19\u6e96\u504f\u5dee\u304c\u7d0495\uff05\u3092\u30ab\u30d0\u30fc\u3059\u308b\u3053\u3068\u3092\u5229\u7528\u3057\u3066\u3044\u308b\uff0e<\/p>\n<pre>&gt; p = data.frame(Temp = seq(10, 40, length.out = 31))\n&gt; p$Num = exp(-7.475 + 0.306 * p$Temp)\n&gt; p$Low = p$Num - 2 * sqrt(mean(y))\n&gt; p$Upp = p$Num + 2 * sqrt(mean(y))<\/pre>\n<p>\u3000p\u3092\u5c55\u958b\u3059\u308b\uff0ep$Low\u306b\u306f\u8ca0\u306e\u6570\u5024\u304c\u73fe\u308c\u308b\u304c\uff0c\u30dd\u30a2\u30bd\u30f3\u5206\u5e03\u3067\u306f\u975e\u8ca0\u6570\u3067\u3042\u308b\u3053\u3068\u304b\u3089\uff0c0\u3067\u7f6e\u63db\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\uff0e<\/p>\n<pre>&gt; p\n   Temp          Num         Low        Upp\n1    10   0.01209455  -5.7050657   5.729255\n2    11   0.01642419  -5.7007361   5.733584\n3    12   0.02230376  -5.6948565   5.739464\n4    13   0.03028811  -5.6868721   5.747448\n5    14   0.04113072  -5.6760295   5.758291\n6    15   0.05585479  -5.6613055   5.773015\n7    16   0.07584982  -5.6413104   5.793010\n8    17   0.10300271  -5.6141575   5.820163\n9    18   0.13987585  -5.5772844   5.857036\n10   19   0.18994894  -5.5272113   5.907109\n11   20   0.25794729  -5.4592130   5.975108\n12   21   0.35028786  -5.3668724   6.067448\n13   22   0.47568472  -5.2414755   6.192845\n14   23   0.64597143  -5.0711888   6.363132\n15   24   0.87721777  -4.8399425   6.594378\n16   25   1.19124622  -4.5259140   6.908406\n17   26   1.61769128  -4.0994690   7.334852\n18   27   2.19679614  -3.5203641   7.913956\n19   28   2.98321029  -2.7339500   8.700371\n20   29   4.05114679  -1.6660135   9.768307\n21   30   5.50138567  -0.2157746  11.218546\n22   31   7.47078440   1.7536241  13.187945\n23   32  10.14519303   4.4280328  15.862353\n24   33  13.77699263   8.0598324  19.494153\n25   34  18.70891223  12.9917520  24.426072\n26   35  25.40637178  19.6892115  31.123532\n27   36  34.50140335  28.7842431  40.218564\n28   37  46.85229530  41.1351350  52.569456\n29   38  63.62458804  57.9074278  69.341748\n30   39  86.40106482  80.6839046  92.118225\n31   40 117.33111729 111.6139570 123.048278<\/pre>\n<h2>\u30eb\u30fc\u30d7\u3068\u6761\u4ef6\u5206\u5c90\u306b\u3088\u308a\u7f6e\u63db<\/h2>\n<p>\u3000n\u3068\u3044\u3046\u30ab\u30a6\u30f3\u30bf\u5909\u6570\u3092\u304a\u3044\u3066\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u306b\u30eb\u30fc\u30d7\u3067\u30a2\u30af\u30bb\u30b9\u3057\uff0cp$Low\u304c\u8ca0\u306e\u5834\u5408\u306f0\u306b\u7f6e\u63db\u3057\u3066\u3044\u308b\uff0e<\/p>\n<pre>&gt; for (n in seq(1:31)) {\n+     if (p$Low[n] &lt; 0) {p$Low[n] = 0}\n+ }<\/pre>\n<p>\u3000p\u3092\u5c55\u958b\u3059\u308b\uff0e\u610f\u56f3\u901a\u308a0\u306b\u7f6e\u63db\u3055\u308c\u3066\u3044\u308b\uff0e<\/p>\n<pre>&gt; p\n   Temp          Num        Low        Upp\n1    10   0.01209455   0.000000   5.729255\n2    11   0.01642419   0.000000   5.733584\n3    12   0.02230376   0.000000   5.739464\n4    13   0.03028811   0.000000   5.747448\n5    14   0.04113072   0.000000   5.758291\n6    15   0.05585479   0.000000   5.773015\n7    16   0.07584982   0.000000   5.793010\n8    17   0.10300271   0.000000   5.820163\n9    18   0.13987585   0.000000   5.857036\n10   19   0.18994894   0.000000   5.907109\n11   20   0.25794729   0.000000   5.975108\n12   21   0.35028786   0.000000   6.067448\n13   22   0.47568472   0.000000   6.192845\n14   23   0.64597143   0.000000   6.363132\n15   24   0.87721777   0.000000   6.594378\n16   25   1.19124622   0.000000   6.908406\n17   26   1.61769128   0.000000   7.334852\n18   27   2.19679614   0.000000   7.913956\n19   28   2.98321029   0.000000   8.700371\n20   29   4.05114679   0.000000   9.768307\n21   30   5.50138567   0.000000  11.218546\n22   31   7.47078440   1.753624  13.187945\n23   32  10.14519303   4.428033  15.862353\n24   33  13.77699263   8.059832  19.494153\n25   34  18.70891223  12.991752  24.426072\n26   35  25.40637178  19.689212  31.123532\n27   36  34.50140335  28.784243  40.218564\n28   37  46.85229530  41.135135  52.569456\n29   38  63.62458804  57.907428  69.341748\n30   39  86.40106482  80.683905  92.118225\n31   40 117.33111729 111.613957 123.048278<\/pre>\n<h2>ggplot2\u306b\u3088\u308b\u63cf\u753b<\/h2>\n<pre>&gt; w = ggplot(data = p) + geom_ribbon(aes(x = p$Temp, ymin = p$Low, ymax = p$Upp), alpha = 0.2, fill = \"red\")\n&gt; w + geom_line(data = p, aes(x = p$Temp, y = p$Num), col = \"red\")<\/pre>\n<figure id=\"attachment_17253\" aria-describedby=\"caption-attachment-17253\" style=\"width: 862px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.muscle-hypertrophy.com\/wp-content\/uploads\/2023\/02\/52.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17253\" src=\"https:\/\/www.muscle-hypertrophy.com\/wp-content\/uploads\/2023\/02\/52.png\" alt=\"ggplot2\u306b\u3088\u308b\u56de\u5e30\u66f2\u7dda\u306895%\u4fe1\u983c\u533a\u9593\" width=\"862\" height=\"701\" srcset=\"https:\/\/www.muscle-hypertrophy.com\/wp-content\/uploads\/2023\/02\/52.png 862w, https:\/\/www.muscle-hypertrophy.com\/wp-content\/uploads\/2023\/02\/52-300x244.png 300w, https:\/\/www.muscle-hypertrophy.com\/wp-content\/uploads\/2023\/02\/52-768x625.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><figcaption id=\"caption-attachment-17253\" class=\"wp-caption-text\">ggplot2\u306b\u3088\u308b\u56de\u5e30\u66f2\u7dda\u306895%\u4fe1\u983c\u533a\u9593<\/figcaption><\/figure>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u3000\u56de\u5e30\u66f2\u7dda\u306e95%\u4fe1\u983c\u533a\u9593\u3092R\u3067\u6c42\u3081\uff0cggplot2\u3067\u63cf\u3044\u305f\uff0e\u3082\u3068\u306e\u6563\u5e03\u56f3\u3068\u306e\u30ec\u30a4\u30e4\u30fc\u5408\u6210\u304c\u3067\u304d\u3066\u304a\u3089\u305a\uff0c\u8ab2\u984c\u3067\u3042\u308b\uff0e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000\u524d\u56de\u306e\u8a18\u4e8b\u3067\u306f\u71b1\u4e2d\u75c7\u642c\u9001\u4eba\u54e1\u6570\u306b\u5bfe\u3059\u308b\u65e5\u6700\u9ad8\u6c17\u6e29\u306e\u56de\u5e30\u66f2\u7dda\u3092\u63cf\u3044\u305f\uff0e\u4eca\u56de\u306f\u30dd\u30a2\u30bd\u30f3\u5206\u5e03\u306b\u57fa\u3065\u304f\u642c\u9001\u4eba\u54e1\u6570\u306e95%\u4fe1\u983c\u533a\u9593\u3092\u6c42\u3081\u308b\uff0e<\/p>\n","protected":false},"author":1,"featured_media":17253,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[13342,13341,13340,654,13348,13317,13352,13311,13329,13349,13343,2884,13318,11871,11356,4992,13333,13347,13353,13338,13308,13312,13345,13327,13310,3962,13346,13334,13330,13309,677,13328,13316,13344,12605,5596,13351,13350,1566,13305,11311,4593,13354,13339,256,13268,3615,13326,1590,4326,5852,2468,13325,2916],"class_list":["post-17247","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","tag-13342","tag-13341","tag-13340","tag-654","tag-aes","tag-aic","tag-alpha","tag-coefficients","tag-col_types","tag-data-2","tag-data-frame","tag-date","tag-degrees-of-freedom","tag-exp","tag-family","tag-fill","tag-formula","tag-geom_ribbon","tag-ggplot","tag-ggplot2","tag-glm","tag-intercept","tag-length-out","tag-library","tag-link","tag-log","tag-mean","tag-null-deviance","tag-numeric","tag-poisson","tag-r","tag-read_excel","tag-residual-deviance","tag-seq","tag-sqrt","tag-text","tag-ymax","tag-ymin","tag-1566","tag-13305","tag-11311","tag-4593","tag-13354","tag-13339","tag-256","tag-13268","tag-3615","tag-13326","tag-1590","tag-4326","tag-5852","tag-2468","tag-13325","tag-2916"],"_links":{"self":[{"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/posts\/17247","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17247"}],"version-history":[{"count":9,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/posts\/17247\/revisions"}],"predecessor-version":[{"id":17621,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/posts\/17247\/revisions\/17621"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/media\/17253"}],"wp:attachment":[{"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17247"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17247"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}