class_docstr: Specification of model class.
  
  Parameters
  ----------
  formula : str or bambi.formula.Formula
      A model description written using the formula syntax from the ``formulae`` library.
  data : pandas.DataFrame
      A pandas dataframe containing the data on which the model will be fit, with column
      names matching variables defined in the formula.
  family : str or bambi.families.Family
      A specification of the model family (analogous to the family object in R). Either
      a string, or an instance of class ``bambi.families.Family``. If a string is passed, a
      family with the corresponding name must be defined in the defaults loaded at ``Model``
      initialization. Valid pre-defined families are ``"bernoulli"``, ``"beta"``,
      ``"binomial"``, ``"categorical"``, ``"gamma"``, ``"gaussian"``, ``"negativebinomial"``,
      ``"poisson"``, ``"t"``, and ``"wald"``. Defaults to ``"gaussian"``.
  priors : dict
      Optional specification of priors for one or more terms. A dictionary where the keys are
      the names of terms in the model, "common," or "group_specific" and the values are
      instances of class ``Prior``. If priors are unset, uses automatic priors inspired by
      the R rstanarm library.
  link : str or Dict[str, str]
      The name of the link function to use. Valid names are ``"cloglog"``, ``"identity"``,
      ``"inverse_squared"``, ``"inverse"``, ``"log"``, ``"logit"``, ``"probit"``, and
      ``"softmax"``. Not all the link functions can be used with all the families.
      If a dictionary, keys are the names of the target parameters and the values are the names
      of the link functions.
  categorical : str or list
      The names of any variables to treat as categorical. Can be either a single variable
      name, or a list of names. If categorical is ``None``, the data type of the columns in
      the ``data`` will be used to infer handling. In cases where numeric columns are
      to be treated as categorical (e.g., group specific factors coded as numerical IDs),
      explicitly passing variable names via this argument is recommended.
  potentials : A list of 2-tuples.
      Optional specification of potentials. A potential is an arbitrary expression added to the
      likelihood, this is generally useful to add constrains to models, that are difficult to
      express otherwise. The first term of a 2-tuple is the name of a variable in the model, the
      second a lambda function expressing the desired constraint.
      If a constraint involves n variables, you can pass n 2-tuples or pass a tuple which first
      element is a n-tuple and second element is a lambda function with n arguments. The number
      and order of the lambda function has to match the number and order of the variables names.
  dropna : bool
      When ``True``, rows with any missing values in either the predictors or outcome are
      automatically dropped from the dataset in a listwise manner.
  auto_scale : bool
      If ``True`` (default), priors are automatically rescaled to the data
      (to be weakly informative) any time default priors are used. Note that any priors
      explicitly set by the user will always take precedence over default priors.
  noncentered : bool
      If ``True`` (default), uses a non-centered parameterization for normal hyperpriors on
      grouped parameters. If ``False``, naive (centered) parameterization is used.
  center_predictors : bool
      If ``True`` (default), and if there is an intercept in the common terms, the data is
      centered by subtracting the mean. The centering is undone after sampling to provide
      the actual intercept in all distributional components that have an intercept. Note
      that this changes the interpretation of the prior on the intercept because it refers
      to the intercept of the centered data.
  extra_namespace : dict, optional
      Additional user supplied variables with transformations or data to include in the
      environment where the formula is evaluated. Defaults to `None`.
docstr: Samples from the prior distribution and plots its marginals.
  
  Parameters
  ----------
  draws : int
      Number of draws to sample from the prior predictive distribution. Defaults to 5000.
  var_names : str or list
      A list of names of variables for which to compute the prior predictive
      distribution. Defaults to ``None`` which means to include both observed and
      unobserved RVs.
  random_seed : int
      Seed for the random number generator.
  figsize : tuple
      Figure size. If ``None`` it will be defined automatically.
  textsize : float
      Text size scaling factor for labels, titles and lines. If ``None`` it will be
      autoscaled based on ``figsize``.
  hdi_prob : float or str
      Plots highest density interval for chosen percentage of density.
      Use ``"hide"`` to hide the highest density interval. Defaults to 0.94.
  round_to : int
      Controls formatting of floats. Defaults to 2 or the integer part, whichever is bigger.
  point_estimate : str
      Plot point estimate per variable. Values should be ``"mean"``, ``"median"``, ``"mode"``
      or ``None``. Defaults to ``"auto"`` i.e. it falls back to default set in
      ArviZ's rcParams.
  kind : str
      Type of plot to display (``"kde"`` or ``"hist"``) For discrete variables this argument
      is ignored and a histogram is always used.
  bins : integer or sequence or "auto"
      Controls the number of bins, accepts the same keywords ``matplotlib.pyplot.hist()``
      does. Only works if ``kind == "hist"``. If ``None`` (default) it will use ``"auto"``
      for continuous variables and ``range(xmin, xmax + 1)`` for discrete variables.
  omit_offsets : bool
      Whether to omit offset terms in the plot. Defaults to ``True``.
  omit_group_specific : bool
      Whether to omit group specific effects in the plot. Defaults to ``True``.
  ax : numpy array-like of matplotlib axes or bokeh figures
      A 2D array of locations into which to plot the densities. If not supplied, ArviZ will
      create its own array of plot areas (and return it).
  **kwargs
      Passed as-is to ``matplotlib.pyplot.hist()`` or ``matplotlib.pyplot.plot()`` function
      depending on the value of ``kind``.
  
  Returns
  -------
  axes: matplotlib axes
