@@ -675,10 +675,10 @@ priors for some parameters.
675
675
676
676
### Stochastic Matrices {-}
677
677
678
- A stochastic matrix is a matrix where each column, row, or both is a
679
- unit simplex, meaning that each column(row) vector has non-negative
680
- values that sum to 1. For example, a \( 3 \times 4\)
681
- column stochastic matrix will look like:
678
+ A stochastic matrix is a matrix where each column, row, or both is a
679
+ unit simplex, meaning that each column (row) vector has non-negative
680
+ values that sum to 1. The following example is a \( 3 \times 4\)
681
+ column- stochastic matrix.
682
682
683
683
$$
684
684
\begin{bmatrix}
688
688
\end{bmatrix}
689
689
$$
690
690
691
- While a row stochastic matrix will look like:
691
+ An example of a \( 3 \times 4 \) row- stochastic matrix is the following.
692
692
693
693
$$
694
694
\begin{bmatrix}
699
699
$$
700
700
701
701
702
- In this example , each column( row) sums to 1, making the matrix a
703
- valid ` column_stochastic_matrix ` and ` row_stochastic_matrix ` .
702
+ In the examples above , each column (or row) sums to 1, making the matrices
703
+ valid ` column_stochastic_matrix ` and ` row_stochastic_matrix ` types .
704
704
705
- Column stochastic matrices are often used in models where
706
- each column represents a probability distribution across a
707
- set of categories, such as in multiple multinomial distributions,
708
- transition matrices in Markov models, or compositional data analysis.
709
- They can also be used in situations where multiple Dirichlet-distributed v
710
- ariables are required across different dimensions.
705
+ Column-stochastic matrices are often used in models where
706
+ each column represents a probability distribution across a
707
+ set of categories such as in multiple multinomial distributions,
708
+ factor models, transition matrices in Markov models,
709
+ or compositional data analysis.
710
+ They can also be used in situations where you need multiple simplexes
711
+ of the same dimensionality.
711
712
712
- The ` column_stochastic_matrix ` and ` row_stochastic_matrix ` types are declared
713
- with full dimensionality . For instance, a matrix ` theta ` with
714
- 3 rows and 4 columns, where each
715
- column is a 3-simplex, is declared as:
713
+ The ` column_stochastic_matrix ` and ` row_stochastic_matrix ` types are declared
714
+ with row and column sizes . For instance, a matrix ` theta ` with
715
+ 3 rows and 4 columns, where each
716
+ column is a 3-simplex, is declared like a matrix with 3 rows and 4 columns.
716
717
717
718
``` stan
718
719
column_stochastic_matrix[3, 4] theta;
719
720
```
720
721
721
- A matrix ` theta ` with
722
- 3 rows and 4 columns, where each
723
- row is a 4-simplex, is declared as:
722
+ A matrix ` theta ` with 3 rows and 4 columns, where each row is a 4-simplex,
723
+ is similarly declared as a matrix with 3 rows and 4 columns.
724
724
725
725
``` stan
726
726
row_stochastic_matrix[3, 4] theta;
727
727
```
728
728
729
- As with simplexes, ` column(row)_stochastic_matrix ` variables are subject to
730
- validation, ensuring that each column(row) satisfies the simplex constraints.
731
- This validation accounts for floating-point imprecision, with checks
732
- performed up to a statically specified accuracy threshold \( \epsilon\) .
729
+ As with simplexes, ` column_stochastic_matrix ` and ` row_stochastic_matrix `
730
+ variables are subject to validation, ensuring that each column (row)
731
+ satisfies the simplex constraints. This validation accounts for
732
+ floating-point imprecision, with checks performed up to a statically
733
+ specified accuracy threshold \( \epsilon\) .
733
734
734
735
#### Stability Considerations {-}
735
736
736
- In high-dimensional settings or when the matrix has many columns,
737
- ` column_stochastic_matrix ` types may require careful tuning of the inference
737
+ In high-dimensional settings, ` column_stochastic_matrix ` and ` row_stochastic_matrix `
738
+ types may require careful tuning of the inference
738
739
algorithms. To ensure stability:
739
740
740
- - ** Smaller Step Sizes:** In samplers like Hamiltonian Monte Carlo (HMC),
741
+ - ** Smaller Step Sizes:** In samplers like Hamiltonian Monte Carlo (HMC),
741
742
smaller step sizes can help maintain stability, especially in high dimensions.
742
- - ** Higher Target Acceptance Rates:** Setting higher target acceptance
743
+ - ** Higher Target Acceptance Rates:** Setting higher target acceptance
743
744
rates can improve the robustness of the sampling process.
744
- - ** Longer Warmup Periods:** Increasing the warmup period allows the sampler
745
+ - ** Longer Warmup Periods:** Increasing the warmup period allows the sampler
745
746
to better explore the parameter space before the actual sampling begins.
746
- - ** Tighter Optimization Tolerances:** For optimization-based inference,
747
+ - ** Tighter Optimization Tolerances:** For optimization-based inference,
747
748
tighter tolerances with more iterations can yield more accurate results.
748
- - ** Custom Initialization:** If prior information about the parameters is
749
- available, custom initialization or less dispersed initialization can lead
749
+ - ** Custom Initialization:** If prior information about the parameters is
750
+ available, custom initialization or less dispersed initialization can lead
750
751
to more efficient inference.
751
752
752
753
### Unit vectors {-}
0 commit comments