Let mu = [10 1 50] and sigma = [50 -10 20 -10 5 1 20 1 100]. Use R to carry out
ID: 3205094 • Letter: L
Question
Let mu = [10 1 50] and sigma = [50 -10 20 -10 5 1 20 1 100]. Use R to carry out parts a - h. Define a matrix P with columns containing the eigenvectors of sigma. Display P. Show that P is an orthogonal matrix. Find the covariance matrix of Y, sigma_y, where Y = P'X and X' = [X_1/X_2/X_3]'. Comment on sigma_y. Compute trace(S) and trace(S_y). Comment. Attempt to generalize the results in parts c. and d. Generate a sample of size 10 from a multivariate normal distribution with mu and sigma. Calculate X and S for your sample. Compare these with their population values. Repeat part f. and g. for a sample size of 1000.Explanation / Answer
a) By using R programme ,
> m1<-matrix(c(50,-10,20,-10,5,1,20,1,100),ncol=3,byrow=T)
> m1
[,1] [,2] [,3]
[1,] 50 -10 20
[2,] -10 5 1
[3,] 20 1 100
> eigen(m1)$vectors
[,1] [,2] [,3]
[1,] 0.33429588 0.9142275 0.22898553
[2,] -0.02352066 -0.2347952 0.97176027
[3,] 0.94217464 -0.3302413 -0.05698782
> eigen(m1)$values
[1] 107.071297 45.343746 2.584957
> p<-eigen(m1)$vectors
> p
[,1] [,2] [,3]
[1,] 0.33429588 0.9142275 0.22898553
[2,] -0.02352066 -0.2347952 0.97176027
[3,] 0.94217464 -0.3302413 -0.05698782
b) If pis an orthogonal matrix then p*pT= I
> t(p)
[,1] [,2] [,3]
[1,] 0.3342959 -0.02352066 0.94217464
[2,] 0.9142275 -0.23479516 -0.33024134
[3,] 0.2289855 0.97176027 -0.05698782
> p%*%t(p)
[,1] [,2] [,3]
[1,] 1.000000e+00 -1.158606e-16 1.150525e-17
[2,] -1.158606e-16 1.000000e+00 1.618138e-16
[3,] 1.150525e-17 1.618138e-16 1.000000e+00
p*pT is a identity matrix. Hence p is an orthogonal matrix.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.