User Tools

Site Tools


multicollinearity

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
multicollinearity [2023/05/17 12:10] – [using VIF (Variance Inflation Factors)] hkimscilmulticollinearity [2023/05/22 07:57] (current) – [Testing with correlation matrix] hkimscil
Line 7: Line 7:
 see [[:Singularity]] \\ see [[:Singularity]] \\
  
-====== Testing with correlation matrix ======+====== Testing multicollinearity with correlation matrix ======
 <code> <code>
 options(digits = 4) options(digits = 4)
Line 91: Line 91:
  
 </code> </code>
 +
 +R 에서는 
 +<code>
 +m.a <- lm(FGPA ~ SATV+HSGPA, data = scholar)
 +summary(m.a)
 +# install.packages("olsrr")
 +# library(olsrr)
 +ols_vif_tol(m.a)
 +</code>
 +
 +<code>
 +> m.a <- lm(FGPA ~ SATV+HSGPA, data = scholar)
 +> summary(m.a)
 +
 +Call:
 +lm(formula = FGPA ~ SATV + HSGPA, data = scholar)
 +
 +Residuals:
 +    Min      1Q  Median      3Q     Max 
 +-0.2431 -0.1125 -0.0286  0.1269  0.2716 
 +
 +Coefficients:
 +            Estimate Std. Error t value Pr(>|t|)  
 +(Intercept) 0.233102   0.456379    0.51    0.625  
 +SATV        0.000151   0.001405    0.11    0.917  
 +HSGPA       0.845192   0.283816    2.98    0.021 *
 +---
 +Signif. codes:  
 +0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 +
 +Residual standard error: 0.192 on 7 degrees of freedom
 +Multiple R-squared:  0.851, Adjusted R-squared:  0.809 
 +F-statistic: 20.1 on 2 and 7 DF,  p-value: 0.00126
 +
 +> # install.packages("olsrr")
 +> # library(olsrr)
 +> ols_vif_tol(m.a)
 +  Variables Tolerance   VIF
 +1      SATV    0.2352 4.251
 +2     HSGPA    0.2352 4.251
 +
 +</code>
 +
 +====== using condition index ======
 +<code>
 +ols_eigen_cindex(m.a)
 +</code>
 +
 +<code>
 +> ols_eigen_cindex(m.a)
 +  Eigenvalue Condition Index intercept      SATV     HSGPA
 +1   2.983908            1.00  0.001961 0.0006461 0.0004659
 +2   0.013568           14.83  0.837019 0.1204555 0.0222304
 +3   0.002524           34.38  0.161020 0.8788984 0.9773037
 +
 +</code>
 +
 +
 +
 {{tag>multicollinearity singularity regression preassumption statistics }} {{tag>multicollinearity singularity regression preassumption statistics }}
multicollinearity.1684293010.txt.gz · Last modified: 2023/05/17 12:10 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki