Skip to content

families

Reference: https://paulbuerkner.com/brms/reference/brmsfamily.html

Attributes

FitResult = IDResult[IDBrm] module-attribute

Classes

IDResult dataclass

Bases: Generic[T_idata], RListVectorExtension

Generic result container with arviz and R objects.

Attributes:

Name Type Description
idata InferenceData

arviz InferenceData object

r ListVector

R object from brms

Source code in brmspy/types/brms_results.py
@dataclass
class IDResult(Generic[T_idata], RListVectorExtension):
    """Generic result container with arviz and R objects.

    Attributes
    ----------
    idata : arviz.InferenceData
        arviz InferenceData object
    r : robjects.ListVector
        R object from brms
    """

    idata: T_idata

    def __repr__(self) -> str:
        return repr(self.idata)

Attributes

idata instance-attribute

Functions

__repr__()
Source code in brmspy/types/brms_results.py
def __repr__(self) -> str:
    return repr(self.idata)
__init__(r, idata)

Functions

kwargs_r(kwargs)

Convert Python keyword arguments to R-compatible format.

Convenience function that applies py_to_r() to all values in a keyword arguments dictionary, preparing them for R function calls.

Parameters:

Name Type Description Default
kwargs dict or None

Dictionary of keyword arguments where values may be Python objects (dicts, lists, DataFrames, arrays, etc.)

required

Returns:

Type Description
dict

Dictionary with same keys but R-compatible values, or empty dict if None

Notes

This is a thin wrapper around py_to_r() that operates on dictionaries. It's commonly used to prepare keyword arguments for R function calls via rpy2.

Examples:

from brmspy.helpers.conversion import kwargs_r
import pandas as pd
import numpy as np

# Prepare kwargs for R function
py_kwargs = {
    'data': pd.DataFrame({'y': [1, 2], 'x': [1, 2]}),
    'prior': {'b': [0, 1]},
    'chains': 4,
    'iter': 2000
}

r_kwargs = kwargs_r(py_kwargs)
# All values converted to R objects
# Can now call: r_function(**r_kwargs)
See Also

py_to_r : Underlying conversion function for individual values brmspy.brms.fit : Uses this to prepare user kwargs for R

Source code in brmspy/helpers/_rpy2/_conversion.py
def kwargs_r(kwargs: dict | None) -> dict:
    """
    Convert Python keyword arguments to R-compatible format.

    Convenience function that applies py_to_r() to all values in a
    keyword arguments dictionary, preparing them for R function calls.

    Parameters
    ----------
    kwargs : dict or None
        Dictionary of keyword arguments where values may be Python objects
        (dicts, lists, DataFrames, arrays, etc.)

    Returns
    -------
    dict
        Dictionary with same keys but R-compatible values, or empty dict if None

    Notes
    -----
    This is a thin wrapper around `py_to_r()` that operates on dictionaries.
    It's commonly used to prepare keyword arguments for R function calls via rpy2.

    Examples
    --------

    ```python
    from brmspy.helpers.conversion import kwargs_r
    import pandas as pd
    import numpy as np

    # Prepare kwargs for R function
    py_kwargs = {
        'data': pd.DataFrame({'y': [1, 2], 'x': [1, 2]}),
        'prior': {'b': [0, 1]},
        'chains': 4,
        'iter': 2000
    }

    r_kwargs = kwargs_r(py_kwargs)
    # All values converted to R objects
    # Can now call: r_function(**r_kwargs)
    ```

    See Also
    --------
    py_to_r : Underlying conversion function for individual values
    brmspy.brms.fit : Uses this to prepare user kwargs for R
    """
    if kwargs is None:
        return {}
    return {k: py_to_r(v) for k, v in kwargs.items()}

brmsfamily(family, link=None, link_sigma='log', link_shape='log', link_nu='logm1', link_phi='log', link_kappa='log', link_beta='log', link_zi='logit', link_hu='logit', link_zoi='logit', link_coi='logit', link_disc='log', link_bs='log', link_ndt='log', link_bias='logit', link_xi='log1p', link_alpha='identity', link_quantile='logit', threshold='flexible', refcat=None, **kwargs)

Family objects provide a convenient way to specify the details of the models used by many model fitting functions. The family functions presented here are for use with brms only and will not work with other model fitting functions such as glm or glmer. However, the standard family functions as described in family will work with brms.

Parameters:

Name Type Description Default
family

A character string naming the distribution family of the response variable to be used in the model. Currently, the following families are supported: gaussian, student, binomial, bernoulli, beta-binomial, poisson, negbinomial, geometric, Gamma, skew_normal, lognormal, shifted_lognormal, exgaussian, wiener, inverse.gaussian, exponential, weibull, frechet, Beta, dirichlet, von_mises, asym_laplace, gen_extreme_value, categorical, multinomial, cumulative, cratio, sratio, acat, hurdle_poisson, hurdle_negbinomial, hurdle_gamma, hurdle_lognormal, hurdle_cumulative, zero_inflated_binomial, zero_inflated_beta_binomial, zero_inflated_beta, zero_inflated_negbinomial, zero_inflated_poisson, and zero_one_inflated_beta.

required
link str | None

A specification for the model link function. This can be a name/expression or character string. See the 'Details' section for more information on link functions supported by each family.

None
link_sigma str

Link of auxiliary parameter sigma if being predicted.

'log'
link_shape str

Link of auxiliary parameter shape if being predicted.

'log'
link_nu str

Link of auxiliary parameter nu if being predicted.

'logm1'
link_phi str

Link of auxiliary parameter phi if being predicted.

'log'
link_kappa str

Link of auxiliary parameter kappa if being predicted.

'log'
link_beta str

Link of auxiliary parameter beta if being predicted.

'log'
link_zi str

Link of auxiliary parameter zi if being predicted.

'logit'
link_hu str

Link of auxiliary parameter hu if being predicted.

'logit'
link_zoi str

Link of auxiliary parameter zoi if being predicted.

'logit'
link_coi str

Link of auxiliary parameter coi if being predicted.

'logit'
link_disc str

Link of auxiliary parameter disc if being predicted.

'log'
link_bs str

Link of auxiliary parameter bs if being predicted.

'log'
link_ndt str

Link of auxiliary parameter ndt if being predicted.

'log'
link_bias str

Link of auxiliary parameter bias if being predicted.

'logit'
link_xi str

Link of auxiliary parameter xi if being predicted.

'log1p'
link_alpha str

Link of auxiliary parameter alpha if being predicted.

'identity'
link_quantile str

Link of auxiliary parameter quantile if being predicted.

'logit'
threshold str

A character string indicating the type of thresholds (i.e. intercepts) used in an ordinal model. "flexible" provides the standard unstructured thresholds, "equidistant" restricts the distance between consecutive thresholds to the same value, and "sum_to_zero" ensures the thresholds sum to zero.

'flexible'
refcat str | None

Optional name of the reference response category used in categorical, multinomial, dirichlet and logistic_normal models. If NULL (the default), the first category is used as the reference. If NA, all categories will be predicted, which requires strong priors or carefully specified predictor terms in order to lead to an identified model.

None
Source code in brmspy/_brms_functions/families.py
def brmsfamily(
    family,
    link: str | None = None,
    link_sigma: str = "log",
    link_shape: str = "log",
    link_nu: str = "logm1",
    link_phi: str = "log",
    link_kappa: str = "log",
    link_beta: str = "log",
    link_zi: str = "logit",
    link_hu: str = "logit",
    link_zoi: str = "logit",
    link_coi: str = "logit",
    link_disc: str = "log",
    link_bs: str = "log",
    link_ndt: str = "log",
    link_bias: str = "logit",
    link_xi: str = "log1p",
    link_alpha: str = "identity",
    link_quantile: str = "logit",
    threshold: str = "flexible",
    refcat: str | None = None,
    **kwargs,
) -> ListSexpVector:
    """
    Family objects provide a convenient way to specify the details of the models used by many model fitting functions. The family functions presented here are for use with brms only and will **not** work with other model fitting functions such as glm or glmer. However, the standard family functions as described in family will work with brms.

    Parameters
    ----------
    family
        A character string naming the distribution family of the response variable to be used in the model. Currently, the following families are supported: gaussian, student, binomial, bernoulli, beta-binomial, poisson, negbinomial, geometric, Gamma, skew_normal, lognormal, shifted_lognormal, exgaussian, wiener, inverse.gaussian, exponential, weibull, frechet, Beta, dirichlet, von_mises, asym_laplace, gen_extreme_value, categorical, multinomial, cumulative, cratio, sratio, acat, hurdle_poisson, hurdle_negbinomial, hurdle_gamma, hurdle_lognormal, hurdle_cumulative, zero_inflated_binomial, zero_inflated_beta_binomial, zero_inflated_beta, zero_inflated_negbinomial, zero_inflated_poisson, and zero_one_inflated_beta.
    link
        A specification for the model link function. This can be a name/expression or character string. See the 'Details' section for more information on link functions supported by each family.
    link_sigma
        Link of auxiliary parameter sigma if being predicted.
    link_shape
        Link of auxiliary parameter shape if being predicted.
    link_nu
        Link of auxiliary parameter nu if being predicted.
    link_phi
        Link of auxiliary parameter phi if being predicted.
    link_kappa
        Link of auxiliary parameter kappa if being predicted.
    link_beta
        Link of auxiliary parameter beta if being predicted.
    link_zi
        Link of auxiliary parameter zi if being predicted.
    link_hu
        Link of auxiliary parameter hu if being predicted.
    link_zoi
        Link of auxiliary parameter zoi if being predicted.
    link_coi
        Link of auxiliary parameter coi if being predicted.
    link_disc
        Link of auxiliary parameter disc if being predicted.
    link_bs
        Link of auxiliary parameter bs if being predicted.
    link_ndt
        Link of auxiliary parameter ndt if being predicted.
    link_bias
        Link of auxiliary parameter bias if being predicted.
    link_xi
        Link of auxiliary parameter xi if being predicted.
    link_alpha
        Link of auxiliary parameter alpha if being predicted.
    link_quantile
        Link of auxiliary parameter quantile if being predicted.
    threshold
        A character string indicating the type of thresholds (i.e. intercepts) used in an ordinal model. "flexible" provides the standard unstructured thresholds, "equidistant" restricts the distance between consecutive thresholds to the same value, and "sum_to_zero" ensures the thresholds sum to zero.
    refcat
        Optional name of the reference response category used in categorical, multinomial, dirichlet and logistic_normal models. If NULL (the default), the first category is used as the reference. If NA, all categories will be predicted, which requires strong priors or carefully specified predictor terms in order to lead to an identified model.

    """
    import rpy2.robjects as ro

    r_brmsfamily = cast(Callable, ro.r("brms::brmsfamily"))

    collected_args = {
        "family": family,
        "link": link,
        "link_sigma": link_sigma,
        "link_shape": link_shape,
        "link_nu": link_nu,
        "link_phi": link_phi,
        "link_kappa": link_kappa,
        "link_beta": link_beta,
        "link_zi": link_zi,
        "link_hu": link_hu,
        "link_zoi": link_zoi,
        "link_coi": link_coi,
        "link_disc": link_disc,
        "link_bs": link_bs,
        "link_ndt": link_ndt,
        "link_bias": link_bias,
        "link_xi": link_xi,
        "link_alpha": link_alpha,
        "link_quantile": link_quantile,
        "threshold": threshold,
        "refcat": refcat,
        **kwargs,
    }
    collected_args = kwargs_r(collected_args)

    return r_brmsfamily(**collected_args)

family(fit, **kwargs)

Extract family object from a fitted model.

Parameters:

Name Type Description Default
fit FitResult or ListSexpVector

Fitted brms model

required
Source code in brmspy/_brms_functions/families.py
def family(fit: FitResult | ListSexpVector, **kwargs) -> ListSexpVector:
    """Extract family object from a fitted model.

    Parameters
    ----------
    fit : FitResult or ListSexpVector
        Fitted brms model
    """
    import rpy2.robjects as ro

    if isinstance(fit, IDResult):
        r_fit = fit.r
    else:
        r_fit = fit

    r_family = cast(Callable, ro.r("family"))
    kwargs = kwargs_r(kwargs)

    return r_family(r_fit, **kwargs)

student(link='identity', link_sigma='log', link_nu='logm1', **kwargs)

Student's t distribution for robust regression.

Parameters:

Name Type Description Default
link str

Link function for the mean

'identity'
link_sigma str

Link function for sigma parameter

'log'
link_nu str

Link function for degrees of freedom parameter

'logm1'
Source code in brmspy/_brms_functions/families.py
def student(
    link: str = "identity", link_sigma: str = "log", link_nu: str = "logm1", **kwargs
) -> ListSexpVector:
    """Student's t distribution for robust regression.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_sigma : str
        Link function for sigma parameter
    link_nu : str
        Link function for degrees of freedom parameter
    """
    return brmsfamily(
        family="student",
        link=link,
        link_sigma=link_sigma,
        link_nu=link_nu,
        **kwargs,
    )

bernoulli(link='logit', **kwargs)

Bernoulli distribution for binary 0/1 outcomes.

Parameters:

Name Type Description Default
link str

Link function for the probability parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def bernoulli(link: str = "logit", **kwargs) -> ListSexpVector:
    """Bernoulli distribution for binary 0/1 outcomes.

    Parameters
    ----------
    link : str
        Link function for the probability parameter
    """
    return brmsfamily(
        family="bernoulli",
        link=link,
        **kwargs,
    )

beta_binomial(link='logit', link_phi='log', **kwargs)

Beta-binomial distribution for overdispersed binomial data.

Parameters:

Name Type Description Default
link str

Link function for the probability parameter

'logit'
link_phi str

Link function for the precision parameter

'log'
Source code in brmspy/_brms_functions/families.py
def beta_binomial(
    link: str = "logit", link_phi: str = "log", **kwargs
) -> ListSexpVector:
    """Beta-binomial distribution for overdispersed binomial data.

    Parameters
    ----------
    link : str
        Link function for the probability parameter
    link_phi : str
        Link function for the precision parameter
    """
    return brmsfamily(
        family="beta_binomial",
        link=link,
        link_phi=link_phi,
        **kwargs,
    )

negbinomial(link='log', link_shape='log', **kwargs)

Negative binomial distribution for overdispersed count data.

Parameters:

Name Type Description Default
link str

Link function for the mean

'log'
link_shape str

Link function for the shape parameter

'log'
Source code in brmspy/_brms_functions/families.py
def negbinomial(link: str = "log", link_shape: str = "log", **kwargs) -> ListSexpVector:
    """Negative binomial distribution for overdispersed count data.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_shape : str
        Link function for the shape parameter
    """
    return brmsfamily(
        family="negbinomial",
        link=link,
        link_shape=link_shape,
        **kwargs,
    )

negbinomial2(link='log', link_sigma='log', **kwargs)

Source code in brmspy/_brms_functions/families.py
def negbinomial2(
    link: str = "log", link_sigma: str = "log", **kwargs
) -> ListSexpVector:
    return brmsfamily(
        family="negbinomial2",
        link=link,
        link_sigma=link_sigma,
        **kwargs,
    )

geometric(link='log', **kwargs)

Geometric distribution for count data (negative binomial with shape=1).

Parameters:

Name Type Description Default
link str

Link function for the mean

'log'
Source code in brmspy/_brms_functions/families.py
def geometric(link: str = "log", **kwargs) -> ListSexpVector:
    """Geometric distribution for count data (negative binomial with shape=1).

    Parameters
    ----------
    link : str
        Link function for the mean
    """
    return brmsfamily(
        family="geometric",
        link=link,
        **kwargs,
    )

discrete_weibull(link='logit', link_shape='log', **kwargs)

Source code in brmspy/_brms_functions/families.py
def discrete_weibull(
    link: str = "logit", link_shape: str = "log", **kwargs
) -> ListSexpVector:
    return brmsfamily(
        family="discrete_weibull",
        link=link,
        link_shape=link_shape,
        **kwargs,
    )

com_poisson(link='log', link_shape='log', **kwargs)

Source code in brmspy/_brms_functions/families.py
def com_poisson(link: str = "log", link_shape: str = "log", **kwargs) -> ListSexpVector:
    return brmsfamily(
        family="com_poisson",
        link=link,
        link_shape=link_shape,
        **kwargs,
    )

lognormal(link='identity', link_sigma='log', **kwargs)

Lognormal distribution for positive continuous data.

Parameters:

Name Type Description Default
link str

Link function for the mean on log scale

'identity'
link_sigma str

Link function for sigma parameter

'log'
Source code in brmspy/_brms_functions/families.py
def lognormal(
    link: str = "identity", link_sigma: str = "log", **kwargs
) -> ListSexpVector:
    """Lognormal distribution for positive continuous data.

    Parameters
    ----------
    link : str
        Link function for the mean on log scale
    link_sigma : str
        Link function for sigma parameter
    """
    return brmsfamily(
        family="lognormal",
        link=link,
        link_sigma=link_sigma,
        **kwargs,
    )

shifted_lognormal(link='identity', link_sigma='log', link_ndt='log', **kwargs)

Shifted lognormal distribution with non-decision time parameter.

Parameters:

Name Type Description Default
link str

Link function for the mean

'identity'
link_sigma str

Link function for sigma parameter

'log'
link_ndt str

Link function for non-decision time parameter

'log'
Source code in brmspy/_brms_functions/families.py
def shifted_lognormal(
    link: str = "identity", link_sigma: str = "log", link_ndt: str = "log", **kwargs
) -> ListSexpVector:
    """Shifted lognormal distribution with non-decision time parameter.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_sigma : str
        Link function for sigma parameter
    link_ndt : str
        Link function for non-decision time parameter
    """
    return brmsfamily(
        family="shifted_lognormal",
        link=link,
        link_sigma=link_sigma,
        link_ndt=link_ndt,
        **kwargs,
    )

skew_normal(link='identity', link_sigma='log', link_alpha='identity', **kwargs)

Skew normal distribution for asymmetric continuous data.

Parameters:

Name Type Description Default
link str

Link function for the mean

'identity'
link_sigma str

Link function for sigma parameter

'log'
link_alpha str

Link function for skewness parameter

'identity'
Source code in brmspy/_brms_functions/families.py
def skew_normal(
    link: str = "identity",
    link_sigma: str = "log",
    link_alpha: str = "identity",
    **kwargs,
) -> ListSexpVector:
    """Skew normal distribution for asymmetric continuous data.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_sigma : str
        Link function for sigma parameter
    link_alpha : str
        Link function for skewness parameter
    """
    return brmsfamily(
        family="skew_normal",
        link=link,
        link_sigma=link_sigma,
        link_alpha=link_alpha,
        **kwargs,
    )

exponential(link='log', **kwargs)

Exponential distribution for time-to-event data.

Parameters:

Name Type Description Default
link str

Link function for the rate parameter

'log'
Source code in brmspy/_brms_functions/families.py
def exponential(link: str = "log", **kwargs) -> ListSexpVector:
    """Exponential distribution for time-to-event data.

    Parameters
    ----------
    link : str
        Link function for the rate parameter
    """
    return brmsfamily(
        family="exponential",
        link=link,
        **kwargs,
    )

weibull(link='log', link_shape='log', **kwargs)

Weibull distribution for survival and reliability analysis.

Parameters:

Name Type Description Default
link str

Link function for the scale parameter

'log'
link_shape str

Link function for the shape parameter

'log'
Source code in brmspy/_brms_functions/families.py
def weibull(link: str = "log", link_shape: str = "log", **kwargs) -> ListSexpVector:
    """Weibull distribution for survival and reliability analysis.

    Parameters
    ----------
    link : str
        Link function for the scale parameter
    link_shape : str
        Link function for the shape parameter
    """
    return brmsfamily(
        family="weibull",
        link=link,
        link_shape=link_shape,
        **kwargs,
    )

frechet(link='log', link_nu='logm1', **kwargs)

Frechet distribution for extreme value analysis.

Parameters:

Name Type Description Default
link str

Link function for the scale parameter

'log'
link_nu str

Link function for the shape parameter

'logm1'
Source code in brmspy/_brms_functions/families.py
def frechet(link: str = "log", link_nu: str = "logm1", **kwargs) -> ListSexpVector:
    """Frechet distribution for extreme value analysis.

    Parameters
    ----------
    link : str
        Link function for the scale parameter
    link_nu : str
        Link function for the shape parameter
    """
    return brmsfamily(
        family="frechet",
        link=link,
        link_nu=link_nu,
        **kwargs,
    )

gen_extreme_value(link='identity', link_sigma='log', link_xi='log1p', **kwargs)

Generalized extreme value distribution for extreme events.

Parameters:

Name Type Description Default
link str

Link function for the location parameter

'identity'
link_sigma str

Link function for the scale parameter

'log'
link_xi str

Link function for the shape parameter

'log1p'
Source code in brmspy/_brms_functions/families.py
def gen_extreme_value(
    link: str = "identity", link_sigma: str = "log", link_xi: str = "log1p", **kwargs
) -> ListSexpVector:
    """Generalized extreme value distribution for extreme events.

    Parameters
    ----------
    link : str
        Link function for the location parameter
    link_sigma : str
        Link function for the scale parameter
    link_xi : str
        Link function for the shape parameter
    """
    return brmsfamily(
        family="gen_extreme_value",
        link=link,
        link_sigma=link_sigma,
        link_xi=link_xi,
        **kwargs,
    )

exgaussian(link='identity', link_sigma='log', link_beta='log', **kwargs)

Ex-Gaussian distribution for reaction time data.

Parameters:

Name Type Description Default
link str

Link function for the mean

'identity'
link_sigma str

Link function for Gaussian SD parameter

'log'
link_beta str

Link function for exponential rate parameter

'log'
Source code in brmspy/_brms_functions/families.py
def exgaussian(
    link: str = "identity", link_sigma: str = "log", link_beta: str = "log", **kwargs
) -> ListSexpVector:
    """Ex-Gaussian distribution for reaction time data.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_sigma : str
        Link function for Gaussian SD parameter
    link_beta : str
        Link function for exponential rate parameter
    """
    return brmsfamily(
        family="exgaussian",
        link=link,
        link_sigma=link_sigma,
        link_beta=link_beta,
        **kwargs,
    )

wiener(link='identity', link_bs='log', link_ndt='log', link_bias='logit', **kwargs)

Wiener diffusion model for two-choice reaction time data.

Parameters:

Name Type Description Default
link str

Link function for drift rate

'identity'
link_bs str

Link function for boundary separation

'log'
link_ndt str

Link function for non-decision time

'log'
link_bias str

Link function for initial bias

'logit'
Source code in brmspy/_brms_functions/families.py
def wiener(
    link: str = "identity",
    link_bs: str = "log",
    link_ndt: str = "log",
    link_bias: str = "logit",
    **kwargs,
) -> ListSexpVector:
    """Wiener diffusion model for two-choice reaction time data.

    Parameters
    ----------
    link : str
        Link function for drift rate
    link_bs : str
        Link function for boundary separation
    link_ndt : str
        Link function for non-decision time
    link_bias : str
        Link function for initial bias
    """
    return brmsfamily(
        family="wiener",
        link=link,
        link_bs=link_bs,
        link_ndt=link_ndt,
        link_bias=link_bias,
        **kwargs,
    )

Beta(link='logit', link_phi='log', **kwargs)

Beta distribution for data between 0 and 1.

Parameters:

Name Type Description Default
link str

Link function for the mean

'logit'
link_phi str

Link function for the precision parameter

'log'
Source code in brmspy/_brms_functions/families.py
def Beta(link: str = "logit", link_phi: str = "log", **kwargs) -> ListSexpVector:
    """Beta distribution for data between 0 and 1.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_phi : str
        Link function for the precision parameter
    """
    return brmsfamily(
        family="beta",
        link=link,
        link_phi=link_phi,
        **kwargs,
    )

xbeta(link='logit', link_phi='log', link_kappa='log', **kwargs)

Extended beta distribution with additional shape parameter.

Parameters:

Name Type Description Default
link str

Link function for the mean

'logit'
link_phi str

Link function for precision parameter

'log'
link_kappa str

Link function for kappa shape parameter

'log'
Source code in brmspy/_brms_functions/families.py
def xbeta(
    link: str = "logit", link_phi: str = "log", link_kappa: str = "log", **kwargs
) -> ListSexpVector:
    """Extended beta distribution with additional shape parameter.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_phi : str
        Link function for precision parameter
    link_kappa : str
        Link function for kappa shape parameter
    """
    return brmsfamily(
        family="xbeta",
        link=link,
        link_phi=link_phi,
        link_kappa=link_kappa,
        **kwargs,
    )

dirichlet(link='logit', link_phi='log', refcat=None, **kwargs)

Dirichlet distribution for compositional data.

Parameters:

Name Type Description Default
link str

Link function for the mean

'logit'
link_phi str

Link function for the precision parameter

'log'
refcat str

Reference category

None
Source code in brmspy/_brms_functions/families.py
def dirichlet(
    link: str = "logit", link_phi: str = "log", refcat: str | None = None, **kwargs
) -> ListSexpVector:
    """Dirichlet distribution for compositional data.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_phi : str
        Link function for the precision parameter
    refcat : str, optional
        Reference category
    """
    return brmsfamily(
        family="dirichlet",
        link=link,
        link_phi=link_phi,
        refcat=refcat,
        **kwargs,
    )

dirichlet2(link='log', refcat=None, **kwargs)

Source code in brmspy/_brms_functions/families.py
def dirichlet2(
    link: str = "log",
    # NOTE: R version uses refcat = NA; here default None
    refcat: str | None = None,
    **kwargs,
) -> ListSexpVector:
    return brmsfamily(
        family="dirichlet2",
        link=link,
        refcat=refcat,
        **kwargs,
    )

logistic_normal(link='identity', link_sigma='log', refcat=None, **kwargs)

Logistic-normal distribution for compositional data.

Parameters:

Name Type Description Default
link str

Link function for the mean

'identity'
link_sigma str

Link function for sigma parameter

'log'
refcat str

Reference category

None
Source code in brmspy/_brms_functions/families.py
def logistic_normal(
    link: str = "identity",
    link_sigma: str = "log",
    refcat: str | None = None,
    **kwargs,
) -> ListSexpVector:
    """Logistic-normal distribution for compositional data.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_sigma : str
        Link function for sigma parameter
    refcat : str, optional
        Reference category
    """
    return brmsfamily(
        family="logistic_normal",
        link=link,
        link_sigma=link_sigma,
        refcat=refcat,
        **kwargs,
    )

von_mises(link='tan_half', link_kappa='log', **kwargs)

Von Mises distribution for circular/directional data.

Parameters:

Name Type Description Default
link str

Link function for the mean direction

'tan_half'
link_kappa str

Link function for concentration parameter

'log'
Source code in brmspy/_brms_functions/families.py
def von_mises(
    link: str = "tan_half", link_kappa: str = "log", **kwargs
) -> ListSexpVector:
    """Von Mises distribution for circular/directional data.

    Parameters
    ----------
    link : str
        Link function for the mean direction
    link_kappa : str
        Link function for concentration parameter
    """
    return brmsfamily(
        family="von_mises",
        link=link,
        link_kappa=link_kappa,
        **kwargs,
    )

asym_laplace(link='identity', link_sigma='log', link_quantile='logit', **kwargs)

Asymmetric Laplace distribution for quantile regression.

Parameters:

Name Type Description Default
link str

Link function for the location

'identity'
link_sigma str

Link function for sigma parameter

'log'
link_quantile str

Link function for the quantile parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def asym_laplace(
    link: str = "identity",
    link_sigma: str = "log",
    link_quantile: str = "logit",
    **kwargs,
) -> ListSexpVector:
    """Asymmetric Laplace distribution for quantile regression.

    Parameters
    ----------
    link : str
        Link function for the location
    link_sigma : str
        Link function for sigma parameter
    link_quantile : str
        Link function for the quantile parameter
    """
    return brmsfamily(
        family="asym_laplace",
        link=link,
        link_sigma=link_sigma,
        link_quantile=link_quantile,
        **kwargs,
    )

zero_inflated_asym_laplace(link='identity', link_sigma='log', link_quantile='logit', link_zi='logit', **kwargs)

Source code in brmspy/_brms_functions/families.py
def zero_inflated_asym_laplace(
    link: str = "identity",
    link_sigma: str = "log",
    link_quantile: str = "logit",
    link_zi: str = "logit",
    **kwargs,
) -> ListSexpVector:
    return brmsfamily(
        family="zero_inflated_asym_laplace",
        link=link,
        link_sigma=link_sigma,
        link_quantile=link_quantile,
        link_zi=link_zi,
        **kwargs,
    )

cox(link='log', **kwargs)

Cox proportional hazards model for survival data.

Parameters:

Name Type Description Default
link str

Link function for the hazard rate

'log'
Source code in brmspy/_brms_functions/families.py
def cox(link: str = "log", **kwargs) -> ListSexpVector:
    """Cox proportional hazards model for survival data.

    Parameters
    ----------
    link : str
        Link function for the hazard rate
    """
    # original R wrapper doesn't pass slink; brmsfamily doesn't need it
    return brmsfamily(
        family="cox",
        link=link,
        **kwargs,
    )

hurdle_poisson(link='log', link_hu='logit', **kwargs)

Hurdle Poisson distribution for zero-inflated count data.

Parameters:

Name Type Description Default
link str

Link function for the mean

'log'
link_hu str

Link function for hurdle parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def hurdle_poisson(
    link: str = "log", link_hu: str = "logit", **kwargs
) -> ListSexpVector:
    """Hurdle Poisson distribution for zero-inflated count data.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_hu : str
        Link function for hurdle parameter
    """
    return brmsfamily(
        family="hurdle_poisson",
        link=link,
        link_hu=link_hu,
        **kwargs,
    )

hurdle_negbinomial(link='log', link_shape='log', link_hu='logit', **kwargs)

Hurdle negative binomial for overdispersed zero-inflated count data.

Parameters:

Name Type Description Default
link str

Link function for the mean

'log'
link_shape str

Link function for shape parameter

'log'
link_hu str

Link function for hurdle parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def hurdle_negbinomial(
    link: str = "log", link_shape: str = "log", link_hu: str = "logit", **kwargs
) -> ListSexpVector:
    """Hurdle negative binomial for overdispersed zero-inflated count data.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_shape : str
        Link function for shape parameter
    link_hu : str
        Link function for hurdle parameter
    """
    return brmsfamily(
        family="hurdle_negbinomial",
        link=link,
        link_shape=link_shape,
        link_hu=link_hu,
        **kwargs,
    )

hurdle_gamma(link='log', link_shape='log', link_hu='logit', **kwargs)

Hurdle Gamma distribution for zero-inflated positive continuous data.

Parameters:

Name Type Description Default
link str

Link function for the mean

'log'
link_shape str

Link function for shape parameter

'log'
link_hu str

Link function for hurdle parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def hurdle_gamma(
    link: str = "log", link_shape: str = "log", link_hu: str = "logit", **kwargs
) -> ListSexpVector:
    """Hurdle Gamma distribution for zero-inflated positive continuous data.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_shape : str
        Link function for shape parameter
    link_hu : str
        Link function for hurdle parameter
    """
    return brmsfamily(
        family="hurdle_gamma",
        link=link,
        link_shape=link_shape,
        link_hu=link_hu,
        **kwargs,
    )

hurdle_lognormal(link='identity', link_sigma='log', link_hu='logit', **kwargs)

Hurdle lognormal for zero-inflated positive continuous data.

Parameters:

Name Type Description Default
link str

Link function for the mean

'identity'
link_sigma str

Link function for sigma parameter

'log'
link_hu str

Link function for hurdle parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def hurdle_lognormal(
    link: str = "identity", link_sigma: str = "log", link_hu: str = "logit", **kwargs
) -> ListSexpVector:
    """Hurdle lognormal for zero-inflated positive continuous data.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_sigma : str
        Link function for sigma parameter
    link_hu : str
        Link function for hurdle parameter
    """
    return brmsfamily(
        family="hurdle_lognormal",
        link=link,
        link_sigma=link_sigma,
        link_hu=link_hu,
        **kwargs,
    )

hurdle_cumulative(link='logit', link_hu='logit', link_disc='log', threshold='flexible', **kwargs)

Hurdle cumulative for zero-inflated ordinal data.

Parameters:

Name Type Description Default
link str

Link function for the ordinal response

'logit'
link_hu str

Link function for hurdle parameter

'logit'
link_disc str

Link function for discrimination parameter

'log'
threshold str

Type of threshold structure

'flexible'
Source code in brmspy/_brms_functions/families.py
def hurdle_cumulative(
    link: str = "logit",
    link_hu: str = "logit",
    link_disc: str = "log",
    threshold: str = "flexible",
    **kwargs,
) -> ListSexpVector:
    """Hurdle cumulative for zero-inflated ordinal data.

    Parameters
    ----------
    link : str
        Link function for the ordinal response
    link_hu : str
        Link function for hurdle parameter
    link_disc : str
        Link function for discrimination parameter
    threshold : str
        Type of threshold structure
    """
    return brmsfamily(
        family="hurdle_cumulative",
        link=link,
        link_hu=link_hu,
        link_disc=link_disc,
        threshold=threshold,
        **kwargs,
    )

zero_inflated_beta(link='logit', link_phi='log', link_zi='logit', **kwargs)

Zero-inflated beta for data between 0 and 1 with excess zeros.

Parameters:

Name Type Description Default
link str

Link function for the mean

'logit'
link_phi str

Link function for precision parameter

'log'
link_zi str

Link function for zero-inflation parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def zero_inflated_beta(
    link: str = "logit", link_phi: str = "log", link_zi: str = "logit", **kwargs
) -> ListSexpVector:
    """Zero-inflated beta for data between 0 and 1 with excess zeros.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_phi : str
        Link function for precision parameter
    link_zi : str
        Link function for zero-inflation parameter
    """
    return brmsfamily(
        family="zero_inflated_beta",
        link=link,
        link_phi=link_phi,
        link_zi=link_zi,
        **kwargs,
    )

zero_one_inflated_beta(link='logit', link_phi='log', link_zoi='logit', link_coi='logit', **kwargs)

Zero-one-inflated beta for data between 0 and 1 with excess zeros and ones.

Parameters:

Name Type Description Default
link str

Link function for the mean

'logit'
link_phi str

Link function for precision parameter

'log'
link_zoi str

Link function for zero-or-one inflation parameter

'logit'
link_coi str

Link function for conditional one inflation parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def zero_one_inflated_beta(
    link: str = "logit",
    link_phi: str = "log",
    link_zoi: str = "logit",
    link_coi: str = "logit",
    **kwargs,
) -> ListSexpVector:
    """Zero-one-inflated beta for data between 0 and 1 with excess zeros and ones.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_phi : str
        Link function for precision parameter
    link_zoi : str
        Link function for zero-or-one inflation parameter
    link_coi : str
        Link function for conditional one inflation parameter
    """
    return brmsfamily(
        family="zero_one_inflated_beta",
        link=link,
        link_phi=link_phi,
        link_zoi=link_zoi,
        link_coi=link_coi,
        **kwargs,
    )

zero_inflated_poisson(link='log', link_zi='logit', **kwargs)

Zero-inflated Poisson for count data with excess zeros.

Parameters:

Name Type Description Default
link str

Link function for the mean

'log'
link_zi str

Link function for zero-inflation parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def zero_inflated_poisson(
    link: str = "log", link_zi: str = "logit", **kwargs
) -> ListSexpVector:
    """Zero-inflated Poisson for count data with excess zeros.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_zi : str
        Link function for zero-inflation parameter
    """
    return brmsfamily(
        family="zero_inflated_poisson",
        link=link,
        link_zi=link_zi,
        **kwargs,
    )

zero_inflated_negbinomial(link='log', link_shape='log', link_zi='logit', **kwargs)

Zero-inflated negative binomial for overdispersed count data with excess zeros.

Parameters:

Name Type Description Default
link str

Link function for the mean

'log'
link_shape str

Link function for shape parameter

'log'
link_zi str

Link function for zero-inflation parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def zero_inflated_negbinomial(
    link: str = "log", link_shape: str = "log", link_zi: str = "logit", **kwargs
) -> ListSexpVector:
    """Zero-inflated negative binomial for overdispersed count data with excess zeros.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_shape : str
        Link function for shape parameter
    link_zi : str
        Link function for zero-inflation parameter
    """
    return brmsfamily(
        family="zero_inflated_negbinomial",
        link=link,
        link_shape=link_shape,
        link_zi=link_zi,
        **kwargs,
    )

zero_inflated_binomial(link='logit', link_zi='logit', **kwargs)

Zero-inflated binomial for binary count data with excess zeros.

Parameters:

Name Type Description Default
link str

Link function for probability parameter

'logit'
link_zi str

Link function for zero-inflation parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def zero_inflated_binomial(
    link: str = "logit", link_zi: str = "logit", **kwargs
) -> ListSexpVector:
    """Zero-inflated binomial for binary count data with excess zeros.

    Parameters
    ----------
    link : str
        Link function for probability parameter
    link_zi : str
        Link function for zero-inflation parameter
    """
    return brmsfamily(
        family="zero_inflated_binomial",
        link=link,
        link_zi=link_zi,
        **kwargs,
    )

zero_inflated_beta_binomial(link='logit', link_phi='log', link_zi='logit', **kwargs)

Zero-inflated beta-binomial for overdispersed binomial data with excess zeros.

Parameters:

Name Type Description Default
link str

Link function for probability parameter

'logit'
link_phi str

Link function for precision parameter

'log'
link_zi str

Link function for zero-inflation parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def zero_inflated_beta_binomial(
    link: str = "logit", link_phi: str = "log", link_zi: str = "logit", **kwargs
) -> ListSexpVector:
    """Zero-inflated beta-binomial for overdispersed binomial data with excess zeros.

    Parameters
    ----------
    link : str
        Link function for probability parameter
    link_phi : str
        Link function for precision parameter
    link_zi : str
        Link function for zero-inflation parameter
    """
    return brmsfamily(
        family="zero_inflated_beta_binomial",
        link=link,
        link_phi=link_phi,
        link_zi=link_zi,
        **kwargs,
    )

categorical(link='logit', refcat=None, **kwargs)

Categorical distribution for unordered multi-category outcomes.

Parameters:

Name Type Description Default
link str

Link function for category probabilities

'logit'
refcat str

Reference category

None
Source code in brmspy/_brms_functions/families.py
def categorical(
    link: str = "logit", refcat: str | None = None, **kwargs
) -> ListSexpVector:
    """Categorical distribution for unordered multi-category outcomes.

    Parameters
    ----------
    link : str
        Link function for category probabilities
    refcat : str, optional
        Reference category
    """
    return brmsfamily(
        family="categorical",
        link=link,
        refcat=refcat,
        **kwargs,
    )

multinomial(link='logit', refcat=None, **kwargs)

Multinomial distribution for count data across multiple categories.

Parameters:

Name Type Description Default
link str

Link function for category probabilities

'logit'
refcat str

Reference category

None
Source code in brmspy/_brms_functions/families.py
def multinomial(
    link: str = "logit", refcat: str | None = None, **kwargs
) -> ListSexpVector:
    """Multinomial distribution for count data across multiple categories.

    Parameters
    ----------
    link : str
        Link function for category probabilities
    refcat : str, optional
        Reference category
    """
    return brmsfamily(
        family="multinomial",
        link=link,
        refcat=refcat,
        **kwargs,
    )

dirichlet_multinomial(link='logit', link_phi='log', refcat=None, **kwargs)

Dirichlet-multinomial for overdispersed categorical count data.

Parameters:

Name Type Description Default
link str

Link function for category probabilities

'logit'
link_phi str

Link function for precision parameter

'log'
refcat str

Reference category

None
Source code in brmspy/_brms_functions/families.py
def dirichlet_multinomial(
    link: str = "logit", link_phi: str = "log", refcat: str | None = None, **kwargs
) -> ListSexpVector:
    """Dirichlet-multinomial for overdispersed categorical count data.

    Parameters
    ----------
    link : str
        Link function for category probabilities
    link_phi : str
        Link function for precision parameter
    refcat : str, optional
        Reference category
    """
    return brmsfamily(
        family="dirichlet_multinomial",
        link=link,
        link_phi=link_phi,
        refcat=refcat,
        **kwargs,
    )

cumulative(link='logit', link_disc='log', threshold='flexible', **kwargs)

Cumulative (proportional odds) model for ordinal outcomes.

Parameters:

Name Type Description Default
link str

Link function for cumulative probabilities

'logit'
link_disc str

Link function for discrimination parameter

'log'
threshold str

Type of threshold structure

'flexible'
Source code in brmspy/_brms_functions/families.py
def cumulative(
    link: str = "logit", link_disc: str = "log", threshold: str = "flexible", **kwargs
) -> ListSexpVector:
    """Cumulative (proportional odds) model for ordinal outcomes.

    Parameters
    ----------
    link : str
        Link function for cumulative probabilities
    link_disc : str
        Link function for discrimination parameter
    threshold : str
        Type of threshold structure
    """
    return brmsfamily(
        family="cumulative",
        link=link,
        link_disc=link_disc,
        threshold=threshold,
        **kwargs,
    )

sratio(link='logit', link_disc='log', threshold='flexible', **kwargs)

Sequential (stopping) ratio model for ordinal outcomes.

Parameters:

Name Type Description Default
link str

Link function for sequential ratios

'logit'
link_disc str

Link function for discrimination parameter

'log'
threshold str

Type of threshold structure

'flexible'
Source code in brmspy/_brms_functions/families.py
def sratio(
    link: str = "logit", link_disc: str = "log", threshold: str = "flexible", **kwargs
) -> ListSexpVector:
    """Sequential (stopping) ratio model for ordinal outcomes.

    Parameters
    ----------
    link : str
        Link function for sequential ratios
    link_disc : str
        Link function for discrimination parameter
    threshold : str
        Type of threshold structure
    """
    return brmsfamily(
        family="sratio",
        link=link,
        link_disc=link_disc,
        threshold=threshold,
        **kwargs,
    )

cratio(link='logit', link_disc='log', threshold='flexible', **kwargs)

Continuation ratio model for ordinal outcomes.

Parameters:

Name Type Description Default
link str

Link function for continuation ratios

'logit'
link_disc str

Link function for discrimination parameter

'log'
threshold str

Type of threshold structure

'flexible'
Source code in brmspy/_brms_functions/families.py
def cratio(
    link: str = "logit", link_disc: str = "log", threshold: str = "flexible", **kwargs
) -> ListSexpVector:
    """Continuation ratio model for ordinal outcomes.

    Parameters
    ----------
    link : str
        Link function for continuation ratios
    link_disc : str
        Link function for discrimination parameter
    threshold : str
        Type of threshold structure
    """
    return brmsfamily(
        family="cratio",
        link=link,
        link_disc=link_disc,
        threshold=threshold,
        **kwargs,
    )

acat(link='logit', link_disc='log', threshold='flexible', **kwargs)

Adjacent category model for ordinal outcomes.

Parameters:

Name Type Description Default
link str

Link function for adjacent category ratios

'logit'
link_disc str

Link function for discrimination parameter

'log'
threshold str

Type of threshold structure

'flexible'
Source code in brmspy/_brms_functions/families.py
def acat(
    link: str = "logit", link_disc: str = "log", threshold: str = "flexible", **kwargs
) -> ListSexpVector:
    """Adjacent category model for ordinal outcomes.

    Parameters
    ----------
    link : str
        Link function for adjacent category ratios
    link_disc : str
        Link function for discrimination parameter
    threshold : str
        Type of threshold structure
    """
    return brmsfamily(
        family="acat",
        link=link,
        link_disc=link_disc,
        threshold=threshold,
        **kwargs,
    )

gaussian(link='identity', link_sigma='log', **kwargs)

Gaussian (normal) distribution for continuous data.

Parameters:

Name Type Description Default
link str

Link function for the mean

'identity'
link_sigma str

Link function for the standard deviation

'log'
Source code in brmspy/_brms_functions/families.py
def gaussian(
    link: str = "identity",
    link_sigma: str = "log",
    **kwargs,
) -> ListSexpVector:
    """Gaussian (normal) distribution for continuous data.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_sigma : str
        Link function for the standard deviation
    """
    return brmsfamily(
        family="gaussian",
        link=link,
        link_sigma=link_sigma,
        **kwargs,
    )

poisson(link='log', **kwargs)

Poisson distribution for count data.

Parameters:

Name Type Description Default
link str

Link function for the rate parameter

'log'
Source code in brmspy/_brms_functions/families.py
def poisson(
    link: str = "log",
    **kwargs,
) -> ListSexpVector:
    """Poisson distribution for count data.

    Parameters
    ----------
    link : str
        Link function for the rate parameter
    """
    return brmsfamily(
        family="poisson",
        link=link,
        **kwargs,
    )

binomial(link='logit', **kwargs)

Binomial distribution for binary count data.

Parameters:

Name Type Description Default
link str

Link function for the probability parameter

'logit'
Source code in brmspy/_brms_functions/families.py
def binomial(
    link: str = "logit",
    **kwargs,
) -> ListSexpVector:
    """Binomial distribution for binary count data.

    Parameters
    ----------
    link : str
        Link function for the probability parameter
    """
    return brmsfamily(
        family="binomial",
        link=link,
        **kwargs,
    )

Gamma(link='log', link_shape='log', **kwargs)

Gamma distribution for positive continuous data.

Parameters:

Name Type Description Default
link str

Link function for the mean

'log'
link_shape str

Link function for the shape parameter

'log'
Source code in brmspy/_brms_functions/families.py
def Gamma(
    link: str = "log",
    link_shape: str = "log",
    **kwargs,
) -> ListSexpVector:
    """Gamma distribution for positive continuous data.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_shape : str
        Link function for the shape parameter
    """
    return brmsfamily(
        family="Gamma",
        link=link,
        link_shape=link_shape,
        **kwargs,
    )

inverse_gaussian(link='1/mu^2', link_shape='log', **kwargs)

Inverse Gaussian distribution for positive continuous data.

Parameters:

Name Type Description Default
link str

Link function for the mean

'1/mu^2'
link_shape str

Link function for the shape parameter

'log'
Source code in brmspy/_brms_functions/families.py
def inverse_gaussian(
    link: str = "1/mu^2",
    link_shape: str = "log",
    **kwargs,
) -> ListSexpVector:
    """Inverse Gaussian distribution for positive continuous data.

    Parameters
    ----------
    link : str
        Link function for the mean
    link_shape : str
        Link function for the shape parameter
    """
    return brmsfamily(
        family="inverse.gaussian",
        link=link,
        link_shape=link_shape,
        **kwargs,
    )