Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Linear algebra with R programming Hi, can you please teach me r codes of Householder decomposition? Thank you. 3. The idea of householder transformation can

Linear algebra with R programming

image text in transcribed

image text in transcribed

Hi, can you please teach me r codes of Householder decomposition?

Thank you.

3. The idea of householder transformation can be used to generate n x n random orthogonal matrix. The textbook problem 3.12 (page 120) describe the following algorithm for this purpose. Step 1: Generate n-1 independent i-vectors, 22, 23,...,xn from N (0,1), where x; is of length i and I is the i-dimensional identity matrix. Step 2: Let ri = || 2:||2, and let # be the i x i reflection matrix that transforms t; into the i-vector (r.,0,0,...,0). Step 3: Let H be the nxn matrix = 1 ("** A) and form the diagonal matrix, J = diag ((-1),(-1)...,(-1)), where the b; are independent realizations of a Bernoulli random variable. Step 4: Deliver the Q = JH H... Hm. Implement the above algorithm in R. Name your function simOrth1(). Your function should take one argument, n, the dimension of the orthogonal matrix. Use your implementation to check if Q is orthogonal with different random seeds and n. 4. 5. Repeat #3 with the multivariate normal replaced by i.i.d. uniform random variables over [-m, m). Name your function simOrth2() for this approach. The function simorth2() should take one argument, n and m, the dimension of the orthogonal matrix and the upper/lower bound of the uniform, respectively. Use your implementation to check if the resultant Q is orthogonal. Repeat #3 with the I. in multivariate normal replaced by an exchangeable covariance matrix. Name your function simOrth3() for this approach. The function simOrth3() should take two arguments, n and p for the dimension of the orthogonal matrix and the covariance of the exchangeable covariance matrix (diagonal 1), respectively. Use your implementation to check if the resultant Q is orthogonal. You may choose to generate random vector from MASS::mvrnorm(). 3. The idea of householder transformation can be used to generate n x n random orthogonal matrix. The textbook problem 3.12 (page 120) describe the following algorithm for this purpose. Step 1: Generate n-1 independent i-vectors, 22, 23,...,xn from N (0,1), where x; is of length i and I is the i-dimensional identity matrix. Step 2: Let ri = || 2:||2, and let # be the i x i reflection matrix that transforms t; into the i-vector (r.,0,0,...,0). Step 3: Let H be the nxn matrix = 1 ("** A) and form the diagonal matrix, J = diag ((-1),(-1)...,(-1)), where the b; are independent realizations of a Bernoulli random variable. Step 4: Deliver the Q = JH H... Hm. Implement the above algorithm in R. Name your function simOrth1(). Your function should take one argument, n, the dimension of the orthogonal matrix. Use your implementation to check if Q is orthogonal with different random seeds and n. 4. 5. Repeat #3 with the multivariate normal replaced by i.i.d. uniform random variables over [-m, m). Name your function simOrth2() for this approach. The function simorth2() should take one argument, n and m, the dimension of the orthogonal matrix and the upper/lower bound of the uniform, respectively. Use your implementation to check if the resultant Q is orthogonal. Repeat #3 with the I. in multivariate normal replaced by an exchangeable covariance matrix. Name your function simOrth3() for this approach. The function simOrth3() should take two arguments, n and p for the dimension of the orthogonal matrix and the covariance of the exchangeable covariance matrix (diagonal 1), respectively. Use your implementation to check if the resultant Q is orthogonal. You may choose to generate random vector from MASS::mvrnorm()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting Advanced

Authors: Claudia Bienias Gilbertson

9th Edition

0538447559, 9780538447553

More Books

Students also viewed these Accounting questions