Orthogonal vector expression

Hi, Stanimals,

I just thought a small question and I look for your ideas.

In Stan, the contained parameters, for example, if \sum_{i=1}^{p}c_i = 1, we may use simplex to define the vector c like

simplex[p] c;

After that, if I want to define another parameter vector \alpha such that c^T \alpha=0, is there any good suggestion to define such a constrained parameter?

Many thanks!!

1 Like

This looks like a sum-to-zero constraint in disguise. Say the first p - 1 components of \alpha are unconstrained, then the p^{\text{th}} component of is

\alpha_{p} = -\frac{\sum_{i = 1}^{p - 1}c_{i}\alpha_{i}}{c_{p}}.
1 Like

Many thanks! Your suggestion is quite useful!