class_docstr: Distribution based on Bernstein Polynomials on unit hypercube.
  
  Parameters
  ----------
  cdf_grid : array_like
      cdf values on a equal spaced grid of the unit hypercube [0, 1]^d.
      The dimension of the arrays define how many random variables are
      included in the multivariate distribution.
  
  Attributes
  ----------
  cdf_grid : grid of cdf values
  prob_grid : grid of cell or bin probabilities
  k_dim : (int) number of components, dimension of random variable
  k_grid : (tuple) shape of cdf_grid
  k_grid_product : (int) total number of bins in grid
  _grid : Grid instance with helper methods and attributes
class_docstr_tok: ["Distribution","based","on","Bernstein","Polynomials","on","unit","hypercube",".","Parameters","--","--","--","--","--","cdf_grid",":","array_like","cdf","values","on","a","equal","spaced","grid","of","the","unit","hypercube","[","0",",","1","]","^d",".","The","dimension","of","the","arrays","define","how","many","random","variables","are","included","in","the","multivariate","distribution",".","Attributes","--","--","--","--","--","cdf_grid",":","grid","of","cdf","values","prob_grid",":","grid","of","cell","or","bin","probabilities","k_dim",":","(","int",")","number","of","components",",","dimension","of","random","variable","k_grid",":","(","tuple",")","shape","of","cdf_grid","k_grid_product",":","(","int",")","total","number","of","bins","in","grid","_grid",":","Grid","instance","with","helper","methods","and","attributes"]
docstr: Get marginal BernsteinDistribution.
  
  Parameters
  ----------
  idx : int or list of int
      Index or indices of the component for which the marginal
      distribution is returned.
  
  Returns
  -------
  BernsteinDistribution instance for the marginal distribution.
docstr_tok: ["Get","marginal","BernsteinDistribution",".","Parameters","--","--","--","--","--","idx",":","int","or","list","of","int","Index","or","indices","of","the","component","for","which","the","marginal","distribution","is","returned",".","Returns","--","--","--","-","BernsteinDistribution","instance","for","the","marginal","distribution","."]
code: def get_marginal(self, idx):
      """Get marginal BernsteinDistribution.
  
      Parameters
      ----------
      idx : int or list of int
          Index or indices of the component for which the marginal
          distribution is returned.
  
      Returns
      -------
      BernsteinDistribution instance for the marginal distribution.
      """
  
      # univariate
      if self.k_dim == 1:
          return self
  
      sl = [-1] * self.k_dim
      if np.shape(idx) == ():
          idx = [idx]
      for ii in idx:
          sl[ii] = slice(None, None, None)
      cdf_m = self.cdf_grid[tuple(sl)]
      bpd_marginal = BernsteinDistribution(cdf_m)
      return bpd_marginal
  
file_path: statsmodels/statsmodels/distributions/bernstein.py
imports: import numpy
  from scipy import stats
  from statsmodels.tools.decorators import cache_readonly
  from statsmodels.distributions.tools import _Grid, cdf2prob_grid, prob2cdf_grid, _eval_bernstein_dd, _eval_bernstein_2d, _eval_bernstein_1d
label_desc: Use image node_id 6 for calling the BernsteinDistribution obj's underlying member method code with example usage: obj.get_marginal(idx) and returns: bpd_marginal, self