{"id":330,"date":"2018-09-01T20:51:21","date_gmt":"2018-09-01T11:51:21","guid":{"rendered":"https:\/\/best-biostatistics.com\/toukei-er\/entry\/multiple-regression-model-with-auto-dataset-of-islr-in-r\/"},"modified":"2024-10-13T14:31:04","modified_gmt":"2024-10-13T05:31:04","slug":"multiple-regression-model-with-auto-dataset-of-islr-in-r","status":"publish","type":"post","link":"https:\/\/best-biostatistics.com\/toukei-er\/entry\/multiple-regression-model-with-auto-dataset-of-islr-in-r\/","title":{"rendered":"R \u3067\u91cd\u56de\u5e30\u5206\u6790\u3092\u884c\u3046\u5177\u4f53\u4f8b \u2015 ISLR \u30d1\u30c3\u30b1\u30fc\u30b8 Auto \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u4f7f\u3063\u305f\u91cd\u56de\u5e30\u5206\u6790"},"content":{"rendered":"\n<p>R \u306e ISLR \u30d1\u30c3\u30b1\u30fc\u30b8\u306e Auto \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u4f7f\u3063\u305f\u5206\u6790\u4f8b\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u30c7\u30fc\u30bf\u306e\u6e96\u5099\">\u30c7\u30fc\u30bf\u306e\u6e96\u5099<\/h2>\n\n\n\n<p>\u6700\u521d\u306e\u4e00\u56de\u3060\u3051\u3001ISLR\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>install.packages(\"ISLR\")<\/code><\/pre>\n\n\n\n<p>ISLR\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u547c\u3073\u51fa\u3057\u3066\u3001\u89e3\u6790\u958b\u59cb\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>library(ISLR)<\/code><\/pre>\n\n\n\n<p>ISLR\u30d1\u30c3\u30b1\u30fc\u30b8\u306eAuto\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u7528\u3044\u3066\u89e3\u6790\u3002<\/p>\n\n\n\n<p>9\u5909\u6570\u3001392\u4f8b\u306e\u30c7\u30fc\u30bf\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; str(Auto)\n'data.frame':   392 obs. of  9 variables:\n$ mpg         : num  18 15 18 16 17 15 14 14 14 15 ...\n$ cylinders   : num  8 8 8 8 8 8 8 8 8 8 ...\n$ displacement: num  307 350 318 304 302 429 454 440 455 390 ...\n$ horsepower  : num  130 165 150 150 140 198 220 215 225 190 ...\n$ weight      : num  3504 3693 3436 3433 3449 ...\n$ acceleration: num  12 11.5 11 12 10.5 10 9 8.5 10 8.5 ...\n$ year        : num  70 70 70 70 70 70 70 70 70 70 ...\n$ origin      : num  1 1 1 1 1 1 1 1 1 1 ...\n$ name        : Factor w\/ 304 levels \"amc ambassador brougham\",..: 49 36 231 14 161 141 54 223 241 2 ...\n&gt;\n<\/code><\/pre>\n\n\n\n<p>name\u4ee5\u5916\u306e\u5909\u6570\u3092\u4f7f\u3046\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Auto1 &lt;- Auto&#91;1:8]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Miles-per-gallon\u3092\u4e88\u6e2c\u3059\u308b\u56e0\u5b50\u306e\u76f8\u95a2\u4fc2\u6570\">Miles per gallon\u3092\u4e88\u6e2c\u3059\u308b\u56e0\u5b50\u306e\u76f8\u95a2\u4fc2\u6570<\/h2>\n\n\n\n<p>origin\u4ee5\u5916\u306e7\u3064\u306e\u5909\u6570\u3067\u76f8\u95a2\u4fc2\u6570\u884c\u5217\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; round(cor(Auto1&#91;1:7]),3)\nmpg cylinders displacement horsepower weight acceleration   year\nmpg           1.000    -0.778       -0.805     -0.778 -0.832        0.423  0.581\ncylinders    -0.778     1.000        0.951      0.843  0.898       -0.505 -0.346\ndisplacement -0.805     0.951        1.000      0.897  0.933       -0.544 -0.370\nhorsepower   -0.778     0.843        0.897      1.000  0.865       -0.689 -0.416\nweight       -0.832     0.898        0.933      0.865  1.000       -0.417 -0.309\nacceleration  0.423    -0.505       -0.544     -0.689 -0.417        1.000  0.290\nyear          0.581    -0.346       -0.370     -0.416 -0.309        0.290  1.000\n<\/code><\/pre>\n\n\n\n<div id=\"biost-123331531\" 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=\"Miles-per-gallon\u3092\u56fd\u5225\u306b\u6bd4\u8f03\">Miles per gallon\u3092\u56fd\u5225\u306b\u6bd4\u8f03<\/h2>\n\n\n\n<p>origin\u5225\u306empg(miles per gallon=\u71c3\u8cbb)\u3092ANOVA\u3067\u5206\u6790\u3059\u308b\u3002<\/p>\n\n\n\n<p>origin\u306e\u5185\u5bb9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Origin of car (1. American, 2. European, 3. Japanese)<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>res.origin &lt;- lm(mpg ~ factor(origin), data=Auto1)\nsummary(res.origin)<\/code><\/pre>\n\n\n\n<p>\u30a2\u30e1\u8eca\u306b\u6bd4\u3079\u30e8\u30fc\u30ed\u30c3\u30d1\u8eca\u306f\u71c3\u8cbb\u304c\u3044\u3044\u3057\u3001\u65e5\u672c\u8eca\u306f\u3055\u3089\u306b\u3044\u3044\u3002<\/p>\n\n\n\n<p>Estimate\u304cmiles per gallon\u63a8\u5b9a\u5024\u3067\u3001\u30a2\u30e1\u8eca\u306b\uff0b7.6\u304c\u30e8\u30fc\u30ed\u30c3\u30d1\u8eca\u3001\uff0b10.4\u304c\u65e5\u672c\u8eca\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; summary(res.origin)\nCall:\nlm(formula = mpg ~ factor(origin), data = Auto1)\nResiduals:\nMin      1Q  Median      3Q     Max\n-12.451  -5.034  -1.034   3.649  18.966\nCoefficients:\nEstimate Std. Error t value Pr(&gt;|t|)\n(Intercept)      20.0335     0.4086  49.025   &lt;2e-16 ***\nfactor(origin)2   7.5695     0.8767   8.634   &lt;2e-16 ***\nfactor(origin)3  10.4172     0.8276  12.588   &lt;2e-16 ***\n---\nSignif. codes:  0 \u2018***\u2019 0.001 \u2018**\u2019 0.01 \u2018*\u2019 0.05 \u2018.\u2019 0.1 \u2018 \u2019 1\nResidual standard error: 6.396 on 389 degrees of freedom\nMultiple R-squared:  0.3318,    Adjusted R-squared:  0.3284\nF-statistic:  96.6 on 2 and 389 DF,  p-value: &lt; 2.2e-16\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Miles-per-gallon\u3092\u4e88\u6e2c\u3059\u308b\u91cd\u56de\u5e30\u30e2\u30c7\u30eb\u306e\u4f5c\u6210\">Miles per gallon\u3092\u4e88\u6e2c\u3059\u308b\u91cd\u56de\u5e30\u30e2\u30c7\u30eb\u306e\u4f5c\u6210<\/h2>\n\n\n\n<p>\u5168\u90e8\u306e\u5909\u6570\u3067mpg\u3092\u63a8\u6e2c\u3059\u308b\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u3066\u307f\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>res1 &lt;- lm(mpg ~ cylinders + displacement + horsepower + weight + acceleration + year + factor(origin), data=Auto1)\nsummary(res1)<\/code><\/pre>\n\n\n\n<p>Adjusted R-squared\u304c0.8205\u3068\u9ad8\u304f\u3001\u3053\u306e\u91cd\u56de\u5e30\u30e2\u30c7\u30eb\u306e\u8aac\u660e\u5909\u6570\u306f\u76ee\u7684\u5909\u6570\u3092\u3088\u304f\u8aac\u660e\u3057\u3066\u3044\u308b\u3002<\/p>\n\n\n\n<p>displacement (\u6392\u6c17\u91cf), weight, year, origin\u306f\u7d71\u8a08\u5b66\u7684\u6709\u610f\u306b\u95a2\u9023\u3042\u308a\u3002<\/p>\n\n\n\n<p>\u4f8b\u3048\u3070\u3001year\u304c1\u5897\u52a0\u3059\u308b\uff081\u5e74\u65b0\u3057\u304f\u306a\u308b\uff09\u3068\u3001mpg\u304c0.777\u5897\u52a0\uff08\u71c3\u8cbb\u5411\u4e0a\uff09\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; summary(res1)\nCall:\nlm(formula = mpg ~ cylinders + displacement + horsepower + weight +\nacceleration + year + factor(origin), data = Auto1)\nResiduals:\nMin      1Q  Median      3Q     Max\n-9.0095 -2.0785 -0.0982  1.9856 13.3608\nCoefficients:\nEstimate Std. Error t value Pr(&gt;|t|)\n(Intercept)     -1.795e+01  4.677e+00  -3.839 0.000145 ***\ncylinders       -4.897e-01  3.212e-01  -1.524 0.128215\ndisplacement     2.398e-02  7.653e-03   3.133 0.001863 **\nhorsepower      -1.818e-02  1.371e-02  -1.326 0.185488\nweight          -6.710e-03  6.551e-04 -10.243  &lt; 2e-16 ***\nacceleration     7.910e-02  9.822e-02   0.805 0.421101\nyear             7.770e-01  5.178e-02  15.005  &lt; 2e-16 ***\nfactor(origin)2  2.630e+00  5.664e-01   4.643 4.72e-06 ***\nfactor(origin)3  2.853e+00  5.527e-01   5.162 3.93e-07 ***\n---\nSignif. codes:  0 \u2018***\u2019 0.001 \u2018**\u2019 0.01 \u2018*\u2019 0.05 \u2018.\u2019 0.1 \u2018 \u2019 1\nResidual standard error: 3.307 on 383 degrees of freedom\nMultiple R-squared:  0.8242,    Adjusted R-squared:  0.8205\nF-statistic: 224.5 on 8 and 383 DF,  p-value: &lt; 2.2e-16\n<\/code><\/pre>\n\n\n\n<p>\u6b8b\u5dee\u30d7\u30ed\u30c3\u30c8\u3002<\/p>\n\n\n\n<p>\u4e88\u6e2c\u5f0f\u306e\u6027\u80fd\u30c1\u30a7\u30c3\u30af\u3002<\/p>\n\n\n\n<p>Residuals vs. Fitted\u3068Scale-Location\u306f\u6c34\u5e73\u306a\u8d64\u3044\u7dda\u304c\u7406\u60f3\u3002<\/p>\n\n\n\n<p>Normal Q-Q\u306f\u3059\u3079\u3066\u306e\u70b9\u304c\u659c\u3081\u306e\u7dda\u4e0a\u3067\u3042\u308b\u306e\u304c\u7406\u60f3\u3002<\/p>\n\n\n\n<p>Residuals vs. Leverage\u306f\u8d64\u3044\u70b9\u7dda\u3088\u308a\u5916\u5074\u306b\u70b9\u304c\u306a\u3044\u306e\u304c\u7406\u60f3\u3002<\/p>\n\n\n\n<p>Residual vs. Fitted\u306f\u3001\u53b3\u5bc6\u306b\u3044\u3046\u3068\u3001heteroscedasticity\uff08\u5206\u6563\u4e0d\u5747\u4e00\u6027\uff09\u306b\u898b\u3048\u308b\u3002<\/p>\n\n\n\n<p>Normal Q-Q\u306f\u3001Quartile\u304c\u5927\u304d\u3044\u3068\u3053\u308d\u3067\u305a\u308c\u304c\u3042\u308b\u3002<\/p>\n\n\n\n<p>Scale-Location\u3068Residuals vs. Leverage\u306f\u53d6\u308a\u7acb\u3066\u3066\u554f\u984c\u70b9\u306f\u306a\u3044\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">layout(t(matrix(c(1:4),nr=2)))\nplot(res1)<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"653\" height=\"653\" src=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/09\/20190908213122.png\" alt=\"\" class=\"wp-image-2770\" title=\"f:id:toukeier:20190908213122p:plain\" srcset=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/09\/20190908213122.png 653w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/09\/20190908213122-300x300.png 300w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/09\/20190908213122-150x150.png 150w\" sizes=\"(max-width: 653px) 100vw, 653px\" \/><\/figure>\n\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u4ea4\u4e92\u4f5c\u7528\u9805\u3092\u5165\u308c\u305f\u89e3\u6790\">\u4ea4\u4e92\u4f5c\u7528\u9805\u3092\u5165\u308c\u305f\u89e3\u6790<\/h2>\n\n\n\n<p>\u4f8b\u3068\u3057\u3066\u3001year\u3068displacement\u306e\u4ea4\u4e92\u4f5c\u7528\u9805\u3092\u8ffd\u52a0\u3057\u3066\u518d\u5ea6\u89e3\u6790\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>res2 &lt;- lm(mpg ~ cylinders + displacement + horsepower + weight + acceleration + year + year:displacement + factor(origin), data=Auto1)\nsummary(res2)<\/code><\/pre>\n\n\n\n<p>displacement\u3068year\u306e\u4ea4\u4e92\u4f5c\u7528\u9805\u3092\u8db3\u3057\u3066\u307f\u305f\u3068\u3053\u308d\u3001<\/p>\n\n\n\n<p>displacement:year: p=3.51e-12 ***<\/p>\n\n\n\n<p>\u3068\u3044\u3046\u7d50\u679c\u3092\u5f97\u305f\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u9805\u306f\u7d71\u8a08\u5b66\u7684\u6709\u610f\u3067\u3042\u3063\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; summary(res2)\nCall:\nlm(formula = mpg ~ cylinders + displacement + horsepower + weight +\nacceleration + year + year:displacement + factor(origin),\ndata = Auto1)\nResiduals:\nMin      1Q  Median      3Q     Max\n-7.5860 -2.0066  0.0133  1.6529 12.1025\nCoefficients:\nEstimate Std. Error t value Pr(&gt;|t|)\n(Intercept)       -6.451e+01  7.829e+00  -8.241 2.77e-15 ***\ncylinders          2.606e-02  3.103e-01   0.084   0.9331\ndisplacement       2.806e-01  3.642e-02   7.704 1.15e-13 ***\nhorsepower        -3.370e-02  1.306e-02  -2.580   0.0103 *\nweight            -6.116e-03  6.212e-04  -9.844  &lt; 2e-16 ***\nacceleration       1.048e-01  9.237e-02   1.134   0.2574\nyear               1.375e+00  9.645e-02  14.261  &lt; 2e-16 ***\nfactor(origin)2    2.588e+00  5.323e-01   4.861 1.71e-06 ***\nfactor(origin)3    2.453e+00  5.224e-01   4.695 3.73e-06 ***\ndisplacement:year -3.560e-03  4.953e-04  -7.187 3.51e-12 ***\n---\nSignif. codes:  0 \u2018***\u2019 0.001 \u2018**\u2019 0.01 \u2018*\u2019 0.05 \u2018.\u2019 0.1 \u2018 \u2019 1\nResidual standard error: 3.107 on 382 degrees of freedom\nMultiple R-squared:  0.8451,    Adjusted R-squared:  0.8415\nF-statistic: 231.6 on 9 and 382 DF,  p-value: &lt; 2.2e-16\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u591a\u91cd\u5171\u7dda\u6027\u3092\u30c1\u30a7\u30c3\u30af\">\u591a\u91cd\u5171\u7dda\u6027\u3092\u30c1\u30a7\u30c3\u30af<\/h2>\n\n\n\n<p>\u591a\u91cd\u5171\u7dda\u6027\u306e\u30c1\u30a7\u30c3\u30af\u306e\u305f\u3081\u306bVIF\uff08Variance Inflation Factor\uff09\u3092\u8a08\u7b97\u3002<\/p>\n\n\n\n<p>VIF\u306b\u3064\u3044\u3066\u306f\u3053\u3061\u3089\u3092\u53c2\u7167\u3002<\/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\/how-to-calculate-vif-by-r\/\">R \u3067\u591a\u91cd\u5171\u7dda\u6027\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u305f\u3081\u306b VIF \u3092\u8a08\u7b97\u3059\u308b\u65b9\u6cd5<\/a>\n\t\t\t\t\t\t<span class=\"p-blogCard__excerpt\">\u91cd\u56de\u5e30\u5206\u6790\u3067\u3001\u5909\u6570\u9078\u629e\u306b\u304a\u3044\u3066\u3001\u8003\u616e\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u304c\u3001\u591a\u91cd\u5171\u7dda\u6027\u3002 \u591a\u91cd\u5171\u7dda\u6027\u306e\u30c1\u30a7\u30c3\u30af\u306f\u7d71\u8a08\u30bd\u30d5\u30c8R\u3067\u3069\u3046\u3084\u308b\u306e\u304b\uff1f \u591a\u91cd\u5171\u7dda\u6027\u3068\u306f\u4f55\u304b\uff1f \u751f\u307e\u308c\u305f\u897f\u66a6\u5e74&#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<p>car \u30d1\u30c3\u30b1\u30fc\u30b8\u306e vif() \u95a2\u6570\u3092\u4f7f\u3046\u3002<\/p>\n\n\n\n<p>library(car) \u3067\u547c\u3073\u51fa\u305b\u306a\u3044\u5834\u5408\u3001install.packages(&#8220;car&#8221;) \u3067\u4e00\u56de\u3060\u3051\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u884c\u3046\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; library(car)\n\u8981\u6c42\u3055\u308c\u305f\u30d1\u30c3\u30b1\u30fc\u30b8 carData \u3092\u30ed\u30fc\u30c9\u4e2d\u3067\u3059\n&gt;  vif(res1)\nGVIF Df GVIF^(1\/(2*Df))\ncylinders      10.737771  1        3.276854\ndisplacement   22.937950  1        4.789358\nhorsepower      9.957265  1        3.155513\nweight         11.074349  1        3.327814\nacceleration    2.625906  1        1.620465\nyear            1.301373  1        1.140777\nfactor(origin)  2.096060  2        1.203236<\/code><\/pre>\n\n\n\n<p>GVIF\u306e\u5217\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n\n\n\n<p>\u6163\u4f8b\u3068\u3057\u3066\u30015\u4ee5\u4e0a\u306f\u591a\u91cd\u5171\u7dda\u6027\u306e\u53ef\u80fd\u6027\u3042\u308a\u300110\u4ee5\u4e0a\u306f\u591a\u91cd\u5171\u7dda\u6027\u306e\u53ef\u80fd\u6027\u304c\u304b\u306a\u308a\u9ad8\u3044\u3068\u5224\u65ad\u3059\u308b\u3002<\/p>\n\n\n\n<p>displacement\u304c5\u306b\u8fd1\u304f\u591a\u91cd\u5171\u7dda\u6027\u306e\u53ef\u80fd\u6027\u3092\u8003\u3048\u3001\u5916\u3057\u3066\u307f\u3066\u518d\u89e3\u6790\u3057\u3066\u307f\u308b\u3002<\/p>\n\n\n\n<p>GVIF\u304c5\u306b\u8fd1\u3044\u3082\u306e\u306f\u306a\u304f\u306a\u3063\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; res11 &lt;- lm(mpg ~ cylinders + horsepower + weight + acceleration + year + factor(origin), data=Auto1)\n&gt; vif(res11)\nGVIF Df GVIF^(1\/(2*Df))\ncylinders      6.249795  1        2.499959\nhorsepower     9.096327  1        3.016012\nweight         9.260848  1        3.043164\nacceleration   2.600476  1        1.612599\nyear           1.285826  1        1.133943\nfactor(origin) 1.794849  2        1.157463\n&gt; summary(res11)\nCall:\nlm(formula = mpg ~ cylinders + horsepower + weight + acceleration +\nyear + factor(origin), data = Auto1)\nResiduals:\nMin      1Q  Median      3Q     Max\n-9.2846 -2.1094  0.0135  1.8127 13.4034\nCoefficients:\nEstimate Std. Error t value Pr(&gt;|t|)\n(Intercept)     -1.861e+01  4.726e+00  -3.939 9.71e-05 ***\ncylinders        1.610e-01  2.479e-01   0.649 0.516474\nhorsepower      -5.554e-03  1.325e-02  -0.419 0.675378\nweight          -5.880e-03  6.059e-04  -9.704  &lt; 2e-16 ***\nacceleration     4.882e-02  9.886e-02   0.494 0.621702\nyear             7.593e-01  5.206e-02  14.585  &lt; 2e-16 ***\nfactor(origin)2  2.023e+00  5.383e-01   3.758 0.000198 ***\nfactor(origin)3  2.317e+00  5.316e-01   4.359 1.68e-05 ***\n---\nSignif. codes:  0 \u2018***\u2019 0.001 \u2018**\u2019 0.01 \u2018*\u2019 0.05 \u2018.\u2019 0.1 \u2018 \u2019 1\nResidual standard error: 3.344 on 384 degrees of freedom\nMultiple R-squared:  0.8197,    Adjusted R-squared:  0.8164\nF-statistic: 249.4 on 7 and 384 DF,  p-value: &lt; 2.2e-16\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u60c5\u5831\u91cf\u898f\u6e96\u3067\u30e2\u30c7\u30eb\u8a3a\u65ad\">\u60c5\u5831\u91cf\u898f\u6e96\u3067\u30e2\u30c7\u30eb\u8a3a\u65ad<\/h2>\n\n\n\n<p>AIC\uff08\u8d64\u6c60\u60c5\u5831\u91cf\u898f\u6e96\uff09\u3001BIC\uff08\u30d9\u30a4\u30ba\u60c5\u5831\u91cf\u898f\u6e96\uff09\u306e\u4e8c\u3064\u3067\u30e2\u30c7\u30eb\u8a3a\u65ad\u3002<\/p>\n\n\n\n<p>\u5f53\u3066\u306f\u307e\u308a\u306e\u826f\u3055\u3092\u30c1\u30a7\u30c3\u30af\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>AIC(res1, res11, res2)\nBIC(res1, res11, res2)<\/code><\/pre>\n\n\n\n<p>\u5024\u304c\u5c0f\u3055\u3044\u307b\u3046\u304c\u5f53\u3066\u306f\u307e\u308a\u304c\u3088\u3044\u3002<\/p>\n\n\n\n<p>AIC\u3082BIC\u3082\u4ea4\u4e92\u4f5c\u7528\u9805\u3092\u5165\u308c\u305f\u30e2\u30c7\u30eb\u304c\u6700\u3082\u5f53\u3066\u306f\u307e\u308a\u304c\u3088\u3044\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; AIC(res1, res11, res2)\ndf      AIC\nres1  10 2060.928\nres11  9 2068.848\nres2  11 2013.216\n&gt; BIC(res1, res11, res2)\ndf     BIC\nres1  10 2100.64\nres11  9 2104.59\nres2  11 2056.90\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u307e\u3068\u3081\">\u307e\u3068\u3081<\/h2>\n\n\n\n<p>R \u306e ISLR \u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u3042\u308b Auto \u30c7\u30fc\u30bf\u3067\u3001\u91cd\u56de\u5e30\u5206\u6790\u3092\u3084\u3063\u3066\u307f\u305f\u3002<\/p>\n\n\n\n<p>\u9806\u756a\u3068\u3057\u3066\u306f\u3001\u5148\u884c\u7814\u7a76\u3084\u7406\u8ad6\u3092\u3082\u3068\u306b\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u3001\u6b8b\u5dee\u30d7\u30ed\u30c3\u30c8\u3084\u60c5\u5831\u91cf\u898f\u6e96\u3067\u5f53\u3066\u306f\u307e\u308a\u3092\u8a3a\u65ad\u3059\u308b\u3002<\/p>\n\n\n\n<p>\u53c2\u8003\u306b\u306a\u308c\u3070\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>R \u306e ISLR \u30d1\u30c3\u30b1\u30fc\u30b8\u306e Auto \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u4f7f\u3063\u305f\u5206\u6790\u4f8b\u3002<\/p>\n","protected":false},"author":2,"featured_media":2770,"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,23,83],"tags":[],"class_list":["post-330","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-r","category-23","category-83"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/09\/20190908213122.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts\/330","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=330"}],"version-history":[{"count":2,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts\/330\/revisions"}],"predecessor-version":[{"id":2771,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts\/330\/revisions\/2771"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/media\/2770"}],"wp:attachment":[{"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/media?parent=330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/categories?post=330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/tags?post=330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}