# Source code for bambi.families.family

```from bambi.families.link import Link

[docs]class Family:
"""A specification of model family.

Parameters
----------
name: str
The name of the family. It can be any string.
likelihood: Likelihood
A ``bambi.families.Likelihood`` instance specifying the model likelihood function.
transforms the linear model prediction to the mean parameter of the likelihood function.

Examples
--------

>>> import bambi as bmb

Replicate the Gaussian built-in family.

>>> sigma_prior = bmb.Prior("HalfNormal", sigma=1)
>>> likelihood = bmb.Likelihood("Gaussian", parent="mu", sigma=sigma_prior)
>>> family = bmb.Family("gaussian", likelihood, "identity")
>>> # Then you can do
>>> # bmb.Model("y ~ x", data, family=family)

Replicate the Bernoulli built-in family.

>>> likelihood = bmb.Likelihood("Bernoulli", parent="p")
>>> family = bmb.Family("bernoulli", likelihood, "logit")
"""

"cloglog",
"identity",
"inverse_squared",
"inverse",
"log",
"logit",
"probit",
"softmax",
"tan_2",
]

self.name = name
self.likelihood = likelihood
self.aliases = {}

@property

if isinstance(x, str):
else:
raise ValueError(".link must be set to a string or a Link instance.")

[docs]    def set_alias(self, name, alias):
"""Set alias for an auxiliary variable of the family

Parameters
----------
name: str
The name of the variable
alias: str
The new name for the variable
"""
self.aliases.update({name: alias})

def __str__(self):
if self.likelihood.priors:
priors_msg = "\n  ".join([f"{k} ~ {v}" for k, v in self.likelihood.priors.items()])
msg_list += [f"Priors:\n  {priors_msg}"]
msg = "\n".join(msg_list)
return msg

def __repr__(self):
return self.__str__()
```