User Tools

Site Tools


suppressor_in_multiple_regression

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
suppressor_in_multiple_regression [2025/11/09 11:57] – [Explanation] hkimscilsuppressor_in_multiple_regression [2025/11/11 01:09] (current) hkimscil
Line 470: Line 470:
  
 </code> </code>
 +====== 도식화 ======
  
-{{pasted:20251109-205717.png}}+{{pasted:20251109-205717.png?400}} 
 +<code> 
 +lm.y.x2 <- lm(y ~ x2) 
 +summary(lm.y.x2)$r.squared = 0 
 +lm.y.x1 <- lm(y ~ x1) 
 +summary(lm.y.x1)$r.squared = a, p > .05 (may be not significant) 
 +# 그러나 아래처럼 x2가 포함됨으로써  
 +# x1 내의 x2와 관련된 부분이 제거되어  
 +# 분석됨으로 significant하게 됨 
 +lm.y.x1x2 <- lm(y ~ x1 +  x2) 
 +summary(lm.y.x1)$r.squared = a  
 +</code> 
 + 
 +<code> 
 +> cor(cs.dat) 
 +                Sales  CompPrice      Price 
 +Sales      1.00000000 0.06407873 -0.4449507 
 +CompPrice  0.06407873 1.00000000  0.5848478 
 +Price     -0.44495073 0.58484777  1.0000000 
 + 
 +> lm.y.x1 <- lm(Sales~Price, data = cs.dat) 
 +> lm.y.x2 <- lm(Sales~CompPrice, data = cs.dat) 
 +> lm.y.x1x2 <- lm(Sales~Price+CompPrice, data = cs.dat) 
 +> summary(lm.y.x1)$r.squared 
 +[1] 0.1979812 
 +> summary(lm.y.x1x2)$r.squared 
 +[1] 0.3578332 
 +> summary(lm.y.x1x2)$r.squared - summary(lm.y.x1)$r.squared 
 +[1] 0.159852   # x2 고유의 설명력? b, c, d 중 d 파트  
 +>  
 +> summary(lm.y.x2)$r.squared 
 +[1] 0.004106084   # 그러나 c, d 파트가 위의 결과보다 더 작음 
 +> lm.x1.x2 <- lm(Price~CompPrice, data = cs.dat) 
 +> res.x1x2 <- lm.x1.x2$residuals 
 +> lm.y.onlyx1<- lm(Sales~res.x1x2) 
 +> summary(lm.y.onlyx1)$r.squared 
 +[1] 0.3537271 
 +> summary(lm.y.x1x2)$r.squared 
 +[1] 0.3578332 
 +>  
 +> summary(lm.y.x1x2)$r.squared - summary(lm.y.onlyx1)$r.squared 
 +[1] 0.004106084 
 +>  
 +>  
 +> summary(lm.y.x1)$r.squared 
 +[1] 0.1979812 
 +
 +> summary(lm.y.x1)$r.squared 
 +[1] 0.1979812 
 +> pcor.test(Sales, Price, CompPrice) 
 +    estimate     p.value statistic   n gp  Method 
 +1 -0.5959744 9.95161e-40 -14.78787 400  1 pearson 
 +> pcor.test(Sales, Price, CompPrice)$estimate^2 
 +[1] 0.3551855 
 +> summary(lm.y.x2)$r.squared 
 +[1] 0.004106084 
 +>  
 +</code>
suppressor_in_multiple_regression.1762689440.txt.gz · Last modified: by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki