Skip to content

Commit

Permalink
Add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlheureux committed Aug 28, 2024
1 parent 25678d4 commit 025ae0e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bambi/backend/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@


def horseshoe(name, tau_nu=3, lam_nu=1, dims=None):
"""Simulate a beta coefficient value with a horseshoe prior.
This is an internal function which is not supposed to be used by users.
This will be used only when a horseshoe prior is called for beta coefficients.
Parameters
----------
name: str
is the name of the parameters as registered in the PyMC model
tau_nu: int, float
Degrees of freedom of tau. Default: 3
lam_nu: int, float
Degrees of freedom of lam. Default: 1 (equivalent to a HalfCauchy)
dims: str
dimensions passed to PyMC. Default: None
Returns
------
np.ndarray
Array with the beta coefficient simulated.
"""
tau = pm.HalfStudentT(f"{name}_tau", nu=tau_nu)
lam = pm.HalfStudentT(f"{name}_lam", nu=lam_nu, dims=dims)
beta_raw = pm.Normal(f"{name}_raw", 0, 1, dims=dims)
Expand Down

0 comments on commit 025ae0e

Please sign in to comment.