Hello List, I would like to orthonormalize vectors contained in a matrix X taking into account row weights (matrix diagonal D). ie, I want to obtain Z=XA with t(Z)%*%D%*%Z=diag(1) I can do the Gram-Schmidt orthogonalization with subsequent weighted regressions. I know that in the case of uniform weights, qr can do the trick. I wonder if there is a way to do it in the case of non uniform weights by qr or svd ? Thanks in advances. St?phane DRAY -------------------------------------------------------------------------------------------------- D?partement des Sciences Biologiques Universit? de Montr?al, C.P. 6128, succursale centre-ville Montr?al, Qu?bec H3C 3J7, Canada Tel : 514 343 6111 poste 1233 E-mail : stephane.dray at umontreal.ca -------------------------------------------------------------------------------------------------- Web http://www.steph280.freesurf.fr/
Let QR be such that sqrt(D)X = QR. Then letting solve(...) denote the inverse of ... we have X = solve(sqrt(D))QR which is of the form ZR and Z has the desired weighted orthoginality property. Since D is diagonal, solve(sqrt(D)) equals diag(1/sqrt(diag(D))) so we get this for Z: diag(1/sqrt(diag(D))) %*% qr.Q(qr(X)) --- Date: Mon, 23 Feb 2004 18:46:34 -0500 From: Stephane DRAY <stephane.dray at umontreal.ca> To: <r-help at stat.math.ethz.ch> Subject: [R] orthonormalization with weights Hello List, I would like to orthonormalize vectors contained in a matrix X taking into account row weights (matrix diagonal D). ie, I want to obtain Z=XA with t(Z)%*%D%*%Z=diag(1) I can do the Gram-Schmidt orthogonalization with subsequent weighted regressions. I know that in the case of uniform weights, qr can do the trick. I wonder if there is a way to do it in the case of non uniform weights by qr or svd ? Thanks in advances. Stéphane DRAY -------------------------------------------------------------------------------------------------- Département des Sciences Biologiques Université de Montréal, C.P. 6128, succursale centre-ville Montréal, Québec H3C 3J7, Canada Tel : 514 343 6111 poste 1233 E-mail : stephane.dray at umontreal.ca
Obviously the R code does not match the description I gave since we should be taking the QR decomp of sqrt(D)X, not X. Z should be: diag(1/sqrt(diag(D))) %*% qr.Q(qr(sqrt(D)%*%X)) --- Date: Mon, 23 Feb 2004 21:38:15 -0500 (EST) From: Gabor Grothendieck <ggrothendieck at myway.com> To: <stephane.dray at umontreal.ca>, <r-help at stat.math.ethz.ch> Subject: RE: [R] orthonormalization with weights diag(1/sqrt(diag(D))) %*% qr.Q(qr(X)) Let QR be such that sqrt(D)X = QR. Then letting solve(...) denote the inverse of ... we have X = solve(sqrt(D))QR which is of the form ZR and Z has the desired weighted orthoginality property. Since D is diagonal, solve(sqrt(D)) equals diag(1/sqrt(diag(D))) so we get this for Z: diag(1/sqrt(diag(D))) %*% qr.Q(qr(X)) --- Date: Mon, 23 Feb 2004 18:46:34 -0500 From: Stephane DRAY <stephane.dray at umontreal.ca> To: <r-help at stat.math.ethz.ch> Subject: [R] orthonormalization with weights Hello List, I would like to orthonormalize vectors contained in a matrix X taking into account row weights (matrix diagonal D). ie, I want to obtain Z=XA with t(Z)%*%D%*%Z=diag(1) I can do the Gram-Schmidt orthogonalization with subsequent weighted regressions. I know that in the case of uniform weights, qr can do the trick. I wonder if there is a way to do it in the case of non uniform weights by qr or svd ? Thanks in advances. Stéphane DRAY