Thank you so much for your reply.
I found that az.plot_kde is useful. In my case, I have two parameters: mu and sigma.
I am trying to use it. But i am not successful. I am using the following code.
non_centered = az.load_arviz_data('non_centered_eight')
mu_posterior = np.concatenate(non_centered.posterior["mu"].values)
sigma_posterior = np.concatenate(non_centered.posterior["sigma"].values)
az.plot_kde(mu, values2=sigma, contour=False)
I received the following message
TypeError Traceback (most recent call last)
TypeError: float() argument must be a string or a real number, not ‘TensorVariable’
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
Cell In[111], line 1
----> 1 az.plot_kde(mu, values2=tau, contour=False)
File ~\anaconda3\Lib\site-packages\arviz\plots\kdeplot.py:271, in plot_kde(values, values2, cumulative, rug, label, bw, adaptive, quantiles, rotated, contour, hdi_probs, fill_last, figsize, textsize, plot_kwargs, fill_kwargs, rug_kwargs, contour_kwargs, contourf_kwargs, pcolormesh_kwargs, is_circular, ax, legend, backend, backend_kwargs, show, return_glyph, **kwargs)
269 else:
270 gridsize = (128, 128) if contour else (256, 256)
→ 271 density, xmin, xmax, ymin, ymax = _fast_kde_2d(values, values2, gridsize=gridsize)
273 if hdi_probs is not None:
274 # Check hdi probs are within bounds (0, 1)
275 if min(hdi_probs) <= 0 or max(hdi_probs) >= 1:
File ~\anaconda3\Lib\site-packages\arviz\stats\density_utils.py:808, in _fast_kde_2d(x, y, gridsize, circular)
785 def _fast_kde_2d(x, y, gridsize=(128, 128), circular=False):
786 “”"
787 2D fft-based Gaussian kernel density estimate (KDE).
788
(…)
806 ymax: maximum value of y
807 “”"
→ 808 x = np.asarray(x, dtype=float)
809 x = x[np.isfinite(x)]
810 y = np.asarray(y, dtype=float)
ValueError: setting an array element with a sequence.
Would you provide some advice?
Thanks a lot.