Question: How can I plot the eigenvectors in the 3D scatterplot?

I have been using Alex Potapchik & & Alec Mihailovs' procedure for generating a multivariate sample

https://www.mapleprimes.com/questions/37539-Generate-Data-From-A-Multivariate-Normal

How can I plot the eigenvectors in the 3D scatterplot?

``

restart

kernelopts(version); interface(version)

`Maple 2019.2, X86 64 WINDOWS, Nov 26 2019, Build ID 1435526`

 

`Standard Worksheet Interface, Maple 2019.2, Windows 10, November 26 2019 Build ID 1435526`

(1)

with(LinearAlgebra); with(Statistics); with(plots)

MultivariateNormalSample := proc (Sigma, V, N) local d; d := LinearAlgebra:-Dimension(V); LinearAlgebra:-LUDecomposition(Matrix(Sigma, datatype = float[8]), 'method' = 'Cholesky').ArrayTools:-Alias(Statistics:-Sample(Normal(0, 1), d*N), [d, N])+ArrayTools:-Replicate(Vector[column](V, datatype = float[8]), 1, N) end proc

Cov := Matrix([[4, 2.5, .4], [2.5, 2, .2], [.4, .2, .5]])

Cor := simplify(MatrixPower(DiagonalMatrix(Diagonal(Cov)), -1/2).Cov.MatrixPower(DiagonalMatrix(Diagonal(Cov)), -1/2))

S := MultivariateNormalSample(Cov, `<,>`(0, 0, 0), 1000); Statistics:-CovarianceMatrix(S^%T); map(Statistics:-Mean, [S[1], S[2]])

Determinant(Cov)

.795

(2)

Z := Scale(S^%T)

E, V := Eigenvectors(Cor)

E := Re(E); V := Re(V)

Vector(3, {(1) = 2.0005950859349144, (2) = .11194337607751015, (3) = .8874615374875758})

 

Matrix(%id = 18446746188592589870)

(3)

plots:-pointplot3d(Z, axes = normal, thickness = 1, symbol = circle, axis[1] = [color = black], axis[2] = [color = blue], axis[3] = [color = green], color = "DarkRed", orientation = [30, 75], viewpoint = "circleright", symbolsize = 1)

 

NULL

 

Download Plot_eigenvectors_in_3d_scatterplot.mw

Please Wait...