{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "from scipy import stats\n", " \n", "df = pd.read_csv(\"9-2_Sample.csv\",index_col=\"名前\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Ttest_1sampResult(statistic=-3.308465799422135, pvalue=0.0036942099833501985)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stats.ttest_1samp(df[\"反復横跳び(1回目)\"],popmean=60)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Ttest_relResult(statistic=3.0455242459636036, pvalue=0.006654790139035558)" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stats.ttest_rel(df[\"反復横跳び(1回目)\"],df[\"反復横跳び(2回目)\"])" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Ttest_indResult(statistic=-1.3457681280292728, pvalue=0.20568502161401878)" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stats.ttest_ind(df[df[\"性別\"]==\"女性\"][\"反復横跳び(1回目)\"],df[df[\"性別\"]==\"男性\"][\"反復横跳び(1回目)\"],equal_var=False)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "BartlettResult(statistic=1.5881897459271868, pvalue=0.2075849593836162)" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stats.bartlett(df[df[\"性別\"]==\"女性\"][\"反復横跳び(1回目)\"],df[df[\"性別\"]==\"男性\"][\"反復横跳び(1回目)\"])" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "WilcoxonResult(statistic=6.0, pvalue=0.015270703918089788)" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stats.wilcoxon(df[\"腕立て伏せ(1回目)\"],df[\"腕立て伏せ(2回目)\"])" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "MannwhitneyuResult(statistic=20.0, pvalue=0.015249132623633525)" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stats.mannwhitneyu(df[df[\"性別\"]==\"女性\"][\"腕立て伏せ(1回目)\"],df[df[\"性別\"]==\"男性\"][\"腕立て伏せ(1回目)\"])" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(0.27777777777777773, 0.5981614526835279, 1, array([[6., 2.],\n", " [9., 3.]]))" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cross = pd.crosstab(df[\"性別\"],df[\"バク転\"])\n", "stats.chi2_contingency(cross)" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
バク転×
性別
女性71
男性84
\n", "
" ], "text/plain": [ "バク転 × ○\n", "性別 \n", "女性 7 1\n", "男性 8 4" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cross" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
性別反復横跳び(1回目)反復横跳び(2回目)腕立て伏せ(1回目)腕立て伏せ(2回目)バク転
名前
Aさん男性534200
Bさん女性425000×
Cさん男性575621×
Dさん男性635941×
Eさん男性625833
Fさん男性535662×
Gさん男性494801×
Hさん女性575411×
Iさん男性535121×
Jさん男性60573530
Kさん女性454200×
Lさん男性565210×
Mさん女性585412×
Nさん女性605631×
Oさん男性585020×
Pさん女性555722×
Qさん男性65565040
Rさん女性474400×
Sさん男性565444×
Tさん女性615800
\n", "
" ], "text/plain": [ " 性別 反復横跳び(1回目) 反復横跳び(2回目) 腕立て伏せ(1回目) 腕立て伏せ(2回目) バク転\n", "名前 \n", "Aさん 男性 53 42 0 0 ○\n", "Bさん 女性 42 50 0 0 ×\n", "Cさん 男性 57 56 2 1 ×\n", "Dさん 男性 63 59 4 1 ×\n", "Eさん 男性 62 58 3 3 ○\n", "Fさん 男性 53 56 6 2 ×\n", "Gさん 男性 49 48 0 1 ×\n", "Hさん 女性 57 54 1 1 ×\n", "Iさん 男性 53 51 2 1 ×\n", "Jさん 男性 60 57 35 30 ○\n", "Kさん 女性 45 42 0 0 ×\n", "Lさん 男性 56 52 1 0 ×\n", "Mさん 女性 58 54 1 2 ×\n", "Nさん 女性 60 56 3 1 ×\n", "Oさん 男性 58 50 2 0 ×\n", "Pさん 女性 55 57 2 2 ×\n", "Qさん 男性 65 56 50 40 ○\n", "Rさん 女性 47 44 0 0 ×\n", "Sさん 男性 56 54 4 4 ×\n", "Tさん 女性 61 58 0 0 ○" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "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.7.4" } }, "nbformat": 4, "nbformat_minor": 2 }