Given data as follows.

#Read or open data "data.csv" in R
data1=read.csv("data.csv")
 
#Present the data
data1
##    Group Hour Motivation
## 1      A    4         30
## 2      A    5         25
## 3      A    4         20
## 4      A    4         40
## 5      A    3         20
## 6      A    4         30
## 7      A    3         40
## 8      A    4         20
## 9      A    5         30
## 10     A    6         40
## 11     A    4         50
## 12     A    5         60
## 13     A    6         40
## 14     A    7         50
## 15     A    4         50
## 16     A    9         30
## 17     A    8         20
## 18     A    4         40
## 19     A    3         80
## 20     A    3         30
## 21     A    4         70
## 22     A    3         50
## 23     A    5         60
## 24     A    6         70
## 25     A    4         50
## 26     A    3         50
## 27     A    9         30
## 28     A    4         80
## 29     A    3         40
## 30     A    2         90
## 31     B    7         60
## 32     B    7         60
## 33     B    8         60
## 34     B    9         70
## 35     B    9         70
## 36     B    7         70
## 37     B    6         70
## 38     B    7         70
## 39     B    8         70
## 40     B    9         70
## 41     B    2         80
## 42     B    3         80
## 43     B    3         80
## 44     B    3         80
## 45     B    2         80
## 46     B    7         75
## 47     B    8         75
## 48     B    9         75
## 49     B    9         40
## 50     B    9         70
## 51     B    9         70
## 52     B    9         60
## 53     B    8         70
## 54     B    8         70
## 55     B    2         70
## 56     B    3         80
## 57     B    3         80
## 58     B    9         60
## 59     B    9         60
## 60     B    8         75
## 61     C   13         90
## 62     C   13         99
## 63     C   14         99
## 64     C   15         99
## 65     C   14         98
## 66     C   14         99
## 67     C   15         99
## 68     C   15         99
## 69     C   15         98
## 70     C   15         95
## 71     C   16         93
## 72     C   16         97
## 73     C   16         98
## 74     C   16         98
## 75     C   14         98
## 76     C   16         98
## 77     C   14         99
## 78     C   15         92
## 79     C   15         95
## 80     C   15         97
## 81     C    6         70
## 82     C    7         70
## 83     C    6         71
## 84     C    8         99
## 85     C    8         92
## 86     C    7         91
## 87     C   15         89
## 88     C   14         89
## 89     C   15         75
## 90     C   16         79

Based on data above, Hour and Motivation are metric independent variables, whereas Group is non-metric (category) dependent variable. Based on data above, LDA will be used to make equation of classification, and use data Hour and Motivation above, to predict membership.

Next, plot the data above.

library(ggplot2) #Load package ggplot2 to use function qplot 
qplot(Hour, Motivation, data=data1, color = Group)

#Plot data
plot( data1[ , c(2,3)], col=data1[ ,1 ])

Perform LDA in R.

#Perform LDA
library(MASS) #Load package 'MASS'
fit.LDA = lda( Group ~ Hour + Motivation, data1)
fit.LDA
## Call:
## lda(Group ~ Hour + Motivation, data = data1)
## 
## Prior probabilities of groups:
##         A         B         C 
## 0.3333333 0.3333333 0.3333333 
## 
## Group means:
##        Hour Motivation
## A  4.600000   44.50000
## B  6.666667   70.00000
## C 13.266667   92.16667
## 
## Coefficients of linear discriminants:
##                   LD1         LD2
## Hour       0.27124507  0.26486626
## Motivation 0.05558374 -0.05015543
## 
## Proportion of trace:
##    LD1    LD2 
## 0.9757 0.0243

The result below based on SPSS.

Note that the result LDA above based on R and SPSS are same. Next perform classification.

#Perform classification
data.LDA.C = predict(fit.LDA, newdata=data1[,c(2,3)])$class
data.LDA.C
##  [1] A A A A A A A A A A A B A A A A A A B A B A B B A A A B A B B B B B B
## [36] B B B B B B B B B B B B B A B B B B B B B B B B B C C C C C C C C C C
## [71] C C C C C C C C C C B B B C B B C C C C
## Levels: A B C
#Determine misclassification
table(data1[,1],data.LDA.C)
##    data.LDA.C
##      A  B  C
##   A 23  7  0
##   B  1 29  0
##   C  0  5 25

The classification table below based on LDA using SPSS.