User Tools

Site Tools


c:ma:2019:eg_script

Differences

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

Link to this comparison view

c:ma:2019:eg_script [2021/11/09 12:58] – created hkimscilc:ma:2019:eg_script [2021/11/09 13:00] (current) hkimscil
Line 6: Line 6:
 summary(m.Sales.PriceShelveLoc) summary(m.Sales.PriceShelveLoc)
  
-plot(Price[ShelveLoc=="Bad"], Sales[ShelveLoc=="Bad"], col="blue", xlab="Price", ylab="Sales", main="Sales vs. Price, Shlv Loc")+plot(Price[ShelveLoc=="Bad"], Sales[ShelveLoc=="Bad"],  
 +     col="blue", xlab="Price", ylab="Sales",  
 +     main="Sales vs. Price, Shlv Loc")
 points(Price[ShelveLoc=="Medium"], Sales[ShelveLoc=="Medium"], col="red") points(Price[ShelveLoc=="Medium"], Sales[ShelveLoc=="Medium"], col="red")
 points(Price[ShelveLoc=="Good"], Sales[ShelveLoc=="Good"], col="green") points(Price[ShelveLoc=="Good"], Sales[ShelveLoc=="Good"], col="green")
-legend("topright", legend=c("Good", "Medium", "Bad"), col=c("green", "red", "blue"), pch=c(1,16), bty="n")+legend("topright", legend=c("Good", "Medium", "Bad"),  
 +       col=c("green", "red", "blue"), pch=c(1,16), bty="n")
  
 abline(a = 16.89765, b=-0.056698, col = "green", lwd=3) abline(a = 16.89765, b=-0.056698, col = "green", lwd=3)
 abline(a = 13.86382, b=-0.056698, col = "red", lwd=3) abline(a = 13.86382, b=-0.056698, col = "red", lwd=3)
 abline(a = 11.832984, b=-0.056698, col = "blue", lwd=3) abline(a = 11.832984, b=-0.056698, col = "blue", lwd=3)
 +</code>
  
 +독립변인 간의 상호작용효과 보기
 +<code>
 m.Sales.PriceShelveLoc.ia <- lm(Sales ~ Price + ShelveLoc + Price:ShelveLoc, data=Carseats) m.Sales.PriceShelveLoc.ia <- lm(Sales ~ Price + ShelveLoc + Price:ShelveLoc, data=Carseats)
 summary(m.Sales.PriceShelveLoc.ia) summary(m.Sales.PriceShelveLoc.ia)
  
-plot(Price[ShelveLoc=="Bad"], Sales[ShelveLoc=="Bad"], col="blue", xlab="Price", ylab="Sales", main="Sales vs. Price, Shlv Loc")+plot(Price[ShelveLoc=="Bad"], Sales[ShelveLoc=="Bad"],  
 +     col="blue", xlab="Price", ylab="Sales",  
 +     main="Sales vs. Price, Shlv Loc")
 points(Price[ShelveLoc=="Medium"], Sales[ShelveLoc=="Medium"], col="red") points(Price[ShelveLoc=="Medium"], Sales[ShelveLoc=="Medium"], col="red")
 points(Price[ShelveLoc=="Good"], Sales[ShelveLoc=="Good"], col="green") points(Price[ShelveLoc=="Good"], Sales[ShelveLoc=="Good"], col="green")
-legend("topright", legend=c("Good", "Medium", "Bad"), col=c("green", "red", "blue"), pch=c(1,16), bty="n")+legend("topright", legend=c("Good", "Medium", "Bad"),  
 +       col=c("green", "red", "blue"), pch=c(1,16), bty="n")
  
  
Line 28: Line 37:
 bad <- 11.832984 bad <- 11.832984
  
-p.good <- -0.055220 -0.010564+p.good <- -0.055220 -0.010564
 p.medium <- -0.055220 + 0.001984 p.medium <- -0.055220 + 0.001984
 p.bad <- -0.055220 p.bad <- -0.055220
Line 37: Line 46:
  
 </code> </code>
 +
c/ma/2019/eg_script.1636430310.txt.gz · Last modified: 2021/11/09 12:58 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki