Skip to contents

Convenience wrapper returning both conditional moments in one call.

Usage

moments_K_given_alpha(J, alpha)

Arguments

J

Sample size (integer >= 1).

alpha

Concentration parameter (positive numeric, vectorized).

Value

If alpha is scalar, a named numeric vector c(mean = ..., var = ...). If alpha is a vector, a numeric matrix with two columns mean and var (one row per element of alpha).

Examples

moments_K_given_alpha(50, 2.0)
#>     mean      var 
#> 7.037626 4.535558 
moments_K_given_alpha(50, c(0.5, 1, 2, 5))
#>           mean      var
#> [1,]  2.937775 1.709074
#> [2,]  4.499205 2.874073
#> [3,]  7.037626 4.535558
#> [4,] 12.460485 7.386114