Skip to content

Instantly share code, notes, and snippets.

@nogawanogawa
Last active August 29, 2021 15:40
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 nogawanogawa/59dabc33fc091b2208f0af3e4d6975c4 to your computer and use it in GitHub Desktop.
Save nogawanogawa/59dabc33fc091b2208f0af3e4d6975c4 to your computer and use it in GitHub Desktop.
mannwhitneyu.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Untitled22.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyMKc2s81jdxn4lff+hDcadv",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/nogawanogawa/59dabc33fc091b2208f0af3e4d6975c4/untitled22.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"metadata": {
"id": "YiM4e4zNeZmW"
},
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"from scipy import stats"
],
"execution_count": 1,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "sK3N0plNkiqQ"
},
"source": [
"A = np.random.normal(loc=70, scale=10.0, size=100).astype(int) # 平均を70点と想定\n",
"B = np.random.normal(loc=60, scale=10.0, size=150).astype(int) # 平均を60点と想定"
],
"execution_count": 2,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "b2RDdZ_0iKDu",
"outputId": "d181db1d-03f2-4772-f39f-92dfcb8c2f61"
},
"source": [
"A"
],
"execution_count": 3,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([73, 88, 52, 75, 53, 72, 99, 72, 86, 78, 64, 64, 63, 64, 60, 83, 75,\n",
" 76, 77, 64, 66, 50, 82, 56, 72, 88, 70, 73, 74, 80, 63, 67, 62, 96,\n",
" 76, 72, 67, 76, 64, 78, 74, 77, 78, 75, 62, 75, 88, 77, 64, 63, 69,\n",
" 80, 84, 67, 81, 64, 81, 64, 57, 54, 83, 87, 65, 66, 75, 86, 75, 51,\n",
" 63, 81, 64, 51, 66, 68, 80, 70, 69, 56, 69, 71, 44, 68, 66, 52, 74,\n",
" 53, 75, 74, 68, 80, 54, 72, 76, 76, 53, 57, 75, 67, 80, 68])"
]
},
"metadata": {},
"execution_count": 3
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "mqiKScsBiKP3",
"outputId": "02e9e41a-6c60-4b44-da0c-3d80c80cd0d3"
},
"source": [
"B"
],
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([79, 61, 76, 50, 58, 61, 59, 60, 83, 59, 55, 69, 77, 47, 48, 48, 81,\n",
" 64, 77, 54, 53, 57, 66, 74, 72, 40, 69, 56, 58, 62, 60, 49, 55, 62,\n",
" 65, 65, 54, 81, 72, 63, 62, 76, 59, 64, 56, 64, 69, 78, 47, 58, 62,\n",
" 62, 73, 64, 79, 49, 73, 51, 43, 59, 62, 56, 63, 68, 69, 62, 65, 61,\n",
" 54, 48, 72, 69, 69, 61, 49, 64, 64, 61, 49, 68, 63, 50, 46, 75, 68,\n",
" 49, 60, 73, 68, 44, 49, 66, 79, 48, 71, 79, 64, 59, 58, 40, 60, 78,\n",
" 37, 62, 60, 53, 47, 61, 53, 54, 46, 43, 56, 56, 60, 65, 61, 49, 52,\n",
" 57, 61, 60, 62, 55, 60, 53, 42, 78, 48, 63, 61, 64, 50, 62, 58, 55,\n",
" 51, 76, 70, 59, 58, 41, 65, 55, 39, 47, 63, 67, 68, 59])"
]
},
"metadata": {},
"execution_count": 4
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "FoORrvHOjtoM",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "b84d716c-1de4-404f-e528-054ec7876501"
},
"source": [
"stats.mannwhitneyu(A, B, alternative='two-sided')"
],
"execution_count": 5,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"MannwhitneyuResult(statistic=11330.5, pvalue=7.859054856897762e-12)"
]
},
"metadata": {},
"execution_count": 5
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "zb9FefbAhYFT"
},
"source": [
""
],
"execution_count": 5,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment