Skip to content

hssm.Param

hssm.Param dataclass

Param(
    name: str | None = None,
    prior: float | np.ndarray | dict[str, Any] | bmb.Prior | None = None,
    formula: str | None = None,
    link: str | bmb.Link | None = None,
    bounds: tuple[float, float] | None = None,
)

Represent the user-provided specifications for the main HSSM class.

Also provides convenience functions that can be used by the HSSM class to parse arguments.

Parameters:

  • name (optional, default: None ) –

    The name of the parameter. This can be omitted if the Param is specified as kwargs in the HSSM class.

  • prior (optional, default: None ) –

    If a formula is not specified (the non-regression case), this parameter expects a float value if the parameter is fixed or a dictionary that can be parsed by Bambi as a prior specification or a Bambi Prior object. If a formula is specified (the regression case), this parameter expects a dictionary of param:prior, where param is the name of the response variable specified in formula, and prior is specified as above. If left unspecified, default priors created by Bambi will be used.

  • formula (optional, default: None ) –

    The regression formula if the parameter depends on other variables.

  • link (optional, default: None ) –

    The link function for the regression. It is either a string that specifies a built-in link function in Bambi, or a Bambi Link object. If a regression is specified and link is not specified, "identity" will be used by default.

  • bounds (optional, default: None ) –

    If provided, the prior will be created with boundary checks. If this parameter is specified as a regression, boundary checks will be skipped at this point.

Methods:

  • from_dict

    Create a Param object from a dictionary.

  • from_kwargs

    Create a Param object from keyword arguments.

  • to_dict

    Convert the UserParam object to a dictionary with shallow copy.

Methods:

  • from_dict

    Create a Param object from a dictionary.

  • from_kwargs

    Create a Param object from keyword arguments.

  • to_dict

    Convert the UserParam object to a dictionary with shallow copy.

Attributes:

hssm.Param.is_regression property

is_regression: bool

Check if the parameter is a regression parameter.

hssm.Param.is_simple property

is_simple: bool

Check if the parameter is a simple parameter.

hssm.Param.from_dict classmethod

from_dict(param_dict: dict[str, Any]) -> UserParam

Create a Param object from a dictionary.

Parameters:

  • param_dict (dict[str, Any]) –

    A dictionary with the keys "name", "prior", "formula", "link", and "bounds".

Returns:

  • UserParam

    A Param object with the specified parameters.

hssm.Param.from_kwargs classmethod

from_kwargs(
    name: str,
    param: Union[float, np.ndarray, dict[str, Any], bmb.Prior, UserParam],
) -> UserParam

Create a Param object from keyword arguments.

Parameters:

Returns:

  • UserParam

    A Param object with the specified parameters.

hssm.Param.to_dict

to_dict() -> dict

Convert the UserParam object to a dictionary with shallow copy.