I would like to generate a vector $\vec{u}$ of dimension $n$, so that i) it has a given correlation $r$ with a second vector $\vec{v}$ and ii) it is orthogonal to a set of $m$ vectors $A = \{\vec{w}_1, \vec{w}_2, \dots, \vec{w}_k\}$. I would like to do it in R. Any idea?

thanks a lot!

PS: Solving $A \times x = 0$ would fix ii). Also, satisfiying i) is relatively straightforward. However I have not been able to find a way to to ensure both i) and ii).

  • $\begingroup$ Do you have any reason to believe that such a vector $\vec{u}$ can be guaranteed to exist? For example, if the given $\vec{v}$ happens to be in the span of $A$, then its correlation (I assume that you mean inner product) with any $\vec{u}$ is necessarily $0$. It is also difficult to see why this should not be a question of mathematics and only tangentially on topic in stats.SE. $\endgroup$ Mar 25, 2019 at 14:51
  • $\begingroup$ @Dilip Because regression ideas are helpful in thinking about and solving this question, I think it is on topic here. User242367: what is the relationship between "$m$" and "$k$" in your question? $\endgroup$
    – whuber
    Mar 25, 2019 at 18:05


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.