pangolin.interface.Interface.beta_binomial#
- Interface.beta_binomial(N, alpha, beta)[source]#
Create a
BetaBinomialdistributed RV (Wikipedia).All arguments must either be scalar or mutually broadcastable according to the broadcasting policy selected when constructing the interface or within an overload block.
- Parameters:
- Returns:
ir.RV – RV whose operation is
pangolin.ir.BetaBinomialwhen all parents are scalar, or one or more nestedpangolin.ir.VMapoperations around that type when broadcasting is required. The operation has 3 parents.- Return type:
Examples
>>> pi = Interface() >>> x = pi.beta_binomial(0.1, 0.2, 0.4) >>> x RV(BetaBinomial(), RV(Constant(0.1)), RV(Constant(0.2)), RV(Constant(0.4))) >>> x.shape () >>> y = pi.beta_binomial([0.1, 0.1], 0.2, 0.4) >>> y RV(VMap(BetaBinomial(), [0, None, None], 2), RV(Constant([0.1,0.1])), RV(Constant(0.2)), RV(Constant(0.4))) >>> y.shape (2,)
Notes
This follows the (N,alpha,beta) convention of Stan (and Wikipedia). Some other systems (e.g. Numpyro) use alternate variable orderings. This is no problem for you as a user, since pangolin does the re-ordering for you based on the backend. But keep it in mind if translating a model from one system to another.
See also