User Tools

Site Tools


multiple_regression_exercise

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
multiple_regression_exercise [2025/10/30 13:13] – [추가 설명 2] hkimscilmultiple_regression_exercise [2025/10/30 13:28] (current) – [추가설명] hkimscil
Line 310: Line 310:
 아래는 Advertising을 없애질 않고 ShelveLoc을 없앤것이라서 약간 다르게 보이지만 요지는 같습니다.  아래는 Advertising을 없애질 않고 ShelveLoc을 없앤것이라서 약간 다르게 보이지만 요지는 같습니다. 
 <code> <code>
- 
 > lm.1 <- lm(Sales ~ Advertising + Advertising:ShelveLoc, data = Carseats) > lm.1 <- lm(Sales ~ Advertising + Advertising:ShelveLoc, data = Carseats)
-> lm.1 +summary(lm.1)
  
 Call: Call:
 lm(formula = Sales ~ Advertising + Advertising:ShelveLoc, data = Carseats) lm(formula = Sales ~ Advertising + Advertising:ShelveLoc, data = Carseats)
 +
 +Residuals:
 +    Min      1Q  Median      3Q     Max 
 +-6.7650 -1.7351 -0.1523  1.5481  8.1350 
  
 Coefficients: Coefficients:
-        (Intercept)                  Advertising    Advertising:ShelveLocGood  Advertising:ShelveLocMedium   +                            Estimate Std. Error t value Pr(>|t|)     
-            6.76500                     -0.05412                      0.35597                      0.14922  +(Intercept)                  6.76500    0.17503  38.650  < 2e-16 *** 
 +Advertising                 -0.05412    0.03136  -1.726   0.0852 .   
 +Advertising:ShelveLocGood    0.35597    0.03901   9.126  < 2e-16 *** 
 +Advertising:ShelveLocMedium  0.14922    0.03346   4.460 1.07e-05 *** 
 +--- 
 +Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
 + 
 +Residual standard error: 2.476 on 396 degrees of freedom 
 +Multiple R-squared:  0.237, Adjusted R-squared:  0.2312  
 +F-statistic:    41 on 3 and 396 DF,  p-value: < 2.2e-16 
 + 
 +
 </code> </code>
  
 위에서 prediction model 식을 완성한다고 하면  위에서 prediction model 식을 완성한다고 하면 
    
-Sales hat = 6.76500 - 0.05412 * Advertising  --> ShelveLocBad 인경우 +  * **Sales hat = 6.76500 - 0.05412 * Advertising**  --> **ShelveLocBad** 인경우 
-Sales hat = 6.76500 (0.05412 + 0.14922) * Advertising  --> ShelveLocMedium 인경우  +  Sales hat = 6.76500 (-0.05412 + 0.14922) * Advertising  --> ShelveLocMedium 인경우  
-Sales hat = 6.76500 - (0.05412 + 0.35597) * Advertising  --> ShelveLocGood 인경우 +    Sales hat = **6.76500 - (0.0951)*Advertising**  --> **ShelveLocMedium** 인경우  
 +  * Sales hat = 6.76500 + (-0.05412 + 0.35597) * Advertising  --> ShelveLocGood 인경우  
 +    * **Sales hat = 6.76500 - (0.30185)*Advertising**  --> **ShelveLocGood** 인경우 
 라고 하겠습니다.  라고 하겠습니다. 
  
Line 423: Line 439:
  
 </code> </code>
 +1) Bad 인 경우는 
 +  * **Sales hat = 6.76500 + -0.05412*Advertising** 이 됩니다. 
  
-1) ShelveLoc Good일 경우, ShelveLOcGood = 1이고 나머지는 0이므로  +2) ShelveLoc Good일 경우, ShelveLOcGood = 1이고 나머지는 0이므로  
-Sales hat = Intercept + Advertising:ShelveLocGood 이 됩니다. 즉,  +  Sales hat = Intercept + Advertising:ShelveLocGood 이 됩니다. 즉,  
-Sales hat = 6.76500 + 0.30185 <fc #ff0000>* Advertising</fc>  +  * **Sales hat = 6.76500 + 0.30185*Advertising** 
-  * 위의 <fc #ff0000>* Advertising</fc>은  +    * 위의 <fc #ff0000>* Advertising</fc>은  
-  * Advertising:ShelveLocGood 에서  +    * Advertising:ShelveLocGood 에서  
-  * Ad coefficient (0.30185) * SelfveLoc-Good (1)  +    * Ad coefficient (0.30185) * SelfveLocGood (1)  이라는 이야기입니다.
-  이라는 이야기입니다.+
  
-2) ShelveLoc Medium일 경우는  +3) ShelveLoc Medium일 경우는  
-Sales hat = 6.76500 + 0.09510 * Advertising 이 됩니다 +  * **Sales hat = 6.76500 + 0.09510 * Advertising*이 됩니다
- +
-3) Bad 인 경우는  +
-Sales hat = 6.76500 + -0.05412 Advertising 이 됩니다+
  
 위는 결국 lm.1 과 같은 모델이라는 뜻입니다.  위는 결국 lm.1 과 같은 모델이라는 뜻입니다. 
-<code> 
-> summary(lm.1) 
- 
-Call: 
-lm(formula = Sales ~ Advertising + Advertising:ShelveLoc, data = Carseats) 
- 
-Residuals: 
-    Min      1Q  Median      3Q     Max  
--6.7650 -1.7351 -0.1523  1.5481  8.1350  
- 
-Coefficients: 
-                            Estimate Std. Error t value Pr(>|t|)     
-(Intercept)                  6.76500    0.17503  38.650  < 2e-16 *** 
-Advertising                 -0.05412    0.03136  -1.726   0.0852 .   
-Advertising:ShelveLocGood    0.35597    0.03901   9.126  < 2e-16 *** 
-Advertising:ShelveLocMedium  0.14922    0.03346   4.460 1.07e-05 *** 
---- 
-Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
- 
-Residual standard error: 2.476 on 396 degrees of freedom 
-Multiple R-squared:  0.237, Adjusted R-squared:  0.2312  
-F-statistic:    41 on 3 and 396 DF,  p-value: < 2.2e-16 
- 
- 
- 
- 
-</code> 
  
  
multiple_regression_exercise.1761797583.txt.gz · Last modified: by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki