The Stock Market Data

Logistic Regression

## Call:
## lda(Direction ~ Lag1 + Lag2, data = Smarket, subset = train)
## 
## Prior probabilities of groups:
##     Down       Up 
## 0.491984 0.508016 
## 
## Group means:
##             Lag1        Lag2
## Down  0.04279022  0.03389409
## Up   -0.03954635 -0.03132544
## 
## Coefficients of linear discriminants:
##             LD1
## Lag1 -0.6420190
## Lag2 -0.5135293

## [1] "class"     "posterior" "x"
##          Direction.2005
## lda.class Down  Up
##      Down   35  35
##      Up     76 106
## [1] 0.5595238
## [1] 70
## [1] 182
##       999      1000      1001      1002      1003      1004      1005      1006 
## 0.4901792 0.4792185 0.4668185 0.4740011 0.4927877 0.4938562 0.4951016 0.4872861 
##      1007      1008      1009      1010      1011      1012      1013      1014 
## 0.4907013 0.4844026 0.4906963 0.5119988 0.4895152 0.4706761 0.4744593 0.4799583 
##      1015      1016      1017      1018 
## 0.4935775 0.5030894 0.4978806 0.4886331
##  [1] Up   Up   Up   Up   Up   Up   Up   Up   Up   Up   Up   Down Up   Up   Up  
## [16] Up   Up   Down Up   Up  
## Levels: Down Up
## [1] 0
## Call:
## qda(Direction ~ Lag1 + Lag2, data = Smarket, subset = train)
## 
## Prior probabilities of groups:
##     Down       Up 
## 0.491984 0.508016 
## 
## Group means:
##             Lag1        Lag2
## Down  0.04279022  0.03389409
## Up   -0.03954635 -0.03132544
##          Direction.2005
## qda.class Down  Up
##      Down   30  20
##      Up     81 121
## [1] 0.5992063
## 
## Naive Bayes Classifier for Discrete Predictors
## 
## Call:
## naiveBayes.default(x = X, y = Y, laplace = laplace)
## 
## A-priori probabilities:
## Y
##     Down       Up 
## 0.491984 0.508016 
## 
## Conditional probabilities:
##       Lag1
## Y             [,1]     [,2]
##   Down  0.04279022 1.227446
##   Up   -0.03954635 1.231668
## 
##       Lag2
## Y             [,1]     [,2]
##   Down  0.03389409 1.239191
##   Up   -0.03132544 1.220765
## [1] 0.04279022
## [1] 1.227446
##         Direction.2005
## nb.class Down  Up
##     Down   28  20
##     Up     83 121
## [1] 0.5912698
##           Down        Up
## [1,] 0.4873164 0.5126836
## [2,] 0.4762492 0.5237508
## [3,] 0.4653377 0.5346623
## [4,] 0.4748652 0.5251348
## [5,] 0.4901890 0.5098110
##         Direction.2005
## knn.pred Down Up
##     Down   43 58
##     Up     68 83
## [1] 0.5
##         Direction.2005
## knn.pred Down Up
##     Down   48 54
##     Up     63 87
## [1] 0.5357143
## [1] 5822   86
##   No  Yes 
## 5474  348
## [1] 0.05977327
## [1] 165.0378
## [1] 0.1647078
## [1] 1
## [1] 1
## [1] 0.118
## [1] 0.059
##         test.Y
## knn.pred  No Yes
##      No  873  50
##      Yes  68   9
## [1] 0.1168831
##         test.Y
## knn.pred  No Yes
##      No  920  54
##      Yes  21   5
## [1] 0.1923077
##         test.Y
## knn.pred  No Yes
##      No  930  55
##      Yes  11   4
## [1] 0.2666667
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##         test.Y
## glm.pred  No Yes
##      No  934  59
##      Yes   7   0
##         test.Y
## glm.pred  No Yes
##      No  919  48
##      Yes  22  11
## [1] 0.3333333