docstr_tok: ["Samples","from","the","prior","distribution","and","plots","its","marginals",".","Parameters","--","--","--","--","--","draws",":","int","Number","of","draws","to","sample","from","the","prior","predictive","distribution",".","Defaults","to","5000.","var_names",":","str","or","list","A","list","of","names","of","variables","for","which","to","compute","the","prior","predictive","distribution",".","Defaults","to","``","None","``","which","means","to","include","both","observed","and","unobserved","RVs",".","random_seed",":","int","Seed","for","the","random","number","generator",".","figsize",":","tuple","Figure","size",".","If","``","None","``","it","will","be","defined","automatically",".","textsize",":","float","Text","size","scaling","factor","for","labels",",","titles","and","lines",".","If","``","None","``","it","will","be","autoscaled","based","on","``","figsize","``",".","hdi_prob",":","float","or","str","Plots","highest","density","interval","for","chosen","percentage","of","density",".","Use","``","``","hide","''","``","to","hide","the","highest","density","interval",".","Defaults","to","0.94.","round_to",":","int","Controls","formatting","of","floats",".","Defaults","to","2","or","the","integer","part",",","whichever","is","bigger",".","point_estimate",":","str","Plot","point","estimate","per","variable",".","Values","should","be","``","``","mean","''","``",",","``","``","median","''","``",",","``","``","mode","''","``","or","``","None","``",".","Defaults","to","``","``","auto","''","``","i.e",".","it","falls","back","to","default","set","in","ArviZ","'s","rcParams",".","kind",":","str","Type","of","plot","to","display","(","``","``","kde","''","``","or","``","``","hist","''","``",")","For","discrete","variables","this","argument","is","ignored","and","a","histogram","is","always","used",".","bins",":","integer","or","sequence","or","``","auto","''","Controls","the","number","of","bins",",","accepts","the","same","keywords","``","matplotlib.pyplot.hist","(",")","``","does",".","Only","works","if","``","kind","==","``","hist","''","``",".","If","``","None","``","(","default",")","it","will","use","``","``","auto","''","``","for","continuous","variables","and","``","range","(","xmin",",","xmax","+","1",")","``","for","discrete","variables",".","omit_offsets",":","bool","Whether","to","omit","offset","terms","in","the","plot",".","Defaults","to","``","True","``",".","omit_group_specific",":","bool","Whether","to","omit","group","specific","effects","in","the","plot",".","Defaults","to","``","True","``",".","ax",":","numpy","array-like","of","matplotlib","axes","or","bokeh","figures","A","2D","array","of","locations","into","which","to","plot","the","densities",".","If","not","supplied",",","ArviZ","will","create","its","own","array","of","plot","areas","(","and","return","it",")",".","*","*","kwargs","Passed","as-is","to","``","matplotlib.pyplot.hist","(",")","``","or","``","matplotlib.pyplot.plot","(",")","``","function","depending","on","the","value","of","``","kind","``",".","Returns","--","--","--","-","axes",":","matplotlib","axes"]
code: def plot_priors(
      self,
      draws=5000,
      var_names=None,
      random_seed=None,
      figsize=None,
      textsize=None,
      hdi_prob=None,
      round_to=2,
      point_estimate="mean",
      kind="kde",
      bins=None,
      omit_offsets=True,
      omit_group_specific=True,
      ax=None,
      **kwargs,
  ):
      """
      Samples from the prior distribution and plots its marginals.
  
      Parameters
      ----------
      draws : int
          Number of draws to sample from the prior predictive distribution. Defaults to 5000.
      var_names : str or list
          A list of names of variables for which to compute the prior predictive
          distribution. Defaults to ``None`` which means to include both observed and
          unobserved RVs.
      random_seed : int
          Seed for the random number generator.
      figsize : tuple
          Figure size. If ``None`` it will be defined automatically.
      textsize : float
          Text size scaling factor for labels, titles and lines. If ``None`` it will be
          autoscaled based on ``figsize``.
      hdi_prob : float or str
          Plots highest density interval for chosen percentage of density.
          Use ``"hide"`` to hide the highest density interval. Defaults to 0.94.
      round_to : int
          Controls formatting of floats. Defaults to 2 or the integer part, whichever is bigger.
      point_estimate : str
          Plot point estimate per variable. Values should be ``"mean"``, ``"median"``, ``"mode"``
          or ``None``. Defaults to ``"auto"`` i.e. it falls back to default set in
          ArviZ's rcParams.
      kind : str
          Type of plot to display (``"kde"`` or ``"hist"``) For discrete variables this argument
          is ignored and a histogram is always used.
      bins : integer or sequence or "auto"
          Controls the number of bins, accepts the same keywords ``matplotlib.pyplot.hist()``
          does. Only works if ``kind == "hist"``. If ``None`` (default) it will use ``"auto"``
          for continuous variables and ``range(xmin, xmax + 1)`` for discrete variables.
      omit_offsets : bool
          Whether to omit offset terms in the plot. Defaults to ``True``.
      omit_group_specific : bool
          Whether to omit group specific effects in the plot. Defaults to ``True``.
      ax : numpy array-like of matplotlib axes or bokeh figures
          A 2D array of locations into which to plot the densities. If not supplied, ArviZ will
          create its own array of plot areas (and return it).
      **kwargs
          Passed as-is to ``matplotlib.pyplot.hist()`` or ``matplotlib.pyplot.plot()`` function
          depending on the value of ``kind``.
  
      Returns
      -------
      axes: matplotlib axes
      """
      self._check_built()
  
      unobserved_rvs_names = []
      flat_rvs = []
      for unobserved in self.backend.model.unobserved_RVs:
          if "Flat" in str(unobserved):
              flat_rvs.append(unobserved.name)
          else:
              unobserved_rvs_names.append(unobserved.name)
      if var_names is None:
          var_names = pm.util.get_default_varnames(
              unobserved_rvs_names, include_transformed=False
          )
      else:
          flat_rvs = [fv for fv in flat_rvs if fv in var_names]
          var_names = [vn for vn in var_names if vn not in flat_rvs]
  
      if flat_rvs:
          _log.info(
              "Variables %s have flat priors, and hence they are not plotted",
              ", ".join(flat_rvs),
          )
  
      if omit_offsets:
          var_names = [
              name for name in var_names if not name.endswith("_offset")
          ]
  
      if omit_group_specific:
          group_specific_var_names = [
              name
              for component in self.distributional_components.values()
              for name in component.group_specific_terms
          ]
          var_names = [
              name
              for name in var_names
              if name not in group_specific_var_names
          ]
  
      axes = None
      if var_names:
          # Sort variable names so Intercept is in the beginning
          if "Intercept" in var_names:
              var_names.insert(
                  0, var_names.pop(var_names.index("Intercept"))
              )
          pps = self.prior_predictive(
              draws=draws, var_names=var_names, random_seed=random_seed
          )
  
          axes = plot_posterior(
              pps,
              group="prior",
              var_names=var_names,
              figsize=figsize,
              textsize=textsize,
              hdi_prob=hdi_prob,
              round_to=round_to,
              point_estimate=point_estimate,
              kind=kind,
              bins=bins,
              ax=ax,
              **kwargs,
          )
      return axes
  
imports: import logging
  import warnings
  from copy import deepcopy
  from importlib.metadata import version
  import formulae
  import pymc
  import pandas
  from arviz.plots import plot_posterior
  from bambi.backend import PyMCModel
  from bambi.defaults import get_builtin_family
  from bambi.model_components import ConstantComponent, DistributionalComponent
  from bambi.families import Family, univariate
  from bambi.formula import Formula, check_ordinal_formula
  from bambi.priors import Prior, PriorScaler
  from bambi.transformations import transformations_namespace
  from bambi.utils import clean_formula_lhs, get_aliased_name, get_auxiliary_parameters, indentify, listify, remove_common_intercept, wrapify
label_desc: Use image node_id 10 for calling the Model obj's underlying member method code with example usage: obj.plot_priors(draws, var_names, random_seed, figsize, textsize, hdi_prob, round_to, point_estimate, kind, bins, omit_offsets, omit_group_specific, ax) and returns: axes