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

◆ sum_to_zero_constrain() [4/7]

template<typename T , require_std_vector_t< T > * = nullptr>
auto stan::math::sum_to_zero_constrain ( T &&  y)
inline

Return a vector or matrix with sum zero corresponding to the specified free input.

Return a vector with sum zero corresponding to the specified free vector.

This overload handles looping over the elements of a standard vector.

Template Parameters
TA standard vector with inner type that is either a vector or a matrix
Parameters
[in]yfree vector or matrix
Returns
Zero-sum vectors or matrices which are one larger in each dimension

The sum-to-zero transform is defined using a modified version of the inverse of the isometric log ratio transform (ILR). See: Egozcue, Juan Jose; Pawlowsky-Glahn, Vera; Mateu-Figueras, Gloria; Barcelo-Vidal, Carles (2003), "Isometric logratio transformations for compositional data analysis", Mathematical Geology, 35 (3): 279–300, doi:10.1023/A:1023818214614, S2CID 122844634

This implementation is closer to the description of the same using "pivot coordinates" in Filzmoser, P., Hron, K., Templ, M. (2018). Geometrical Properties of Compositional Data. In: Applied Compositional Data Analysis. Springer Series in Statistics. Springer, Cham. https://doi.org/10.1007/978-3-319-96422-5_3

This is a linear transform, with no Jacobian.

Template Parameters
Ttype of the vector
Parameters
yFree vector input of dimensionality K - 1.
Returns
Zero-sum vector of dimensionality K.

Definition at line 141 of file sum_to_zero_constrain.hpp.