Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
still trying to figure out BDA 5.9.8
  • Loading branch information
jet08013 committed Apr 29, 2018
1 parent 8e76a6b commit 681a084
Showing 1 changed file with 73 additions and 1 deletion.
74 changes: 73 additions & 1 deletion BDA 5.9.8.ipynb
Expand Up @@ -37,7 +37,79 @@
"where \n",
"$$\n",
"c_{m}=\\frac{\\lambda_m p_{m}(\\{y_{i}\\})}{\\sum_{m} \\lambda_m p_{m}(\\{y_{i}\\}}\n",
"$$"
"$$\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In the special case under consideration, $p_1$ is normal with mean $-1$ and $\\sigma=.5$, $p_2$ is normal with mean $1$ and $\\sigma=.5$ and we can set $\\lambda_1=.1$ and $\\lambda_2=.9$. The $p_m(\\{y_{i}\\})$ can be calculated from the $t$ distribution. Drawing a sample of size $10$ from $p_1$ and getting a sample mean of $-.25$ and a sample variance of $1$ gives a $t$-statistics of $\\sqrt{10}(-.25+1)$ in the first case and $\\sqrt{10}(-.25-1)$ in the second. "
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.041664931082753924\n",
"0.0035119750957915393\n"
]
}
],
"source": [
"import numpy as np\n",
"from scipy.stats import norm, t\n",
"t_1=np.sqrt(9)*.75\n",
"t_2=np.sqrt(9)*1.25\n",
"print(t.pdf(t_1,df=9))\n",
"print(t.pdf(t_2,df=9))"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.5655172413793104"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
".1*.041/(.1*.041+.9*.0035)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.43448275862068964"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
".9*.0035/(.1*.041+.9*.0035)"
]
},
{
Expand Down

0 comments on commit 681a084

Please sign in to comment.