Harry Garst

259 Reputation

6 Badges

19 years, 19 days

MaplePrimes Activity


These are questions asked by Harry Garst

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

I had expected that applying the power rule for exponents would lead to an answer of zero. Maple refuses to give the desired answer, but using a procedure it works as expected.

Did I miss something?
 

``

restart

kernelopts(version)

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

(1)

interface(version)

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

(2)

simplify(exp(k*(ln(t)+ln(a)))-(exp(ln(t)+ln(a)))^k, symbolic)

exp(k*(ln(t)+ln(a)))-t^k*a^k

(3)

W := proc (m, n) local r; r := simplify(exp(m*n)-(exp(m))^n, symbolic); return r end proc

W(n, k)

0

(4)

subs(n = ln(t)+ln(a), W(n, k))

0

(5)

V := proc (m, n) local r; r := simplify((exp(m))^n, symbolic); return r end proc

V(n, k)

exp(k*n)

(6)

V(ln(t)+ln(a), k)

t^k*a^k

(7)

``


 

Download mapleprimes.mw

 

Did someone already made a Pointplot3d for a Principal Components Analysis with projections for some data points on the eigenvectors?

I like this example very much:

http://www.joyofdata.de/public/pca-3d/

but I want to add projections on the three eigenvectors for some data points. I think it has to do something with the dot product, but I do not know how to do it in Maple. 

Hopefully someone already did this and is willing to share it.

kind regards,

Harry

 

For a statistical course I will give next year, I would like to demonstrate the calculation of tetrachoric and polychoric correlations. Furthermore, it would be nice to show the students how the expectation-maximization algorithm works.

Has anyone already programmed this in Maple?

best regards,

Harry

 

This works fine, but I was wondering whether it could be done in a simple way.
 

``

restart; kernelopts(version); interface(version)

`Maple 2018.2, X86 64 WINDOWS, Nov 16 2018, Build ID 1362973`

 

`Standard Worksheet Interface, Maple 2018.2, Windows 10, November 16 2018 Build ID 1362973`

(1)

kollect := proc (p::`+`, y) local x; subs(x = y, collect(subs(y = x, p), x)) end proc

kollect(kollect(kollect(kollect(expand(add(mul(k)*add(k), `in`(k, combinat:-choose([i1, i2, i3, i4], 3)))), i1^2), i2^2), i3^2), i4^2)

(i1*i2+i1*i3+i2*i3)*i4^2+(i1*i2+i1*i4+i2*i4)*i3^2+(i1*i3+i1*i4+i3*i4)*i2^2+(i2*i3+i2*i4+i3*i4)*i1^2

(2)

``


thanks in advance,

Harry

Download nested_comb.mw

1 2 3 4 5 6 7 Page 3 of 10