Skip to content

Instantly share code, notes, and snippets.

@JonasMoss
Last active December 4, 2017 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonasMoss/7d59ce4aba99eef9011df9d279392614 to your computer and use it in GitHub Desktop.
Save JonasMoss/7d59ce4aba99eef9011df9d279392614 to your computer and use it in GitHub Desktop.
Selection for significance.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Quantile function under selection for significance"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Assume we conduct a study with an unknown effect $\\theta$, and let\n",
"$Z$ be an estimator of $\\theta$ with known mean, distributed according\n",
"to the usual $N\\left(\\theta,n^{-1}\\right)$. Under no selection for\n",
"significance, $\\sqrt{n}Z\\sim\\varphi\\left(\\sqrt{n}\\theta\\right)$,\n",
"while under selection for significance (with a one-sided test), $\\sqrt{n}Z\\sim\\varphi\\left(\\sqrt{n}\\theta\\right)\\mid_{\\geq c_{\\alpha}}$,\n",
"where $c_{\\alpha}$ is some critical value and ``$|_{\\geq c_{\\alpha}}$''\n",
"denotes a truncated distribution. An example is $c_{\\alpha}=\\Phi\\left(1-\\alpha\\right)$\n",
"for $\\alpha=0.05$, which yields the critical value for a test for\n",
"a postive effect at the $0.05$ level. Anyhow, the quantile function\n",
"of the truncated $Z$ is given by\n",
"\n",
"$$\n",
"Q\\left(p;n,\\theta,\\alpha\\right)=\\theta+\\frac{1}{\\sqrt{n}}\\left(p\\left(1-\\Phi\\left(\\sqrt{n}\\theta-c_{\\alpha}\\right)\\right)+\\Phi\\left(c_{\\alpha}\\right)\\right).\n",
"$$\n",
"This is the case since the quantile function of a normal with mean\n",
"$\\sqrt{n}\\theta$ is $\\sqrt{n}\\theta+\\Phi^{-1}\\left(p\\right)$, while\n",
"the quantile function of a lower truncated distribution at $c_{\\alpha}$\n",
"is given by the solution to $p=\\int_{c_{\\alpha}}^{q}\\frac{f\\left(x\\right)}{1-F\\left(c_{\\alpha}\\right)}dx,$\n",
"so that \n",
"$$\n",
"p\\left(1-F\\left(c_{\\alpha}\\right)\\right)=\\int_{-\\infty}^{q}f\\left(x\\right)dx-\\int_{\\infty}^{c_{\\alpha}}f\\left(x\\right)dx.\n",
"$$\n",
"Rearrange to obtain $p\\left(1-F\\left(c_{\\alpha}\\right)\\right)+F\\left(c_{\\alpha}\\right)=\\int_{-\\infty}^{q}f\\left(x\\right)dx,$\n",
"which is the defining equation of the function $\\sqrt{n}\\theta+\\Phi^{-1}\\left(p\\left(1-F\\left(c_{\\alpha}\\right)\\right)+F\\left(c_{\\alpha}\\right)\\right)$.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment