[R] LDA: normalization of eigenvectors (see SPSS)
Spencer Graves
spencer.graves at pdf.com
Sun Jun 8 15:40:35 CEST 2003
The following satisfies some of your constraints but I don't know if
it satisfies all of them.
Let V = eigenvectors normalized so t(V) %*% V = I. Also, let D.5 =
some square root matrix, so t(D.5) %*% D.5 = Derror, and Dm.5 =
solve(D.5) = invers of D.5. The Choleski decomposition ("chol")
provides one such solution, but you can construct a symmetric square
root using "eigen". Then Vstar = Dm.5%*%V will have the property you
mentioned below.
Consider the following:
> (Derror <- array(c(1,1,1,4), dim=c(2,2)))
[,1] [,2]
[1,] 1 1
[2,] 1 4
> D.5 <- chol(Derror)
> t(D.5) %*% D.5
[,1] [,2]
[1,] 1 1
[2,] 1 4
> (Dm.5 <- solve(D.5))
[,1] [,2]
[1,] 1 -0.5773503
[2,] 0 0.5773503
> (t(Dm.5) %*% Derror %*% Dm.5)
[,1] [,2]
[1,] 1 0
[2,] 0 1
Thus,t(Vstar)%*%Derror%*%Vstar = t(V)%*%t(Dm.5)%*%Derror%*%Dm.5%*%V
= t(V)%*%V = I.
hope this helps. spencer graves
Christoph Lehmann wrote:
> Hi dear R-users
>
> I try to reproduce the steps included in a LDA. Concerning the eigenvectors there is
> a difference to SPSS. In my textbook (Bortz)
> it says, that the matrix with the eigenvectors
>
> V
>
> usually are not normalized to the length of 1, but in the way that the
> following holds (SPSS does the same thing):
>
> t(Vstar)%*%Derror%*%Vstar = I
>
>
> where Vstar are the normalized eigenvectors. Derror is an "error" or
> "within" squaresum- and crossproduct matrix (squaresum of the p
> variables on the diagonale, and the non-diagonal elements are the sum of
> the crossproducts). For Derror the following holds: Dtotal = Dtreat +
> Derror.
>
> Since I assume that many of you are familiar with this transformation:
> can anybody of you tell me, how to conduct this transformation in R?
> Would be very nice. Thanks a lot
>
> Cheers
>
> Christoph
>
More information about the R-help
mailing list