{ "metadata": { "name": "Multiple_comparison" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Multiple comparisons" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# first set up inline plotting\n", "%pylab inline " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.kernel.zmq.pylab.backend_inline].\n", "For more information, type 'help(pylab)'.\n" ] } ], "prompt_number": 1 }, { "cell_type": "markdown", "metadata": {}, "source": [ "The problem occurs when you permform several statistical tests: by chance, some will be significant even if the data has been generated under the null hypothesis.\n" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "FWER : Bonferroni" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Imaging you are doing $n$ t tests each one with a risk of type one error of $\\alpha$, and we denote by $t_\\alpha$ the t-value such that for a variable t drawn from a Student distribution, we have $P(t < t_\\alpha) = \\alpha$, the probability of getting at least one significant test is these n tests is : " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\alpha_{F} = P(\\textrm{ one or more } t_i > t_\\alpha) = 1 - \\prod_{i} P(t_i < t_\\alpha) = 1 - (1 - \\alpha)^n \n", "$$ \n", "\n", "$$\n", "\\alpha = 1 -(1 - \\alpha_{F})^{\\frac{1}{n}} = 1 - \\exp\\left(\\frac{1}{n} \\log(1 - \\alpha_{F})\\right)\n", "$$\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# code demo: a t-distribution\n", "from scipy.stats import t as tdist\n", "df = 14\n", "n = 100\n", "alph = .05\n", "\n", "# Often easier to compute the static distribution of t with df : t14 = tdist(df)\n", "# rvs : draw one or several random variables\n", "ts = tdist(df).rvs(size=n)\n", "\n", "# The threshold as a t value: \n", "t_alph = tdist.isf(alph,df)\n", "\n", "print \"Nubmer of test significant at the %f level: %d \" %(alph, sum(ts >= t_alph))" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Nubmer of test significant at the 0.050000 level: 5 \n" ] } ], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "To correct for the number of tests with the Bonferroni correction :" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# if we have p values : \n", "p = tdist(df).sf(ts)\n", "p_corr = (1 - (1 - p)**n)\n", "print \"Number of test significant with uncorrected threshold: %d, corrected: %d \", \\\n", " sum(p <= alph), sum(p_corr <= alph)\n", "\n", "# This can be put in a little function:\n", "def p_corrected(ps):\n", " return( 1 - (1 - p)**n )\n", "\n", "# alternatively : compare orginal p with : 1.0 - exp(1./n * log(1 - .05))\n", "\n", "def alph_corr(alph,n):\n", " return 1.0 - exp(1./n * log(1 - alph))\n", "\n", "print \"Uncorrected threshold: %f, corrected threshold: %f\" % (alph, alph_corr(alph,n))" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Number of test significant with uncorrected threshold: %d, corrected: %d 5 0\n", "Uncorrected threshold: 0.050000, corrected threshold: 0.000513\n" ] } ], "prompt_number": 3 }, { "cell_type": "markdown", "metadata": {}, "source": [ "On average we would have to run about 20 times the previous code to get a (spurious) significant effect.\n", "\n", "Note that when the tests are NOT INDEPENDENT, then this procedure is conservative (on average you will get less false positive than the specified risk or error), and therefore not the most sensitive. " ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "False Discovery Rate " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The false detection rate (introduced by Benjamini and Hochberg (1995), see [http://en.wikipedia.org/wiki/False_discovery_rate] for an history of this measure." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's denote : \n", "\n", "* $S$ the number of true positive\n", "* $V$ the number of false positives (Type I error)\n", "* $R$ is the number of rejected null hypotheses (also called \"discoveries\")\n", "* $Q$ the proportion of false discoveries amongst the discoveries = $\\frac{V}{S+V}$\n", "\n", "We want to control such that $Q = \\frac{V}{S+V} = \\frac{V}{R}$ is small. \n", "\n", "The false discovery rate is the expectation of the false discovery proportion $\\textrm{FDR} = E(Q)$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The procedure : step by step.\n", "\n", "First, we order the p-values by increasing order. We start to test the smallest p-value (the highest t or z), and declare the test significant if its p-value is less than $\\alpha/n$, for instance $0.05/n$. If this test is significant, we test the following pOur new threshold to declare significance is $\\alpha * 2 /n)$. This is iterated, until a test is not significant. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "T_{BH} = \\textrm{max} \\left \\{ { P_{(i)} : P_{(i)} < \\frac{\\alpha i }{n} } \\right \\}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "An intuition : $i \\frac{\\alpha}{n} $ is the expected value if I draw $i$ times in a bernouilli distribution of probability $ \\frac{\\alpha}{n} $ " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's implement this and compare to Bonferroni or uncorrected thresolds:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import scipy.stats as st\n", "norm01 = st.norm(0,1)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "# adapted from nipy/algorithms/statistics/empirical_pvalue\n", "#q = ( (range(n)+1)/n) * 0.05 ) \n", "\n", "def fdr(p_values=None, verbose=0):\n", " \"\"\"Returns the FDR associated with each p value\n", "\n", " Parameters\n", " -----------\n", " p_values : ndarray of shape (n)\n", " The samples p-value\n", "\n", " Returns\n", " -------\n", " q : array of shape(n)\n", " The corresponding fdr values\n", " \"\"\"\n", " #p_values = check_p_values(p_values)\n", " n_samples = p_values.size\n", " order = p_values.argsort()\n", " sp_values = p_values[order]\n", "\n", " # compute q while in ascending order\n", " q = np.minimum(1, n_samples * sp_values / np.arange(1, n_samples + 1))\n", " for i in range(n_samples - 1, 0, - 1):\n", " q[i - 1] = min(q[i], q[i - 1])\n", "\n", " # reorder the results\n", " inverse_order = np.arange(n_samples)\n", " inverse_order[order] = np.arange(n_samples)\n", " q = q[inverse_order]\n", "\n", " if verbose:\n", " import matplotlib.pylab as mp\n", " mp.figure()\n", " mp.xlabel('Input p-value')\n", " mp.plot(p_values, q, '.')\n", " mp.ylabel('Associated fdr')\n", " return q\n", "\n", "\n", "def fdr_threshold(p_values, alpha=0.05):\n", " \"\"\"Return FDR threshold given p values\n", "\n", " Parameters\n", " -----------\n", " p_values : array of shape (n), optional\n", " The samples p-value\n", " alpha : float, optional\n", " The desired FDR significance\n", "\n", " Returns\n", " -------\n", " critical_p_value: float\n", " The p value corresponding to the FDR alpha\n", " \"\"\"\n", " n_samples = np.size(p_values)\n", " sp_values = np.sort(p_values)\n", " p_corr = alpha / n_samples\n", " i = np.arange(1, n_samples + 1) # i from 1 to n_sample\n", " critical_set = sp_values[sp_values < p_corr * i]\n", " if len(critical_set) > 0:\n", " critical_p_value = critical_set.max()\n", " else:\n", " critical_p_value = p_corr\n", " return critical_p_value\n" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 5 }, { "cell_type": "code", "collapsed": false, "input": [ "n = 1000\n", "unif = st.uniform()\n", "p = unif.rvs(size=n)\n", "\n", "q = []\n", "alph = arange(0.01,0.1,0.01)\n", "for a in alph:\n", " q.append(fdr_threshold(p,a))\n", "\n", " \n", "#more elegant: \n", "q = [fdr_threshold(p,a) for a in alph]\n", " \n", "print size(alph), size(q) \n", "plot(alph, q,'--')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "9 9\n" ] }, { "output_type": "pyout", "prompt_number": 6, "text": [ "[]" ] }, { "output_type": "display_data", "png": "iVBORw0KGgoAAAANSUhEUgAAAZMAAAD9CAYAAAB5lZr/AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X9UVPeZP/D3JIztqpuSWBk3M2THzgwM+GOkJYynuxpa\nAwSbTmxNCHhs5kRi3W2UjVqrPU03+kcEdrcnyR5rtPm6FpK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QmCC\n", "text": [ "" ] } ], "prompt_number": 6 }, { "cell_type": "code", "collapsed": false, "input": [ "n = 1000\n", "z = norm01.rvs(size=n)\n", "p = norm01.sf(z)\n", "\n", "print fdr_threshold(p)\n", "print sum(p < fdr_threshold(p))\n", "\n", "q = fdr(p, verbose=1)\n", "\n", "if len(z) <= 20:\n", " order = z.argsort() \n", " print \"z \\n\", z \n", " print \"p \\n\", p \n", " print \"q \\n\", q\n", " print \"sorted z \\n\", z[order]\n", " print \"sorted fdr \\n\", q[order]\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "5e-05\n", "0\n" ] }, { "output_type": "display_data", "png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEMCAYAAADEXsFmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X1YVGXeB/DvwIw+KCgipjJDosIyY8oAgW+BjrWGscn6\nxoq7m2Uo5OambrX51B/B7mbR9nrJVuSqZQbi24qVjC7mFKzKmBj2hBeiiY1UlgmC0QqM5/ljYGCE\ncWbgzAvw/VwXl3Nm7rnPb45wvnPe7iMRBEEAERH1e17uLoCIiDwDA4GIiAAwEIiIqBUDgYiIADAQ\niIioFQOBiIgAOCEQHn74YYwcORKTJk2y2uaxxx5DWFgY1Go1Tp48KXYJRETUDaIHwrJly6DVaq2+\nvn//fpw9exZVVVV4++23sXLlSrFLICKibhA9EOLj4zFs2DCrr+/btw8PPvggAGDKlCmoq6vDpUuX\nxC6DiIgcJHX1DGtqahAcHGyeVigUuHjxIkaOHGnRTiKRuLo0IqI+obsDULjloPLNxVpb+QuCwB9B\nwLPPPuv2Gjzlh8uCy6InywLoDz/d5/JAkMvlMBgM5umLFy9CLpe7ugwSgVIJSCTtP15eltPO+MnM\ndP482n5kMvH68vbuWX8DBji2LKRS1y2n7v6I+fti7+9FX/fSSz17v8sDISkpCVu3bgUAHDt2DP7+\n/p12F1Hv8N13ltNC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VVAKabqHzyySeIjIzEsWPHzKewqtVqeHt7IzIystNBZYlEgtjYWKxa\ntQoTJkzAuHHjMG/evC7nuXjxYuTm5pp3FwHAX//6V0yZMgVxcXFQqVQW/bbV/8QTT+DNN99EdHQ0\nfvzxR/Pzy5cvx4QJExAdHY1JkyZh5cqVVreCiHqCg9tRnzV27FicOHFClNEudTodXn75ZXzwwQci\nVEbkmbiFQH2WmOf4WzsDiKgv4RYCEREB4BYCERG1YiAQEREABgIREbViIBAREQAGAhERtWIgEBER\nAOD/Ad2okmpWJQqYAAAAAElFTkSuQmCC\n", "text": [ "" ] } ], "prompt_number": 7 }, { "cell_type": "code", "collapsed": false, "input": [ "alph = 0.05\n", "df = 14\n", "t14 = tdist(df)\n", "n = 200\n", "ts = t14.rvs(size=n)\n", "# ts = np.sort(ts) # careful of ts = ts.sort() .... you get None !!!\n", "ps = t14.sf(ts)\n", "\n", "#uncorrected :\n", "print 'Uncorrected: ',sum(ps < alph)\n", "\n", "#Bonferroni : \n", "print 'Bonferroni: ',sum(ps < alph_corr(alph,n))\n", "\n", "#FDR : (suppose z)\n", "fdr_alph = fdr_threshold(ps)\n", "print 'FDR: ',sum(ps < fdr_alph)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Uncorrected: 9\n", "Bonferroni: 0\n", "FDR: 0\n" ] } ], "prompt_number": 8 }, { "cell_type": "code", "collapsed": false, "input": [ "# Adding signal :\n", "z = st.norm.rvs(0,1, size=n)\n", "print sum(z>1.5)\n", "z = z[z>1.5]+1\n", "\n", "alph, df, n = 0.05, 14, 100\n", "t14 = tdist(df)\n", "ts = t14.rvs(size=n)\n", "# add some signal : \n", "print \"number of true positive: \", sum(ts > 1.5)\n", "ts[ts > 1.5] += 1.5\n", "ps = t14.sf(ts)\n", "\n", "#uncorrected :\n", "print 'Uncorrected: ',alph, sum(ps < alph)\n", "#Bonferroni : \n", "print 'Bonferroni: ', alph_corr(alph,n), sum(ps < alph_corr(alph,n))\n", "#FDR :\n", "fdr_alph = fdr_threshold(ps)\n", "q = fdr(ps, verbose=1)\n", "print 'FDR: ',fdr_alph, sum(ps < fdr_alph), sum(q <= alph)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "13\n", "number of true positive: 16\n", "Uncorrected: 0.05 16\n", "Bonferroni: 0.000512801416262 0\n", "FDR: " ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 0.00463758728239 15 16\n" ] }, { "output_type": "display_data", "png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEMCAYAAADEXsFmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtQ1XX+x/HX4ZLjBUHTVeFQqLCCKaCJpKVSreGySRdl\npN3NIhNz1y3drc1p/wj7zVY2U20T2yatl8wgLNuwUnI1cTUvmCg02SheKKRJM0UtK/D4/f1xLlyP\n54DnAvh8zDic8/1+zvf75kN9X+f7+d5MhmEYAgBc8QL8XQAAoGMgEAAAkggEAIANgQAAkEQgAABs\nCAQAgCQvBMIDDzygAQMGaOTIkU7bPPzww4qJiVFCQoL27t3r6RIAAO3g8UDIyspScXGx0/nr1q3T\noUOHVFlZqby8PM2dO9fTJQAA2sHjgTBhwgT16dPH6fy1a9fqvvvukyQlJyertrZWx48f93QZAIA2\nCvL1CmtqahQZGel4bzabdezYMQ0YMKBJO5PJ5OvSAKBLaO8NKPxyULl5sc42/oZh8M8w9OSTT/q9\nho7yryv2xezZhiZNMvTrXxu6776G16dPt97GPr21vmitXfP5Awcauuqqpv/Cwgz96letf8ZVzTNn\nOl9na/UMG2YoNNRQv36Ghg5teF1V1fC5xm0aT3f2+zXui9BQQ4GBhgICDF1/fUNb+zK7dTOUnGzI\nbDZ0443O+6rx+hq3tf+NIiOt01pbjrM67f3frVtDn7v6m0dGGhowwPnfq/m6Lnfj7HFHjx41RowY\n0eq8OXPmGAUFBY73w4YNM7755psW7bxUWqf05JN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MzUjh07LrkcV9dojh07VlFRUQoI\nCNA999yjbdu2tWgzY8YMFRYWSpLeeustzZgxQ5L02WefacKECYqPj9ebb76p/fv3u/37bdiwQStX\nrtSoUaN0ww036NSpUzp06JDbnwfc1fVuFI4rTrdu3RyvAwMDdeHChVbb2b99BwUF6eLFi5Kkixcv\nqq6uzq31NP72bhiGTCaT3nvvPS1atEiS9Zv81KlT9cQTT+j06dMqKyvTLbfcIsk6TLV27VqNHDlS\nr7/+umMvorHGdf30009N5uXm5mry5Mlu1Qm0F3sI6NLs39YLCws1fvx4SdZjC/ax+rVr1zruARMS\nEqJz5845XVZpaamqqqp08eJFrV69WhMmTNCdd96pvXv3au/evRo9erR69eqlpKQkPfzww5o6daoj\nRL7//nsNHDhQ9fX1WrVqlWO60ejW3VFRUfr0008lSe+8845jvampqXrllVccQXfw4EGdP3/eY30E\n2BEI6JQaf1u/1Jk6p0+fVkJCgl5++WW9+OKLkqwPUdmyZYsSExO1c+dOxymsCQkJCgwMVGJiYouD\nyiaTSUmaLV/zAAAAtElEQVRJSZo3b56GDx+uIUOG6M4772x1nTNmzFB+fr5juEiS/u///k/Jycm6\n6aabFBcX12S59vofffRR/etf/9Lo0aP13XffOaY/+OCDGj58uEaPHq2RI0dq7ty5TveCgMvBze3Q\nZQ0ePFh79uzxyN0uS0pK9Pzzz+v999/3QGVAx8QeArosT57j7+wMIKArYQ8BACCJPQQAgA2BAACQ\nRCAAAGwIBACAJAIBAGBDIAAAJEn/D2V29zbOX7dsAAAAAElFTkSuQmCC\n", "text": [ "" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Permutations : a quick introduction" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The principle of the permutation is simple: we construct a distribution of the statistics we are interested in under the assumption that there is no signal. For instance, let's take the one sample t-test scenario." ] }, { "cell_type": "code", "collapsed": false, "input": [ "#N subjects, z[i] = effects observed for subject i.\n", "\n", "N = 15\n", "mu, sigma = 0.75, 1.0\n", "normH1 = st.norm(mu, sigma)\n", "z = normH1.rvs(size=N) # a series of z values under H1\n", "\n", "print z" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "[ 0.44980773 0.3049634 0.23894538 0.95284122 0.85829427 2.60215513\n", " 1.47310698 0.4147775 -0.09161498 0.37855162 1.17150395 0.69070465\n", " 3.3456306 0.89502638 0.68098054]\n" ] } ], "prompt_number": 10 }, { "cell_type": "markdown", "metadata": {}, "source": [ "The idea here is the following: if the z are drawn from a normal distribution of mean zero, then there there is as much chance to get a negative value than a positive values (the distribution is symmetric). We can therefore arbitrarily swap the sign of our values and construct the distribution of their mean under this hypothesis. " ] }, { "cell_type": "code", "collapsed": false, "input": [ "psign = np.random.randint(2, size=len(z))\n", "psign[psign==0] = -1\n", "print psign\n", "print z * psign" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "[ 1 -1 1 -1 -1 1 1 1 -1 1 1 1 1 1 1]\n", "[ 0.44980773 -0.3049634 0.23894538 -0.95284122 -0.85829427 2.60215513\n", " 1.47310698 0.4147775 0.09161498 0.37855162 1.17150395 0.69070465\n", " 3.3456306 0.89502638 0.68098054]\n" ] } ], "prompt_number": 11 }, { "cell_type": "code", "collapsed": false, "input": [ "def distrib_under_H0(x, stat, nperm = 1000):\n", " dist = []\n", " for i in xrange(nperm):\n", " psign = np.random.randint(2, size=len(x))\n", " psign[psign==0] = -1\n", " dist.append(stat(x * psign))\n", " return dist\n", "\n", "def my_stat(x):\n", " return(mean(x))\n" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 22 }, { "cell_type": "code", "collapsed": false, "input": [ "d_H0 = distrib_under_H0(z, my_stat)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 23 }, { "cell_type": "code", "collapsed": false, "input": [ "size(d_H0)\n", "hist(d_H0)\n", "mean(z)\n", "empirical_p = 1.0 * sum(d_H0 > mean(z))/size(d_H0)\n", "print my_stat(z), empirical_p" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "0.957711624634 0.0\n" ] }, { "output_type": "display_data", "png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAD9CAYAAABZVQdHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAEMlJREFUeJzt3X9MVfXjx/HXSdinNSFlyZVd/O42gSGISDm0P9hoci3d\nvMOPG4mt7tJay1pr9a30r6CV4h/9UTpn6+vada3UtgK2ktEfXWuWXZe6tV0n1LDgCnfqhYm6Rdr5\n/mG7C4Hr5XJ/cN8+Hxsb3Hvufb89nvvkcjicY9m2bQsAYKR7Mj0BAEDqEHkAMBiRBwCDEXkAMBiR\nBwCDEXkAMFjMyPf39+vRRx9VZWWlli5dqg8++ECSFIlE5Ha7VVZWpjVr1mhkZCT6mF27dqm0tFTl\n5eXq7u5O7ewBADFZsY6THxoa0tDQkJYvX66rV6/q4YcfVnt7uz7++GM98MADeuONN7R7924NDw+r\nra1NwWBQmzdv1smTJxUKhdTQ0KCenh7dcw8/MABAJsSs78KFC7V8+XJJ0ty5c7VkyRKFQiF1dnbK\n6/VKkrxer9rb2yVJHR0dam5uVm5urlwul0pKShQIBFL8TwAATCUn3gXPnz+v06dPa+XKlQqHw3I4\nHJIkh8OhcDgsSbpw4YJWrVoVfUxxcbFCodC457EsKxnzBoC7TiInKIhrP8rVq1e1ceNGvf/++8rL\nyxt3n2VZMcM92X22bfORpI+33nor43Mw5YN1yfqczR+JumPk//rrL23cuFFPPfWUGhsbJd169z40\nNCRJGhwcVGFhoSTJ6XSqv78/+tiBgQE5nc6EJwcAmJmYkbdtW1u3blVFRYVeeeWV6O0ej0c+n0+S\n5PP5ovH3eDw6dOiQxsbG1NfXp97eXtXW1qZw+gCAWGLukz9+/Lg++eQTLVu2TDU1NZJuHSK5fft2\nNTU16cCBA3K5XDpy5IgkqaKiQk1NTaqoqFBOTo727dvHPvgUq6+vz/QUjMG6TC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E23fu3Kn1\n69ff8fHZ+AcGqTTV+nz33XfHfW1Z1pTr7vjx4yoqKtLFixfldrtVXl6uurq6lMw3m8S7rd3+zpNt\ndHLxrJeHHnpI/f39uu+++3T06FE1Njaqp6cnDbMz03S3zaRE/ptvvpnR4zm+frxY69PhcGhoaEgL\nFy7U4OCgCgsLJ12uqKhIkrRgwQJt2LBBgUCAyCu+be32ZQYGBuR0OtM2x2wSz/rMy8uLfr527Vpt\n27ZNkUhEBQUFaZunKRLZNtO6u2aq/XIcXx8/j8cjn88nSfL5fGpsbJywzPXr1zU6OipJunbtmrq7\nu2P+tv5uEs+25vF4dPDgQUnSiRMnNG/evOguMowXz/oMh8PR134gEJBt2wQ+QQltm8n5nfDUvvji\nC7u4uNi+9957bYfDYT/++OO2bdt2KBSy161bF13u66+/tsvKyuzFixfbO3fuTPW0stbly5ft1atX\n26Wlpbbb7baHh4dt2x6/Pn/77Te7urrarq6utisrK1mft5lsW9u/f7+9f//+6DIvvviivXjxYnvZ\nsmVTHhWGW+60Pvfu3WtXVlba1dXV9iOPPGL/+OOPmZzurLZp0ya7qKjIzs3NtYuLi+0DBw7MeNu0\nbJtfewOAqWbF0TUAgNQg8gBgMCIPAAYj8gBgMCIPAAYj8gBgsP8HiFS09+HJC44AAAAASUVORK5C\nYII=\n", "text": [ "" ] } ], "prompt_number": 24 }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this instance, we have a significant p value at the 5 percent risk of error because under the null hypothesis, the actual data statistics is observed less than 5 percent of the times. This framework is \n", "\n", "* powerful : any statistics can be tested\n", "* tricky \n", " - non exangeable data \n", " - what exactly is the null hypothesis tested\n", "* demanding in computing time : make sure we can get a good estimation of the probability" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "How do we deal with multiple comparison using permutations ?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We simply take the distribution of the maximum statistics across tests !\n", "\n", "An example ?" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "FWER : RFT" ] }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 14 } ], "metadata": {} } ] }