!!!VIF: Variance Inflation Factor VIF = 1/(1 - 相関係数^2) *<<10以上>>は多重共線性があり、重回帰分析では、よくないといわれている。 *つまり、<<相関係数が 0.95以上>>もあるわけで、これでは、二つの変数がほぼ同じものと言わざるを得ない。それにより変数の係数(パラメータ)のバラツキが大きくなって、結果を正しく予測できなくなる。 , 相関係数 , VIF , 0.1 , 1.01 , 0.2 , 1.04 , 0.3 , 1.10 , 0.4 , 1.19 , 0.5 , 1.33 , 0.6 , 1.56 , 0.7 , 1.96 , 0.8 , 2.78 , 0.9 , 5.26 , 0.91 , 5.82 , 0.92 , 6.51 , 0.93 , 7.40 , 0.94 , 8.59 , 0.95 , 10.26 , 0.96 , 12.76 , 0.97 , 16.92 , 0.98 , 25.25 , 0.99 , 50.25 ---- *carライブラリーに入っている <>関数をつかうか、 *自分で計算する。 **相関係数を出しておいて、 **それをもとに上記の式に入れて計算 ***3つ以上の変数があっても、cor()で相関を出したものをそのまま式に入れればでてくる。 {{pre > head(natural.essay) ID rator unnatural personal demonst connective cohesion coherence reader 1 1 1 2 1 1 1 1 1 1 2 2 1 3 2 2 1 2 3 1 3 3 1 1 1 1 1 1 2 1 4 4 1 2 2 2 1 2 1 1 5 5 1 3 2 2 2 2 1 1 6 6 1 3 4 2 3 3 2 2 > essay.cor <- cor(natural.essay[4:9]) > essay.cor personal demonst connective cohesion coherence reader personal 1.0000000 0.3752549 0.2637466 0.3880668 0.3335803 0.3812672 demonst 0.3752549 1.0000000 0.4541083 0.6758945 0.5271825 0.4814715 connective 0.2637466 0.4541083 1.0000000 0.6784362 0.5172866 0.5457911 cohesion 0.3880668 0.6758945 0.6784362 1.0000000 0.6797344 0.6466878 coherence 0.3335803 0.5271825 0.5172866 0.6797344 1.0000000 0.7156233 reader 0.3812672 0.4814715 0.5457911 0.6466878 0.7156233 1.0000000 > essay.vif <- 1/(1-essay.cor^2) > essay.vif personal demonst connective cohesion coherence reader personal Inf 1.163895 1.074763 1.177296 1.125209 1.170090 demonst 1.163895 Inf 1.259786 1.841056 1.384891 1.301769 connective 1.074763 1.259786 Inf 1.852798 1.365347 1.424274 cohesion 1.177296 1.841056 1.852798 Inf 1.858870 1.718819 coherence 1.125209 1.384891 1.365347 1.858870 Inf 2.049670 reader 1.170090 1.301769 1.424274 1.718819 2.049670 Inf }} *ロジスティック回帰では、変数間の相関係数が0.9以上の場合に注意する、という対応でよさそうですね。 **Reference https://ameblo.jp/intelligent-pharmacist/entry-12244173975.html