2
$\begingroup$

I am doing the lab section: classifying the stock data using LDA in the book "Introduction to Statistical Learning with Applications in R", here is the lab video. Basically, this lab uses LDA to predict the stock Up or Down from Lag1 and Lag2 as following,

 lda.fit = lda(Direction~Lag1+Lag2, data=Smarket, subset=Year<2005)

The coefficients are

Coefficients of linear discriminants:
        LD1
Lag1 -0.6420190
Lag2 -0.5135293

And following the lab steps, plot the LDA fit,

plot(lda.fit)

the plot is like below enter image description here

I am having difficulties interpreting the plots. In the book it says that The plot() function produces plots of the linear discriminants, obtained by computing −0.642 × Lag1 − 0.514 × Lag2 for each of the training observations. I don't understand what this sentence exactly is meaning here,

  1. What's the x and y axis of this plot? And what does the axis mean here?
  2. Why the plot is a bar plot?
  3. How the computing −0.642 × Lag1 − 0.514 × Lag2 is related to the x and y axis?
$\endgroup$
3
  • $\begingroup$ Please add the [self-study] tag & read its wiki. (You will have to delete a tag, [discriminant] is probably the best choice.) $\endgroup$ Commented Jun 14, 2015 at 20:31
  • $\begingroup$ Although the context is R, these questions seem on topic to me. $\endgroup$ Commented Jun 14, 2015 at 20:32
  • $\begingroup$ Do you have any idea about plotting this lda.fit in Python? $\endgroup$ Commented Feb 22, 2022 at 14:03

1 Answer 1

3
$\begingroup$

The horizontal axis is the linear combination of Lag1 and Lag2. This is the linear combination where the two groups (Up, Down) are most different. What you can see from this plot is that both groups are centered on 0, and have similar spread, which means there is nothing that distinguishes these two groups. You didn't compute the prediction error. If you did, I am guessing it will be close to 50%, which indicates that you cannot distinguish between the groups.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.