Commit 91fd7ece authored by rhaase's avatar rhaase

added exercise solution for otsu hypothesis testing

parent 68ac0fa3
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 199.127197\n",
"1 469.055176\n",
"2 782.623291\n",
"3 990.295410\n",
"4 1100.158691\n",
"5 1150.970459\n",
"6 1173.553467\n",
"7 1184.692383\n",
"8 1190.338135\n",
"9 1185.302734\n",
"10 1189.270020\n",
"11 1192.169189\n",
"12 1206.970215\n",
"13 1242.980957\n",
"14 1277.008057\n",
"15 1309.814453\n",
"16 1334.838867\n",
"17 1371.765137\n",
"18 1375.122070\n",
"19 1315.155029\n",
"20 1172.790527\n",
"21 917.663574\n",
"22 587.005615\n",
"23 224.304199\n",
"24 128.479004\n",
"Name: # Area, dtype: float64\n",
"0 197.601\n",
"1 468.292\n",
"2 780.640\n",
"3 988.770\n",
"4 1099.396\n",
"5 1148.682\n",
"6 1172.485\n",
"7 1183.167\n",
"8 1188.507\n",
"9 1183.472\n",
"10 1187.134\n",
"11 1189.117\n",
"12 1205.750\n",
"13 1238.708\n",
"14 1275.330\n",
"15 1307.678\n",
"16 1331.329\n",
"17 1369.019\n",
"18 1373.444\n",
"19 1313.019\n",
"20 1171.265\n",
"21 915.527\n",
"22 584.717\n",
"23 222.931\n",
"24 127.411\n",
"Name: Area, dtype: float64\n"
]
}
],
"source": [
"import pandas as pd\n",
"\n",
"# Load data\n",
"table_otsu_python = pd.read_csv(\"otsu_python.csv\", delimiter=',')\n",
"table_otsu_imagej = pd.read_csv(\"otsu_imagej.csv\", delimiter=',')\n",
"\n",
"# read out columns\n",
"measurement_python = table_otsu_python[\"# Area\"];\n",
"measurement_imagej = table_otsu_imagej[\"Area\"];\n",
"\n",
"print(measurement_python)\n",
"print(measurement_imagej)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First we determine the mean of both measurementsand compare them"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Python: 1010.858154296875\n",
"ImageJ: 1008.93564\n",
"Difference: 1.9225142968749651\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"mean_python = np.mean(measurement_python)\n",
"mean_imagej = np.mean(measurement_imagej)\n",
"\n",
"print(\"Python: \" + str(mean_python))\n",
"print(\"ImageJ: \" + str(mean_imagej))\n",
"\n",
"print(\"Difference: \" + str(mean_python - mean_imagej))\n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Then we have a look at the histograms for the measurement"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAM90lEQVR4nO3db4xl9V3H8ffH3dKytARwh0pZ1gFDSIgPBCcKxTQGWqVAoA98QCNKtWYfWWnV1G2INj4DbWprNJoNUNEipKFoCUSF0DaNSV3d5U9ZWBAoW1i6dLdpbFETgfTrg3uwwzA7Mzv3zsz92vcrmdxzfvecez735t7Pnjn3nJ1UFZKkfn5kowNIklbHApekpixwSWrKApekpixwSWpq83pubOvWrTU7O7uem5Sk9vbu3fvtqppZOL6uBT47O8uePXvWc5OS1F6Sbyw27iEUSWrKApekpixwSWrKApekpixwSWrKApekppYt8CS3JDmcZN+8sVOS3J/kqeH25LWNKUlaaCV74H8FXLpgbCfwQFWdDTwwzEuS1tGyBV5VXwG+s2D4KuDWYfpW4H0TziVJWsZqr8R8e1UdAqiqQ0lOPdqCSXYAOwC2b9++ys1J+v9kdue9G7LdAzdcviHbXStr/iVmVe2qqrmqmpuZecOl/JKkVVptgX8ryWkAw+3hyUWSJK3Eagv8buD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WrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWpq7AJPsinJQ0numUQgSdLKTGIP/Dpg/wQeR5J0DMYq8CTbgMuBmyYTR5K0UuPugX8K+Cjw/aMtkGRHkj1J9hw5cmTMzUmSXrPqAk9yBXC4qvYutVxV7aqquaqam5mZWe3mJEkLjLMHfhFwZZIDwB3AxUk+O5FUkqRlrbrAq+pjVbWtqmaBq4EvVtU1E0smSVqS54FLUlObJ/EgVfVl4MuTeCxJ0sq4By5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktTUqgs8yRlJvpRkf5LHklw3yWCSpKVtHmPdV4HfqaoHk7wN2Jvk/qp6fELZJElLWPUeeFUdqqoHh+mXgP3A6ZMKJkla2jh74P8nySxwHrB7kft2ADsAtm/fPonNrbvZnfduyHYP3HD5hmxXPxw26n2tyRn7S8wkbwU+D3y4qr638P6q2lVVc1U1NzMzM+7mJEmDsQo8yZsYlfdtVXXXZCJJklZinLNQAtwM7K+qT04ukiRpJcbZA78I+BXg4iQPDz+XTSiXJGkZq/4Ss6r+GcgEs0iSjoFXYkpSUxa4JDVlgUtSUxa4JDVlgUtSUxa4JDVlgUtSUxa4JDVlgUtSUxa4JDVlgUtSUxa4JDVlgUtSUxa4JDVlgUtSUxP5o8brwT/Aun58raUe3AOXpKYscElqygKXpKYscElqygKXpKYscElqygKXpKYscElqygKXpKYscElqygKXpKYscElqygKXpKYscElqygKXpKYscElqygKXpKbGKvAklyZ5MsnTSXZOKpQkaXmrLvAkm4A/B94LnAu8P8m5kwomSVraOHvgPwM8XVVfr6qXgTuAqyYTS5K0nHH+qPHpwPPz5g8CP7twoSQ7gB3D7H8meX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b3ImNj5+1Q4FN5yX6SNzEq79uq6q5h+FvDr0QMt4eH8Y18DhcBVyY5wOjw08VJPjulWV/b/sGq2j3M38mo0Kcx77uBZ6vqSFW9AtwFvHNKs853rPkO8oNDF/PH10WSa4ErgF8eDjPAdGb9CUb/mD8yfN62AQ8m+THWKG+HAp+6S/aHb4lvBvZX1Sfn3XU3cO0wfS3whXnjVyd5c5IzgbMZfXGx5qrqY1W1rapmGb12X6yqa6Yx65D3ReD5JOcMQ5cAj09p3ueAC5JsGd4TlzD6PmQas853TPmGwywvJblgeJ6/Om+dNZXkUuD3gCur6r8XPIepylpVj1bVqVU1O3zeDjI62eHFNcu7Ft/OTvoHuIzRmR7PANdPQZ6fY/RrzteAh4efy4AfBR4AnhpuT5m3zvVD/idZo2/FV5D75/nBWShTmxX4KWDP8Pr+PXDytOYF/hB4AtgH/A2jswymJitwO6Pj868MhfLB1eQD5obn+AzwZwxXca9D1qcZHTt+7XP2l9OQ9Wh5F9x/gOEslLXK66X0ktRUh0MokqRFWOCS1JQFLklNWeCS1JQFLklNWeCS1JQFLklN/S+XdtUPAYl3EgAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAM90lEQVR4nO3db4xl9V3H8ffH3dKytARwh0pZ1gFDSIgPBCcKxTQGWqVAoA98QCNKtWYfWWnV1G2INj4DbWprNJoNUNEipKFoCUSF0DaNSV3d5U9ZWBAoW1i6dLdpbFETgfTrg3uwwzA7Mzv3zsz92vcrmdxzfvecez735t7Pnjn3nJ1UFZKkfn5kowNI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6vql5IcB2yZQCZJ0gqsusCTnAi8C/gAQFW9DLw8mViSpOWMcwjlLOAI8JkkDyW5KckJE8olSVrGOIdQNgPnAx+qqt1JPg3sBH5//kJJdgA7ALZv3z7G5iRpPLM7792wbR+44fKJP+Y4e+AHgYNVtXuYv5NRob9OVe2qqrmqmpuZmRljc5Kk+VZd4FX1IvB8knOGoUuAxyeSSpK0rHHPQvkQcNtwBsrXgV8bP5IkaSXGKvCqehiYm1AWSdIx8EpMSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWpq7AJPsinJQ0numUQgSdLKTGIP/Dpg/wQeR5J0DMYq8CTbgMuBmyYTR5K0UuPugX8K+Cjw/aMtkGRHkj1J9hw5cmTMzUmSXrPqAk9yBXC4qvYutVxV7aqquaqam5mZWe3mJEkLjLMHfhFwZZIDwB3AxUk+O5FUkqRlrbrAq+pjVbWtqmaBq4EvVtU1E0smSVqS54FLUlObJ/EgVfVl4MuTeCxJ0sq4By5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktTUqgs8yRlJvpRkf5LHklw3yWCSpKVtHmPdV4HfqaoHk7wN2Jvk/qp6fELZJElLWPUeeFUdqqoHh+mXgP3A6ZMKJkla2jh74P8nySxwHrB7kft2ADsAtm/fPonNrbvZnfduyHYP3HD5hmxXPxw26n2tyRn7S8wkbwU+D3y4qr638P6q2lVVc1U1NzMzM+7mJEmDsQo8yZsYlfdtVXXXZCJJklZinLNQAtwM7K+qT04ukiRpJcbZA78I+BXg4iQPDz+XTSiXJGkZq/4Ss6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NGuev562zplmr6r6qenWY/RdG15tseNaj5R38CfBRXn9h45rk7VDgi12yf/oGZXmDJLPAecBu4O1VdQhGJQ+cOiy20c/hU4zeUN+fNzatWc8CjgCfGQ753JTkhGnMW1UvAJ8AngMOAd+tqvumMesCx5rv9GF64fh6+3VGe6gwpVmTXAm8UFWPLLhrTfJ2KPAVXbK/EZK8Ffg88OGq+t5Siy4yti7PIckVwOGq2rvSVRYZW8/XezOjX0v/oqrOA/6L0a/5R7ORr+3JjPaszgTeAZyQ5JqlVllkbCrey4Oj5dvw3EmuB14FbnttaJHFNjRrki3A9cAfLHb3ImNj5+1Q4FN5yX6SNzEq79uq6q5h+FvDr0QMt4eH8Y18DhcBVyY5wOjw08VJPjulWV/b/sGq2j3M38mo0Kcx77uBZ6vqSFW9AtwFvHNKs853rPkO8oNDF/PH10WSa4ErgF8eDjPAdGb9CUb/mD8yfN62AQ8m+THWKG+HAp+6S/aHb4lvBvZX1Sfn3XU3cO0wfS3whXnjVyd5c5IzgbMZfXGx5qrqY1W1rapmGb12X6yqa6Yx65D3ReD5JOcMQ5cAj09p3ueAC5JsGd4TlzD6PmQas853TPmGwywvJblgeJ6/Om+dNZXkUuD3gCur6r8XPIepylpVj1bVqVU1O3zeDjI62eHFNcu7Ft/OTvoHuIzRmR7PANdPQZ6fY/RrzteAh4efy4AfBR4AnhpuT5m3zvVD/idZo2/FV5D75/nBWShTmxX4KWDP8Pr+PXDytOYF/hB4AtgH/A2jswymJitwO6Pj868MhfLB1eQD5obn+AzwZwxXca9D1qcZHTt+7XP2l9OQ9Wh5F9x/gOEslLXK66X0ktRUh0MokqRFWOCS1JQFLklNWeCS1JQFLklNWeCS1JQFLklN/S+XdtUPAYl3EgAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"def draw_histogram(data):\n",
" counts, bins = np.histogram(data, bins=10, range=(0,1400))\n",
" plt.hist(bins[:-1], bins, weights=counts)\n",
" #plt.axis([0, 10, 0, 4])\n",
" plt.show()\n",
" \n",
"draw_histogram(measurement_python)\n",
"draw_histogram(measurement_imagej)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We should also plot them against each other in a scatter plot to get a first impression on they relate to each other"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD4CAYAAAAAczaOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO3dd3gVZfrG8e9DCk1AurQIKuKC3QjYWDuoCFjXjqsulyt2XZEliq6wq2tHVwXRFZUi6qooohS7P4oUEUQjIIiRkigqRZOQ5Pn9MePuEYNIkpM5J+f+XFeuzHlnJnMfSJ68eWfmHXN3REQkNdSKOoCIiFQfFX0RkRSioi8ikkJU9EVEUoiKvohICkmPOsD2NGvWzNu3bx91DBGRpDJv3ryv3b351u0JX/Tbt2/P3Llzo44hIpJUzOyL8to1vCMikkJU9EVEUoiKvohIClHRFxFJISr6IiIpZLtF38weN7N8M1tczrrrzczNrFlM22AzW2ZmuWbWM6b9IDNbFK4bYWZWdW9DRER+i9/S038C6LV1o5m1A44DVsW0dQbOArqE+zxkZmnh6oeBAUDH8OMXX1NEROJru0Xf3d8B1pez6l7gBiB2bua+wAR3L3L3FcAyoKuZtQIauvtMD+ZyfhLoV+n0IiI10bolMP1WiMPU9xUa0zezPsBX7r5wq1VtgC9jXueFbW3C5a3bt/X1B5jZXDObW1BQUJGIIiLJp6QY3rodRvaA+WNgw1dVfogdLvpmVg8YAtxc3upy2vxX2svl7qPcPdvds5s3/8VdxCIiNUb+hkLOHDmT9Utn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zbmVH87UJl7dur24XEfSEIUGzmlkf4Ct3X7jVqrjkrYlF/zc9fD0qZrYT8Dxwtbtv+LVNy2mrlvdhZr2BfHef91t3KaetOv/N0wn+ZH7Y3Q8ANhMMQWxLlP+2jQl6cB2A1kB9Mzvv13Yppy1hvp/Zdr7Ic5vZEKAEGPtTUzmbRZrVzOoBQ4Cby1tdTlul89bEop+wD183swyCgj/W3f8TNq8L/1wj/Jwftkf5Pg4D+pjZSoLhsaPN7OkEzfrT8fPcfXb4+jmCXwKJmPdYYIW7F7j7FuA/wKEJmjXWjubL43/DKrHt1cLM+gO9gXPDIRBIzKy7E3QAFoY/b22B+Wa2C3HKWxOLfkI+fD08u/4Y8Im73xOzahLQP1zuD7wU036WmdU2sw5AR4KTN3Hn7oPdva27tyf493vD3c9LxKxh3rXAl2bWKWw6BliSoHlXAd3NrF74PXEMwfmdRMwaa4fyhUNAG82se/g+L4jZJ67MrBcwCOjj7j9s9R4SKqu7L3L3Fu7ePvx5yyO44GNt3PLG4wx11B/AiQRXxywHhkSdJ8x0OMGfYB8BH4YfJwJNgRnA0vBzk5h9hoTvIZc4XU3wG3Ifyf+u3knYrMD+wNzw3/dFoHGi5gVuBT4FFgNPEVydkTBZgfEE5xu2hEXo4orkA7LD97gceJBwBoBqyLqMYCz8p5+zRxIh67bybrV+JeHVO/HKq2kYRERSSE0c3hERkW1Q0RcRSSEq+iIiKURFX0Qkhajoi4ikEBV9EZEUoqIvIpJC/h8V3d7czBXOegAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"# plot our data\n",
"plt.plot(measurement_python, measurement_imagej, \"*\")\n",
"# plot another line which corresponds to identidy\n",
"plt.plot([0, 1400], [0, 1400])\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now let's have a look at the Bland-Altman plot"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"# A function for drawing Bland-Altman plots\n",
"# source https://stackoverflow.com/questions/16399279/bland-altman-plot-in-python\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"def bland_altman_plot(data1, data2, *args, **kwargs):\n",
" data1 = np.asarray(data1)\n",
" data2 = np.asarray(data2)\n",
" mean = np.mean([data1, data2], axis=0)\n",
" diff = data1 - data2 # Difference between data1 and data2\n",
" md = np.mean(diff) # Mean of the difference\n",
" sd = np.std(diff, axis=0) # Standard deviation of the difference\n",
"\n",
" plt.scatter(mean, diff, *args, **kwargs)\n",
" plt.axhline(md, color='gray', linestyle='--')\n",
" plt.axhline(md + 1.96*sd, color='gray', linestyle='--')\n",
" plt.axhline(md - 1.96*sd, color='gray', linestyle='--')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAD4CAYAAADmWv3KAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAZqUlEQVR4nO3dcXCU933n8fc38jqR4oASpJ5sSTbQMZorZCp8i2vwDfgMPWQXYmAyjDtKE3K9YZJJb5K7Hr3QzCTX/uPrcZNLUt+ZYZIc8VUXj+oIahhb1JAEkgO7CBAGgkUJpEUC1UKpRHxSE4G/98c+sne1i3YXrfTs8+jzmtlh9/f77bPfn/Tsl0fP893fmrsjIiLx876wAxARkemhBC8iElNK8CIiMaUELyISU0rwIiIxdVdYL1xTU+Pz588P6+VFRCLpxIkT1929tpCxoSX4+fPn09XVFdbLi4hEkpn9XaFjdYpGRCSmlOBFRGJKCV5EJKaU4EVEYkoJXkQkpkKrohERmUl7T/Wx40APV4dGua+6km1rm9iwtD7ssKaVEryI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E9nLxb0gd0UJE5mBmHwP63P30hK6Sxx/7BG9m9wDfA77g7jcmG5qjLdQaUjNbB7zl7icKfUqOtrDrYO8i9Sfqc+6+FPh/pE4N3E7ZzSE4T/0UqT+b7wM+aGafmOwpOdrC/j3kc7uYy3YuZvYl4CbQNt6UY1hZzcHMqoAvAV/O1Z2jbUrxxzrBm1mCVHJvc/eOoPkfgj95CP59K2jvJXVebFwDqT/Dw/Qo8DEz+xnwAvC4mf0F0ZpDL9Dr7q8Hj18klfCjNIc1wGV3H3D3MaADWEG05jCu2Jh7ee8USHp7qMzsU8A6oDU4bQHRmMOvkzpQOB28rxuAk2ZWxzTEH9sEH1xl/hZw3t2/mtb1EvCp4P6ngL9Ka3/azN5vZguAB0ld2AiNu2939wZ3nw88DXzf3T9BtObQD1wxs6agaTXwEyI0B1KnZh4xs6pgv1pN6ppOlOYwrqiYg9M4vzCzR4K5fzLtOaEwsxbgPwEfc/eRtK6yn4O7n3H3X3P3+cH7updUMUj/tMQ/E1eSw7gB/5LUnzFvAN3B7UlgHnAI+Nvg34+kPedLpK5c9zCDlQIFzucx3quiidQcgGagK/hd7AU+HME5/AnwJnAW+N+kKh3Keg7Ad0ldMxgLEsnv30nMQDKY90+BZwk+AR/iHC6SOlc9/r7eWa5zyBX/hP6fEVTRTEf8WqpARCSmYnuKRkRktlOCFxGJKSV4EZGYUoIXEYkpJXgRkZhSghcRiSkleBGRmPr/b6M1G5p7l9MAAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# draw a Bland-Altman plot\n",
"bland_altman_plot(measurement_python, measurement_imagej)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The cofindence interval"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0.3143669053595717, 3.530661688390393]\n"
]
}
],
"source": [
"data1 = measurement_python\n",
"data2 = measurement_imagej\n",
"\n",
"mean = np.mean([data1, data2], axis=0)\n",
"diff = data1 - data2 # Difference between data1 and data2\n",
"md = np.mean(diff) # Mean of the difference\n",
"sd = np.std(diff, axis=0) # Standard deviation of the difference\n",
"\n",
"CI = [md - 2 * sd, md+2*sd]\n",
"\n",
"print(CI)"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.47051036223078757,\n",
" (0.1097795345763236, 0.4565209578658961, 48.0),\n",
" (-0.0743754713943518, 0.47051036223078757, 48.0))"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from statsmodels.stats.weightstats import ttost_ind\n",
"\n",
"pval = ttost_ind(measurement_python, measurement_imagej, low=-10, upp=10)\n",
"\n",
"pval"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Reject null-hypothesis: Difference is above limit\n",
"Reject null-hypothesis: Difference is below -limit\n"
]
},
{
"data": {
"text/plain": [
"[[-49.213693923012265, 1.289351642345751e-25],\n",
" [72.64029810317597, 1.19906617345889e-29]]"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from scipy import stats\n",
"\n",
"def equivalence_ttest_rel(x1, x2, limit):\n",
" alpha = 0.05\n",
" \n",
" # print(x1)\n",
" # print(x2)\n",
" # print(x1 - x2)\n",
"\n",
" # less than test:\n",
" \n",
" t1, p_value1 = stats.ttest_1samp(x1 - x2, limit)\n",
" if p_value1 / 2 < alpha and t1 < 0:\n",
" print(\"Reject null-hypothesis: Difference is above limit\")\n",
"\n",
" # greater than test:\n",
" t2, p_value2 = stats.ttest_1samp(x1 - x2, -limit)\n",
" if p_value2 / 2 < alpha and t2 > 0:\n",
" print(\"Reject null-hypothesis: Difference is below -limit\")\n",
"\n",
" # return the maximum p_value from both test \n",
" # representing the worst case scenario\n",
" return [ \n",
" [t1, p_value1],\n",
" [t2, p_value2]\n",
" ]\n",
"\n",
"tolerance = 10\n",
"equivalence_ttest_rel(measurement_python, measurement_imagej, tolerance)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment