[R] Generate a matrix Q satisfying t(Q)%*%Q=Z and XQ=W

Stephane DRAY stephane.dray at umontreal.ca
Wed Jul 7 20:32:51 CEST 2004


thanks,
I want to create matrices for simulation purpose (in order to evaluate the 
efficiency of different methods on this simulated data set). So, I want to 
create a data matrix Q (m individuals and r variables). I want to specify 
the variance-covariance structure for this matrix (t(Q)%*%Q=Z ) but I want 
also to create another constraint due to another matrix of data. I want 
that the covariance of Q and X are equal to those given in W (XQ=W).
The example I gave is just to illustrate my problem and perhaps it has no 
solution (I cannot see it because I have no idea how to construct Q such as 
Q=Q1=Q2)




At 00:00 07/07/2004, Spencer Graves wrote:
>      Is a solution even possible for the matrices in your example?
>I've tried a few things that have suggested that a solution may not be 
>possible.
>      What can you tell us of the problem that you've translated into 
> this?  I see a minimization problem subject to constraints, but I'm not 
> certain which are the constraints and what is the objective function.
>For example, are you trying to find Q to minimize sum((Z-X'X)^2) subject 
>to XQ=W or do you want to minimize sum((XQ-W)^2) subject to Q'Q=Z or 
>something else?
>      If it were my problem, I think I would work for a while with the 
> singular value decompositions of X, W and Z, and see if that would lead 
> me to more information about Q, including conditions under which a 
> solution existed, expressions for Q when multiple solutions existed, and 
> a solution minimizing your chosen objective function when solutions do 
> not exist.  (A google search produced many hits for "singular value 
> decomposition", implemented as "svd" in R.)
>      hope this helps.  spencer graves
>
>Stephane DRAY wrote:
>
>>Hello,
>>I have a question that is not directly related to R ... but I try to do 
>>it in R ;-) :
>>
>>I would like to generate a matrix Q satisfying (for a given Z, X and W) 
>>the two following conditions:
>>
>>t(Q)%*%Q=Z  (1)
>>XQ=W (2)
>>
>>where:
>>Q is m rows and r columns
>>X is p rows and m columns
>>D is p rows and r columns
>>C is r rows and r columns
>>with m>p,r
>>
>>
>>e.g:
>>m=6,
>>p=2
>>r=3
>>
>>Z=matrix(c(1,.2,.5,.2,1,.45,.5,.45,1),3,3)
>>X=matrix(c(.1,.3,.5,.6,.2,.1,.8,1,.4,.2,.2,.9),2,6)
>>W=matrix(c(0,.8,.4,.6,.2,0),2,3)
>>
>>#Create a matrix satisfying (1) is easy:
>>
>>A=matrix(runif(18),6,3)
>>Q1=svd(A)$u%*%chol(Z)
>>
>>
>>#For the second condition (2), a solution is given by
>>
>>Q2=A%*%ginv(X%*%A)%*%W
>>
>>
>>
>>
>>
>>I do not know how to create a matrix Q that satisfies the two 
>>conditions.  I have try to construct an iterative procedure without 
>>success (no convergence):
>>
>>eps=10
>>i=0
>>while(eps>.5)
>>{
>>Q1=svd(Q2)$u%*%chol(Z)
>>Q2=Q1%*%ginv(X%*%Q1)%*%W
>>eps=sum(abs(Q1-Q2))
>>cat(i,":",eps,"\n")
>>i=i+1
>>}
>>
>>Perhaps someone could have any idea to solve the problem, or a reference 
>>on this kind of question or the email of another list where I should ask 
>>this question.
>>
>>Thanks in advance,
>>
>>Sincerely.
>>
>>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/
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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/




More information about the R-help mailing list