Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ corr_matrix_constrain() [1/6]

template<typename T , require_eigen_col_vector_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > stan::math::corr_matrix_constrain ( const T &  x,
Eigen::Index  k 
)
inline

Return the correlation matrix of the specified dimensionality derived from the specified vector of unconstrained values.

The input vector must be of length \({k \choose 2} = \frac{k(k-1)}{2}\). The values in the input vector represent unconstrained (partial) correlations among the dimensions.

The transform based on partial correlations is as specified in

  • Lewandowski, Daniel, Dorota Kurowicka, and Harry Joe. 2009. Generating random correlation matrices based on vines and extended onion method. Journal of Multivariate Analysis 100:1989–-2001.

The free vector entries are first constrained to be valid correlation values using corr_constrain(T).

Template Parameters
Ttype of the vector (must be derived from Eigen::MatrixBase and have one compile-time dimension equal to 1)
Parameters
xVector of unconstrained partial correlations.
kDimensionality of returned correlation matrix.
Exceptions
std::invalid_argumentif x is not a valid correlation matrix.

Definition at line 41 of file corr_matrix_constrain.hpp.