-
-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
I believe the code shown here (link to manual section):
is the Stan code matching the inverse sum-to-zero transform in the next section. Stan code implementing the sum-to-zero transform is here:
vector sum_to_zero_transform(vector x) {
int N = size(x) - 1;
vector[N] y;
y[N] = -x[N+1] * sqrt(1 + 1. / N);
real sum_w = 0;
for (n in 1:(N-1)) {
int i = N - n;
int i_p_1 = i + 1;
real w = y[i_p_1] * inv_sqrt(i_p_1 * (i_p_1 + 1));
sum_w += w;
y[i] = (sum_w - x[i_p_1]) * sqrt(i_p_1 * i) / i;
}
return(y);
}
Metadata
Metadata
Assignees
Labels
No labels