{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 15. MCMC diagnostics\n", "\n", "[Data set download](https://s3.amazonaws.com/bebi103.caltech.edu/data/singer_transcript_counts.csv)\n", "\n", "
\\n\"+\n", " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n", " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n", " \"
\\n\"+\n", " \"\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"
\\n\"+\n",
" \"\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"
\\n\"+\n \"\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"
\\n\"+\n \"<xarray.DataArray 'acceptance_rate' (chain: 4, draw: 1000)>\n", "array([[0.902415, 0.740293, 1. , ..., 0.709254, 0.99041 , 0.971677],\n", " [0.989226, 0.650523, 1. , ..., 0.83018 , 0.974857, 1. ],\n", " [0.994868, 0.993086, 0.96721 , ..., 1. , 0.873452, 0.973452],\n", " [0.99621 , 0.705956, 1. , ..., 0.677668, 0.97205 , 0.86905 ]])\n", "Coordinates:\n", " * chain (chain) int64 0 1 2 3\n", " * draw (draw) int64 0 1 2 3 4 5 6 7 8 ... 992 993 994 995 996 997 998 999
<xarray.Dataset>\n", "Dimensions: ()\n", "Data variables:\n", " log10_alpha float64 1.004\n", " log10_b float64 1.004\n", " alpha float64 1.004\n", " b float64 1.004\n", " beta_ float64 1.004
\n", " | mean | \n", "sd | \n", "hdi_3% | \n", "hdi_97% | \n", "mcse_mean | \n", "mcse_sd | \n", "ess_bulk | \n", "ess_tail | \n", "r_hat | \n", "
---|---|---|---|---|---|---|---|---|---|
log10_alpha | \n", "0.652 | \n", "0.040 | \n", "0.579 | \n", "0.730 | \n", "0.001 | \n", "0.001 | \n", "768.0 | \n", "633.0 | \n", "1.0 | \n", "
log10_b | \n", "1.222 | \n", "0.042 | \n", "1.141 | \n", "1.301 | \n", "0.002 | \n", "0.001 | \n", "750.0 | \n", "695.0 | \n", "1.0 | \n", "
alpha | \n", "4.511 | \n", "0.420 | \n", "3.703 | \n", "5.262 | \n", "0.016 | \n", "0.011 | \n", "768.0 | \n", "633.0 | \n", "1.0 | \n", "
b | \n", "16.765 | \n", "1.635 | \n", "13.678 | \n", "19.795 | \n", "0.060 | \n", "0.042 | \n", "750.0 | \n", "695.0 | \n", "1.0 | \n", "
beta_ | \n", "0.060 | \n", "0.006 | \n", "0.049 | \n", "0.071 | \n", "0.000 | \n", "0.000 | \n", "750.0 | \n", "695.0 | \n", "1.0 | \n", "
\n", " | mean | \n", "sd | \n", "hdi_3% | \n", "hdi_97% | \n", "mcse_mean | \n", "mcse_sd | \n", "ess_bulk | \n", "ess_tail | \n", "r_hat | \n", "
---|---|---|---|---|---|---|---|---|---|
log10_alpha | \n", "0.335 | \n", "0.248 | \n", "-0.029 | \n", "0.694 | \n", "0.121 | \n", "0.092 | \n", "4.0 | \n", "4.0 | \n", "3.55 | \n", "
log10_b | \n", "1.377 | \n", "0.935 | \n", "0.079 | \n", "2.706 | \n", "0.465 | \n", "0.356 | \n", "4.0 | \n", "4.0 | \n", "10.93 | \n", "
alpha | \n", "2.509 | \n", "1.299 | \n", "0.935 | \n", "4.941 | \n", "0.635 | \n", "0.484 | \n", "4.0 | \n", "4.0 | \n", "5.40 | \n", "
b | \n", "139.526 | \n", "213.029 | \n", "1.199 | \n", "508.306 | \n", "105.943 | \n", "81.105 | \n", "4.0 | \n", "4.0 | \n", "10.93 | \n", "
beta_ | \n", "0.232 | \n", "0.348 | \n", "0.002 | \n", "0.834 | \n", "0.173 | \n", "0.133 | \n", "4.0 | \n", "4.0 | \n", "10.93 | \n", "
\n", " | mean | \n", "sd | \n", "hdi_3% | \n", "hdi_97% | \n", "mcse_mean | \n", "mcse_sd | \n", "ess_bulk | \n", "ess_tail | \n", "r_hat | \n", "
---|---|---|---|---|---|---|---|---|---|
log10_alpha | \n", "0.652 | \n", "0.040 | \n", "0.579 | \n", "0.730 | \n", "0.001 | \n", "0.001 | \n", "768.0 | \n", "633.0 | \n", "1.0 | \n", "
log10_b | \n", "1.222 | \n", "0.042 | \n", "1.141 | \n", "1.301 | \n", "0.002 | \n", "0.001 | \n", "750.0 | \n", "695.0 | \n", "1.0 | \n", "
alpha | \n", "4.511 | \n", "0.420 | \n", "3.703 | \n", "5.262 | \n", "0.016 | \n", "0.011 | \n", "768.0 | \n", "633.0 | \n", "1.0 | \n", "
b | \n", "16.765 | \n", "1.635 | \n", "13.678 | \n", "19.795 | \n", "0.060 | \n", "0.042 | \n", "750.0 | \n", "695.0 | \n", "1.0 | \n", "
beta_ | \n", "0.060 | \n", "0.006 | \n", "0.049 | \n", "0.071 | \n", "0.000 | \n", "0.000 | \n", "750.0 | \n", "695.0 | \n", "1.0 | \n", "
<xarray.DataArray 'diverging' (chain: 4, draw: 1000)>\n", "array([[False, False, False, ..., False, False, False],\n", " [False, False, False, ..., False, False, False],\n", " [False, False, False, ..., False, False, False],\n", " [False, False, False, ..., False, False, False]])\n", "Coordinates:\n", " * chain (chain) int64 0 1 2 3\n", " * draw (draw) int64 0 1 2 3 4 5 6 7 8 ... 992 993 994 995 996 997 998 999
<xarray.DataArray 'tree_depth' (chain: 4, draw: 1000)>\n", "array([[2, 1, 1, ..., 3, 3, 2],\n", " [2, 2, 1, ..., 2, 3, 3],\n", " [4, 2, 2, ..., 3, 2, 3],\n", " [5, 2, 2, ..., 2, 2, 3]])\n", "Coordinates:\n", " * chain (chain) int64 0 1 2 3\n", " * draw (draw) int64 0 1 2 3 4 5 6 7 8 ... 992 993 994 995 996 997 998 999
<xarray.DataArray 'energy' (chain: 4, draw: 1000)>\n", "array([[1380.45, 1381.54, 1381.01, ..., 1381.01, 1379.05, 1378.48],\n", " [1378.3 , 1379.59, 1379.27, ..., 1378.72, 1377.73, 1377.44],\n", " [1378.8 , 1378.84, 1378.84, ..., 1379.43, 1379.94, 1380.68],\n", " [1377.8 , 1379. , 1378.49, ..., 1379.64, 1380.28, 1380.24]])\n", "Coordinates:\n", " * chain (chain) int64 0 1 2 3\n", " * draw (draw) int64 0 1 2 3 4 5 6 7 8 ... 992 993 994 995 996 997 998 999