LoginSignup
0
2

More than 1 year has passed since last update.

統計学的検定の論文・レポートの書き方

Posted at

独立二標本データの平均値の差の検定の実施例

いわゆる t 検定 だけど,正確に言うとこういうことになる。

R に用意されている,試料別のひよこの体重を例としてあげる。

Crowder, M. and Hand, D. (1990), Analysis of Repeated Measures, Chapman and Hall (example 5.3)
Hand, D. and Crowder, M. (1996), Practical Longitudinal Data Analysis, Chapman and Hall (table A.2)
Pinheiro, J. C. and Bates, D. M. (2000) Mixed-effects Models in S and S-PLUS, Springer.

The ChickWeight data frame has 578 rows and 4 columns from an experiment on the effect of diet on early growth of chicks.

そのうちから,飼料 1, 飼料 2 で育てられた,21 日目のひよこ 16 羽,10 羽の体重データをもとに検定を行う。

import numpy as np

wt1 = [205, 215, 202, 157, 223, 157, 305, 98, 124, 175, 205, 96, 266, 142, 157, 117]
wt2 = [331, 167, 175, 74, 265, 251, 192, 233, 309, 150]
print(np.mean(wt1), np.std(wt1, ddof=1))
177.75 58.702072649382096
print(np.mean(wt2), np.std(wt2, ddof=1))
214.7 78.1381255640719

結果から導いたわけではなく(これ重要),飼料2で育てられたひよこは体重が重いという仮説がある。

帰無仮説:どちらの飼料で育てようが,体重は同じ。
対立仮説:飼料 2 で育てると体重が重い。
有意水準 5% で,片側検定を行う。

行うことは単純。

from scipy.stats import ttest_ind
ttest_ind(wt1, wt2, equal_var=False, alternative='less')
Ttest_indResult(statistic=-1.2857113549029495, pvalue=0.10881629286792402)

$p$ 値は 0.10881629286792402 である。

結論: $p$ 値 > 有意水準(0.05) なので,帰無仮説は棄却できない。

したがって,「飼料 2 で育てられたひよこは体重が重いとはいえない」が結論。

これ以外,何も必要ない。

検定統計量の導出の計算式も,検定統計量が $t$ 分布に従うという証明も必要ない。そんなのを論文に書いたら,必ず(哀れみを持って)削られる。


0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2