Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed trivial conflict in gelman.r
  • Loading branch information
jet08013 committed Apr 15, 2018
2 parents 98b9462 + f8632e3 commit 0cc1f7c
Show file tree
Hide file tree
Showing 6 changed files with 352 additions and 300 deletions.
267 changes: 51 additions & 216 deletions BDA 3.10.11.ipynb
Expand Up @@ -179,7 +179,11 @@
},
{
"cell_type": "code",
<<<<<<< HEAD
"execution_count": 5,
=======
"execution_count": 9,
>>>>>>> f8632e30fe8b89896ed0fbf258653883205028de
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -205,7 +209,11 @@
},
{
"cell_type": "code",
<<<<<<< HEAD
"execution_count": 6,
=======
"execution_count": 10,
>>>>>>> f8632e30fe8b89896ed0fbf258653883205028de
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -240,7 +248,11 @@
},
{
"cell_type": "code",
<<<<<<< HEAD
"execution_count": 7,
=======
"execution_count": 11,
>>>>>>> f8632e30fe8b89896ed0fbf258653883205028de
"metadata": {
"scrolled": true
},
Expand Down Expand Up @@ -282,6 +294,7 @@
},
{
"cell_type": "code",
<<<<<<< HEAD
"execution_count": 9,
"metadata": {},
"outputs": [],
Expand All @@ -293,17 +306,27 @@
{
"cell_type": "code",
"execution_count": 16,
=======
"execution_count": 58,
>>>>>>> f8632e30fe8b89896ed0fbf258653883205028de
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
<<<<<<< HEAD
"1.437043700373185 [0.68945124 0.99000008 1.26005551 1.65286899 3.30679651]\n"
=======
"With Rounding\n",
"mu: 10.40618592964824 0.49106811542637807 [ 9.10552764 10.01005025 10.38693467 10.7638191 11.74371859]\n",
"sigma: 1.3555419607805625 0.5063610652735683 [0.61111977 0.90438284 1.18631786 1.55614414 3.30679651]\n"
>>>>>>> f8632e30fe8b89896ed0fbf258653883205028de
]
}
],
"source": [
<<<<<<< HEAD
"Psigma=list(map(sum,np.exp(Z2-np.max(Z2))))\n",
"p=Psigma/sum(Psigma)\n",
"s=np.random.choice(np.exp(np.linspace(-2,4,200)),p=p,size=10000)\n",
Expand Down Expand Up @@ -338,233 +361,45 @@
"source": [
"p=[1/3,1/3]\n",
"p.append([1/200.0]*198)\n"
=======
"print('With Rounding')\n",
"Pmu=list(map(np.sum,np.exp(Z1-np.max(Z1)).T))\n",
"p=Pmu/np.sum(Pmu)\n",
"mu_samples=np.random.choice(np.linspace(3,18,200),p=p,size=5000)\n",
"print('mu:',np.mean(mu_samples),np.var(mu_samples),np.percentile(mu_samples,q=[2.5,25,50,75,97.5]))\n",
"Psigma=list(map(np.sum,np.exp(Z1-np.max(Z1))))\n",
"p=Psigma/np.sum(Psigma)\n",
"sigma_samples=np.random.choice(np.exp(np.linspace(-2,4,200)),p=p,size=5000)\n",
"print('sigma:',np.mean(sigma_samples),np.var(sigma_samples),np.percentile(sigma_samples,q=[2.5,25,50,75,97.5]))\n"
>>>>>>> f8632e30fe8b89896ed0fbf258653883205028de
]
},
{
"cell_type": "code",
"execution_count": 181,
"execution_count": 55,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[0.3333333333333333,\n",
" 0.3333333333333333,\n",
" [0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005,\n",
" 0.005]]"
]
},
"execution_count": 181,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"Ignoring Rounding\n",
"mu: 10.3954824120603 0.49760868662407504 [ 9.03015075 10.01005025 10.38693467 10.7638191 11.81909548]\n",
"sigma: 1.4352129437474488 0.5752559640752803 [0.68945124 0.99000008 1.26005551 1.65286899 3.30679651]\n"
]
}
],
"source": [
"p"
"print('Ignoring Rounding')\n",
"Pmu=list(map(np.sum,np.exp(Z2-np.max(Z2)).T))\n",
"p=Pmu/np.sum(Pmu)\n",
"s=np.random.choice(np.linspace(3,18,200),p=p,size=5000)\n",
"print('mu:',np.mean(s),np.var(s),np.percentile(s,q=[2.5,25,50,75,97.5]))\n",
"Psigma=list(map(np.sum,np.exp(Z2-np.max(Z2))))\n",
"p=Psigma/np.sum(Psigma)\n",
"s=np.random.choice(np.exp(np.linspace(-2,4,200)),p=p,size=5000)\n",
"print('sigma:',np.mean(s),np.var(s),np.percentile(s,q=[2.5,25,50,75,97.5]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 0cc1f7c

Please sign in to comment.