Skip to content

Instantly share code, notes, and snippets.

@nogawanogawa
Last active August 29, 2021 15:31
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/9e6bc6a7be40508f232b61d66329988f to your computer and use it in GitHub Desktop.
Save nogawanogawa/9e6bc6a7be40508f232b61d66329988f to your computer and use it in GitHub Desktop.
ttest_ind.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Untitled22.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyNOY33lKegmpjOxV4xEne9h",
"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/9e6bc6a7be40508f232b61d66329988f/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": "47adf643-223a-4d4d-fdd4-6a5640732ddb"
},
"source": [
"A"
],
"execution_count": 3,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([ 56, 70, 80, 84, 69, 70, 58, 76, 78, 82, 55, 102, 80,\n",
" 66, 90, 74, 79, 83, 68, 58, 68, 76, 50, 66, 62, 65,\n",
" 65, 59, 74, 92, 57, 54, 73, 71, 76, 69, 51, 62, 58,\n",
" 75, 83, 57, 64, 67, 81, 65, 73, 73, 58, 55, 52, 78,\n",
" 66, 69, 55, 70, 43, 82, 64, 78, 71, 79, 66, 77, 60,\n",
" 74, 74, 87, 75, 84, 63, 76, 39, 66, 76, 75, 73, 70,\n",
" 65, 55, 65, 80, 71, 75, 73, 61, 64, 80, 55, 73, 70,\n",
" 74, 85, 60, 83, 72, 74, 59, 70, 74])"
]
},
"metadata": {},
"execution_count": 3
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "mqiKScsBiKP3",
"outputId": "b0af8d11-fc12-425d-9d81-826533e60601"
},
"source": [
"B"
],
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([32, 59, 59, 69, 73, 59, 70, 71, 70, 51, 81, 79, 53, 51, 57, 73, 48,\n",
" 51, 53, 57, 60, 53, 66, 56, 60, 62, 49, 60, 75, 70, 57, 56, 60, 69,\n",
" 62, 71, 60, 54, 53, 57, 51, 54, 66, 44, 54, 51, 39, 76, 42, 58, 67,\n",
" 43, 64, 44, 69, 53, 70, 63, 69, 61, 55, 58, 49, 43, 65, 59, 65, 51,\n",
" 66, 49, 41, 45, 57, 47, 76, 53, 62, 67, 54, 77, 58, 67, 54, 51, 65,\n",
" 53, 64, 76, 76, 51, 54, 59, 65, 72, 53, 50, 60, 42, 56, 55, 54, 59,\n",
" 67, 51, 61, 76, 85, 64, 58, 65, 72, 42, 70, 64, 57, 48, 59, 69, 58,\n",
" 69, 65, 48, 68, 66, 60, 65, 62, 64, 57, 64, 73, 49, 72, 70, 60, 61,\n",
" 69, 42, 68, 46, 61, 63, 78, 64, 69, 68, 50, 64, 47, 59])"
]
},
"metadata": {},
"execution_count": 4
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "FoORrvHOjtoM",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "3f17d055-f7e2-4d87-f63a-c160b8008f55"
},
"source": [
"stats.ttest_ind(A, B, equal_var=False)"
],
"execution_count": 5,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"Ttest_indResult(statistic=7.261525427997714, pvalue=8.393970563289888e-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