families
Reference: https://paulbuerkner.com/brms/reference/brmsfamily.html
family()
Classes¶
Functions¶
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
|
Optional[str]
|
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
|
Optional[str]
|
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
|
bhaz
|
Currently for experimental purposes only. |
required |
family(fit, **kwargs)
¶
Extract family object from a fitted model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fit
|
FitResult or ListVector
|
Fitted brms model |
required |
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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
|
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
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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'
|
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
|
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
|
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
|
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'
|
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'
|
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'
|
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'
|
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'
|
poisson(link='log', **kwargs)
¶
Poisson distribution for count data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
link
|
str
|
Link function for the rate parameter |
'log'
|
binomial(link='logit', **kwargs)
¶
Binomial distribution for binary count data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
link
|
str
|
Link function for the probability parameter |
'logit'
|
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'
|
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'
|