477
477
For the transform, Stan uses the first part of an isometric log ratio
478
478
transform; see [ @egozcue +etal:2003] for the basic definitions and
479
479
Chapter 3 of [ @filzmoser +etal:2018] for the pivot coordinate version
480
- used here. Stan uses the isometric log ratio transform because it
480
+ used here. Stan uses the isometric log ratio transform because it
481
481
results in equal variances of the the constrained sum to zero
482
482
vector see, e.g.,[ @seyboldt :2024] . Simpler alternatives, such as setting the
483
483
final element to the negative sum of the first elements, do not result in
484
- equal variances. The $N - 1$ unconstrained parameters are independent, however,
485
- the sum-to-zero constraint induces a negative correlation across the
484
+ equal variances. The $N - 1$ unconstrained parameters are independent, however,
485
+ the sum-to-zero constraint induces a negative correlation across the
486
486
constrained vector values.
487
487
488
488
### Zero sum transform {-}
@@ -520,7 +520,7 @@ It maps an unconstrained vector $y \in \mathbb{R}^N$ to a zero-sum vector $x \in
520
520
$$
521
521
\sum_{n=1}^{N + 1} x_n = 0.
522
522
$$
523
- The values are defined inductively, starting with
523
+ The values are defined inductively, starting with
524
524
$$
525
525
x_1 = \sum_{n=1}^N \frac{y_n}{\sqrt{n \cdot (n + 1)}}
526
526
$$
536
536
\sum_{n = 1}^{N + 1} x_n = 0
537
537
$$
538
538
by construction, because each of the terms added to $x_ {n}$ is then
539
- subtracted from $x_ {n + 1}$ the number of times it shows up in earlier terms.
539
+ subtracted from $x_ {n + 1}$ the number of times it shows up in earlier terms.
540
540
541
541
### Absolute Jacobian determinant of the zero sum inverse transform {-}
542
542
757
757
## Stochastic Matrix {#stochastic-matrix-transform.section}
758
758
759
759
The ` column_stochastic_matrix[N, M] ` and ` row_stochastic_matrix[N, M] ` type in
760
- Stan represents an \( N \times M\) matrix where each column (row) is a unit simplex
761
- of dimension \( N \) . In other words, each column (row) of the matrix is a vector
760
+ Stan represents an $ N \times M$ matrix where each column (row) is a unit simplex
761
+ of dimension $N$ . In other words, each column (row) of the matrix is a vector
762
762
constrained to have non-negative entries that sum to one.
763
763
764
764
### Definition of a Stochastic Matrix {-}
765
765
766
- A column stochastic matrix \( X \in \mathbb{R}^{N \times M}\) is defined such
767
- that each column is a simplex. For column \( m \) (where \( 1 \leq m \leq M\) ):
766
+ A column stochastic matrix $ X \in \mathbb{R}^{N \times M}$ is defined such
767
+ that each column is a simplex. For column $m$ (where $ 1 \leq m \leq M$ ):
768
768
769
769
$$
770
770
X_{n, m} \geq 0 \quad \text{for } 1 \leq n \leq N,
790
790
\sum_{m=1}^N X_{n, m} = 1.
791
791
$$
792
792
793
- This definition ensures that each column (row) of the matrix \( X \) lies on the
794
- \( N-1\) dimensional unit simplex, similar to the ` simplex[N] ` type, but
793
+ This definition ensures that each column (row) of the matrix $X$ lies on the
794
+ $ N-1$ dimensional unit simplex, similar to the ` simplex[N] ` type, but
795
795
extended across multiple columns(rows).
796
796
797
797
### Inverse Transform for Stochastic Matrix {-}
@@ -801,8 +801,8 @@ as simplex, but applied to each column (row).
801
801
802
802
### Absolute Jacobian Determinant for the Inverse Transform {-}
803
803
804
- The Jacobian determinant of the inverse transform for each column \( m \) in
805
- the matrix is given by the product of the diagonal entries \( J_ {n, m}\) of
804
+ The Jacobian determinant of the inverse transform for each column $m$ in
805
+ the matrix is given by the product of the diagonal entries $ J_ {n, m}$ of
806
806
the lower-triangular Jacobian matrix. This determinant is calculated as:
807
807
808
808
$$
0 commit comments