Let (mathbf{X}) be an (n times p) model matrix and let (boldsymbol{u} in mathbb{R}^{p}) be the unit-length

Question:

Let \(\mathbf{X}\) be an \(n \times p\) model matrix and let \(\boldsymbol{u} \in \mathbb{R}^{p}\) be the unit-length vector with \(k\)-th entry equal to one \(\left(u_{k}=\|\boldsymbol{u}\|=1\right)\). Suppose that the \(k\)-th column of \(\mathbf{X}\) is \(\boldsymbol{v}\) and that it is replaced with a new predictor \(w\), so that we obtain the new model matrix:

\[ \widetilde{\mathbf{X}}=\mathbf{X}+(\boldsymbol{w}-\boldsymbol{v}) \boldsymbol{u}^{\top} \]

(a) Denoting

\[ \boldsymbol{\delta}:=\mathbf{X}^{\top}(\boldsymbol{w}-\boldsymbol{v})+\frac{\|\boldsymbol{w}-\boldsymbol{v}\|^{2}}{2} \boldsymbol{u} \]

show that

\[ \widetilde{\mathbf{X}}^{\top} \widetilde{\mathbf{X}}=\mathbf{X}^{\top} \mathbf{X}+\boldsymbol{u} \boldsymbol{\delta}^{\top}+\boldsymbol{\delta} \boldsymbol{u}^{\top}=\mathbf{X}^{\top} \mathbf{X}+\frac{(\boldsymbol{u}+\boldsymbol{\delta})(\boldsymbol{u}+\boldsymbol{\delta})^{\top}}{2}-\frac{(\boldsymbol{u}-\boldsymbol{\delta})(\boldsymbol{u}-\boldsymbol{\delta})^{\top}}{2} \]

In other words, \(\widetilde{\mathbf{X}}^{\top} \widetilde{\mathbf{X}}\) differs from \(\mathbf{X}^{\top} \mathbf{X}\) by a symmetric matrix of rank two.

(b) Suppose that \(\mathbf{B}:=\left(\mathbf{X}^{\top} \mathbf{X}+n \gamma \mathbf{I}_{p}\right)^{-1}\) is already computed. Explain how the ShermanMorrison formulas in Theorem A. 10 can be applied twice to compute the inverse and log-determinant of the matrix \(\widetilde{\mathbf{X}}^{\top} \widetilde{\mathbf{X}}+n \gamma \mathbf{I}_{p}\) in \(O((n+p) p)\) computing time, rather than the usual \(O\left(\left(n+p^{2}\right) p\right)\) computing time. \({ }^{3}\)

(c) Write a Python program for updating a matrix \(\mathbf{B}=\left(\mathbf{X}^{\top} \mathbf{X}+n y \mathbf{I}_{p}\right)^{-1}\) when we change the \(k\)-th column of \(\mathbf{X}\), as shown in the following pseudo-code.

image text in transcribed

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Data Science And Machine Learning Mathematical And Statistical Methods

ISBN: 9781118710852

1st Edition

Authors: Dirk P. Kroese, Thomas Taimre, Radislav Vaisman, Zdravko Botev

Question Posted: