Functions for linear discriminant analysis between two groups of observations for a set of variables.
Usage
lda2(X1,X2)
Arguments
X1
Group 1 data matrix
X2
Group 2 data matrix
Value
m.n1.n2m.n1.n2
G1sample mean of X1
G2sample mean of X2
S1covariance matrix of X1
S2covariance matrix of X2
Sppooled variance matrix
Spinvinverse of pooled variance matrix
Amatrix of coefficients
Z1c.Z2cscores of centroids for group 1 and group 2
D2.F.p.valueMahalanobis distance, F statistic, and p-value
Z1sscores for individual observations of group 1
Z2sscores for individual observations of group 2
Details
The centroid scores Z1c, Z2c and individual scores Z1s, Z2s have been centered on Z0, which is the midpoint or average of the centroids.
Null hypothesis is that there are not significant differences between the two groups.
Using the individual scores and the centroid scores, the function also produces a plot, which displays the difference between the groups in two different manners. The one at the top panel uses markers and the two below use histograms. It indicates whther tere is overlap in observations along the score axis and potential differences between the centroids.
References
Acevedo M.F. 2013. "Data Analysis and Statistics for Geography, Environmental Science, and Engineering", CRC Press.