土屋 - Researchmap

2011/11/05 第3回 心理・医学系研究者のためのデータ
解析環境Rによる統計学の研究会
初心者による初心者のための
「量的データの二変量解析」
土屋政雄
2014/03/22: 29枚目の引用間違いを修正
1
本日の内容
• 2変量解析とは(連続量)
– Rでやってみる
• 効果量
– 必要性
– 種類と算出方法
– 区間推定
– 相互変換
– Rでやってみる
• 論文での示し方
※一部に初心者編を
逸脱する表現が含まれて
しまったため,該当
スライドには以下の星
マークをつけました
2
2変量解析(連続量)
• 交絡要因を調整した多変量解析(重回帰,共
分散分析など)と比べて,独立変数,従属変
数が共に1つずつの解析
– t検定
– ピアソンの積率相関係数
– 1要因分散分析
• 単変量解析と表記する者もいるが,これは誤
解されやすいのでやめた方がよい
3
t検定
独立な2群の平均値差の検定
# t検定関数のヘルプ確認。exampleより
help(t.test)
# データの図示
plot(extra ~ group, data = sleep)
# groupによるextraのt検定
t.test(extra ~ group, data = sleep)
4
ピアソンの積率相関
# 相関係数(検定付)のヘルプ確認。exampleより
help(cor.test)
# データ設定
x <- c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1)
y <- c( 2.6, 3.1, 2.5, 5.0, 3.6, 4.0, 5.2, 2.8, 3.8)
# ピアソンの積率相関
cor.test(x,y)
5
1要因分散分析
# インターネットにつながっている状態で読みこみ
hs1 <-read.table("http://www.ats.ucla.edu/stat/R/notes/hs1.csv",
header=T, sep=",")
attach(hs1)
# 回帰のlm関数で計算して,anova関数で結果を出力
anova(lm(write~factor(prog)))
R Class Notes Analyzing Data (UCLA Statistical Computing)
http://www.ats.ucla.edu/stat/r/notes/analyze.htm
6
帰無仮説有意性検定:NHST
(null hypothesis significance testing)
• Statistical Methods in Psychology Journals
(Wilkinson & the Task Force on Statistical Inference APA Board of
Scientific Affairs, 1999)
Hypothesis tests.
It is hard to imagine a situation in which a
dichotomous accept-reject decision is better than
reporting an actual p value or, better still, a
confidence interval. Always provide some effect
size estimate when reporting a p value(p599)
※かつて,アメリカ心理学会(APA)の委員会で,APA Journalにおいて帰無仮
説検定を禁止すべきかどうかの議論があったが,上記Wilkinsonの推奨に落
7
ち着いた (Thompson, 2007)
具体例で確かめてみよう
SFトリビアの知識テスト得点
N
研究1
Jedi-wannabes
15
Trekkies 15
mean
SD
t
p
Cohen's d
25
20
9
9
1.52
>.05
0.56
25
20
9
9
2.15
この下に
数字があ
ります
研究2
Jedi-wannabes
30
Trekkies 30
Jedi-wannabes= Star Wars fans
Trekkies = Star Trek fans
<.05
この下に
数字があ
ります
0.56
Ellis, (2010) p33
8
相関係数とp値( Nakagawa & Cuthill , 2007 )
• p値が示せないもの
– 効果の不確実性
– 効果の方向
– 効果の強さ
p-p-!
Nakagawa & Cuthill , (2007)の
Fig2参照。相関係数のp値とn数
別の点推定値及び区間推定値の
フォレストプロット
p-p-!
9
なぜ効果量が必要か
• Statistical Methods in Psychology Journals
(Wilkinson & the Task Force on Statistical Inference APA Board of
Scientific Affairs, 1999)
Effect sizes
Always present effect sizes for primary outcomes.
If the units of measurement are meaningful on a
practical level (e.g. number of cigarettes smoked
per day), then we usually prefer an unstandardized
measure (regression coefficient or mean
difference ) to a standardized measure (r or d)
(p599)
• APA出版マニュアル第5版
10
なぜ効果量が必要か
• Journal of Consulting and Clinical Psychology
– Instructions to Authors
http://www.apa.org/pubs/journals/ccp/index.aspx
Authors should report means and standard
deviations for all continuous study variables and
the effect sizes for the primary study findings.
(If effect sizes are not available for a particular test,
authors should convey this in their cover letter at the time
of submission.)
JCCP also requires authors to report confidence intervals for
any effect sizes involving principal outcomes
(see Fidler et al., 2005, JCCP pp. 136–143 and Odgaard & Fowler, 2010,
JCCP pp.287–297).
11
メタ分析的思考
( Nakagawa & Cuthill , 2007 )
• メタ分析はGene Glass (1976) の紹介以来,社
会科学,医学において文献レビューについての
本質的かつ確立したツールとなった
• 効果量に基づいて研究を統合し,そのばらつき
を推定するためNHSTの限界にしばられない
– NHSTよる結論の間違いを覆してきた
• 近年,メタ分析の有益性は"メタ分析的"思考と
呼ばれている(Cumming & Finch, 2001; Thompson, 2002b)
12
メタ分析的思考( Nakagawa & Cuthill , 2007 )
1. 効果量による先行研究の結果の正確な理解
は本質的である
2. (信頼区間が伴った)効果量の報告が習慣に
なり,メタ分析への組み入れが容易になる
3. 先行研究の効果量と新たな研究の効果量を
比較することで新たな結果の解釈がなされる
4. 研究者は彼らの1片の研究を,研究世界のよ
り大きな絵図に対する中程度の貢献物として
みる
13
効果量(連続量)
• 標準化効果量(standardized effect size)
d-family (群間の違い)
• Cohen' s d
• Hedges' g
• Glass' ⊿
r-family (関連)
• ピアソンの積率相関係数
※このように,色んな種類がある
ので,時々effect sizeとしか書い
てない論文もみられるが,何の
効果量なのか明示しないとだめ。
• 非標準化効果量(unstandardized effect size )
• 平均値差
• 非標準化回帰係数
14
効果量の公式(d family)
• 言葉で(Coe, 2002)
介入群の
統制群の
平均値 ー 平均値
標準偏差
• 記号で(Ellis, 2010: p10,26,27)
M1  M 2
Cohen' s d 
SDpooled
あとはRや
calculatorに
おまかせ!
M1  M 2
M

M
1
2
Hedges ' g 
Glass
'


*
SDcontrol
SDpooled
15
効果量の公式(d family)
• プールされた標準偏差(Ellis, 2010: p26,27)
 X
SDpooled 
SD
*
pooled

 X A    X B  X B 
nA  nB  2
2
A
2
nA  1SD  nB  1SD
2
A
nA  nB  2
2
B
Cohen
(1988:67)
Hedges
(1981:110)
※Nakagawa & Cuthill (2007) Table1 によると,SD*pooledによる効果量は,
文献中ではd, Cohen's dと呼ばれることも多いらしい。詳しくはKline, 2004,
16
p.102を見よと書いてある。
効果量の公式(d family)
• バイアスの修正(Ellis, 2010: p27)
– dの計算上起こる小さな正のバイアスを取り除くこ
とでgを計算(Hedges,1981)


3

g  d 1 
 4n1  n2   9 
Hedges &
Olkin (1985:81)
ただし,ここでのgはHedges and
Olkinでdと呼ばれていて,混乱が
見られる(Ellis, 2010:p27)
※Nakagawa & Cuthill(2007)はこれ(g)を
dunbiased, =Hedges' d と呼んでる。したがってdはdbiased
(つまりCohen's d又はHedges' g)と表記している)。常に
dunbiased を報告することを推奨している
17
記号の混乱(McGrath & Meyer, 2006)
Sample statistics
Pooled within sample
sums of squares
divided by:
Study
Cohen (1988)
Hedges & Olkin (1985)
Hunter & Schmidt (2004)
Parameter
d
δ
δ
N
δ̂ a
da
Lipsey & Wilson (2001)
N-2
Corrected for
bias
ds
g
d
d
d*
ESSM
Rosenthal (1991)
d
d
g
gu
Recommended
δ
d
g
δˆ
a
Discussed only as the maximum likelihood estimate of the population value.
18
検定と効果量の関係
• 検定統計量=効果の大きさ×標本の大きさ
y1  y2
t *
s 1 / n1  1 / n2
n1n2
d
n1  n2
n1=n2の場合
n1n2/n1+n2=n/2
n=1の場合,1/2=0.5;
n=5の場合,25/10=2.5;
n=10の場合,100/20=5
南風原(2002),p163;
Rosnow(2003)
19
効果量の95%信頼区間
• Statistical Methods in Psychology Journals
(Wilkinson & the Task Force on Statistical Inference APA Board of
Scientific Affairs, 1999)
Interval estimates.
Interval estimates should be given for any effect
sizes involving principal outcomes. (p599)
• Cumming & Finch (2001)の解説論文
(a)解釈しやすい
(b)有意性検定とつながりがある
(c)メタ分析的思考を促進する
(d)正確性についての情報を提供する
20
効果量の95%信頼区間
• 「母集団から無限に無作為抽出を繰り返した
ら,得られた95%信頼区間の内,95%の区間
推定値が母数を包含する」という意味(Thompson,
2007:p247)
– よくある誤解は,「特定の信頼区間が母数をとら
える確からしさ(100%)」
• 近似95%信頼区間の計算方法(Nakagawa & Cuthill,
2007, p599)
95%CI = ES -1.96se to ES +1.96se
21
効果量の95%信頼区間
Nakagawa & Cuthill(2007),Table 3
• Cohen's d (実際はHedges' g)の漸近標準誤差
2

 n1  n2  1   4  d 
 
1  
sed  
8 
 n1  n2  3   n1  n2 
• Hedges'd (unbiased d) の漸近標準誤差
n1  n2
d
sed 

n1n2
2n1  n2  2
2
22
正確な95%信頼区間
• Odgaard & Fowler(2010), JCCP
Recommendations (p293)
First, we recommend that authors use exact rather
than approximate CIs for ESs whenever possible.
・・・ Second, we recommend that authors and
editors add to standard practice the reporting of
the specific techniques used to compute CIs for
ESs.
※付録に計算法やSAS,SPSS,特別なソフトの紹
介あり
23
効果量に関する補足事項
• ESというと何かとCohen's dが出てくるが,公式
的にはHedges'g (Nakagawa & Cuthill., 2007: p596, Table1)
• dよりrを推奨する統計家もいる(Field, )
• 標準化効果量は,非標準化効果量に比べて
優先されるわけではない。非標準化の方がよ
い時も多い(Nakagawa & Cuthill, 2007: p595; Coe, 2002:conclusion
より; )
• 公式は間違ってるんじゃないかっていうのが
結構あるので,出典をきちんと把握しておく
• 基本的に効果量は相互変換可能
24
Package "rpsychi"
• ind.t.test (y~x, data=dat)
– 連続量yについて,カテゴリ変数xでt検定。効果量と
95%信頼区間を算出 (Hedges' g)
• ind.t.test.second(m=c(13,11),sd=c(2.739,
2.236),n=c(5,5))
– それぞれの平均値,標準偏差,nから効果量と95%
信頼区間を算出
• zero.r.test(y~x, data=dat) :相関
• ind.oneway(formula = y~x, data=dat)
:1要因ANOVA
25
Package "compute.es"
• mes(m.1, m.2, sd.1, sd.2, n.1, n.2)
– 平均値,標準偏差,人数をそれぞれ直で入れて
Cohen'd(※SDpooledの式はHedges'gだった), Hedges'g(unbiasedの
修正式かけたやつ)やその分散,その他の効果量を計算
• tes (t-value, n1, n2)
– 平均とSDのかわりにt値を使用
※95%信頼区間を算出するためには,出てきたvarの
値の平方根を計算する,すなわちES±1.96*sqrt(var)
を計算
26
Package "MBESS"
• smd(Mean.1=13, Mean.2=11, s.1=2.739,
s.2=2.236, n.1=5, n.2=5)
– 標準化平均値差の値のみを算出,=の後に値を記入
• smd(Mean.1=13, Mean.2=11, s.1=2.739,
s.2=2.236, n.1=5, n.2=5, Unbiased=T)
– バイアスを調整した標準化平均値差の値のみを
算出
・the difference between the two means, divided by the pooled estimate
of standard deviation
・corrected using a factor provided by Hedges and Olkin (1985)
・95%信頼区間はci.smdを使って算出
27
補足
• Effect size計算用Rスクリプト(Nakagawa)
http://www.bristol.ac.uk/biology/research/staff/cuthill.i/
– Exact CIの計算
• 効果量の計算,報告,解釈ガイドライン
(Durlak, 2009)
28
論文での示し方例(介入研究)
• Adamsen et al., (2009) BMJ
Method: Effect size was calculated by the mean
difference divided by the pooled standard deviation,
the root mean square error estimated from the
general linear model.
Results: The fatigue score was reduced in the
intervention group by an estimated mean difference
of −6.6 points (95% CI −12.3 to −0.9) compared
with the control group (P=0.02, effect size=0.33,
95% CI 0.04 to 0.61) (table 3).
29
論文での示し方例(介入研究)
• Cooper et al., (2010) Child Adolesc Psychiatry Ment Health.
Method: Effect sizes and 95% confidence intervals were calculated using
the Effect Size Calculator from the Centre for Evaluation and Monitoring,
Durham University http://www.cemcentre.org/. Effect sizes are given as
Hedges' g throughout the paper. Like Cohen's d, Hedges' g is calculated
by dividing the difference between experimental and control group means
at endpoint by the pooled standard deviation; however, it uses a slightly
different formula to calculate the latter [see [34]], correcting for biases
that can occur in smaller sample sizes.
Results: Participants who attended counselling did not improve
significantly more on the primary outcome measure, the SDQ-ES, than main
those on the waiting list (g = 0.03). ・・・(略)・・・
Analysis of data from the subgroup of clients who met the MDE
cutpoint only (n = 10) found a trend towards significantly greater efficacy sub
group
for counselling over waiting list (p = .087), with an effect size (g) for
treatment against control of 1.13 (95% CI = -0.21 - 2.46) on the SDQ-ES. 30
主要引用文献
• ※Ellis PD. The Essential Guide to Effect Sizes: Statistical Power, Meta-Analysis,
and the Interpretation of Research Results. 2010 Cambridge University Press.
New York
• ※Nakagawa S, Cuthill IC. Effect size, confidence interval and statistical
significance: a practical guide for biologists. Biol Rev Camb Philos Soc.
2007;82(4):591-605.
• Coe R. It's the Effect Size, Stupid: What effect size is and why it is important
Paper presented at the Annual Conference of the British Educational Research
Association, University of Exeter, England, 12-4 September 2002. Available at:
http://www.leeds.ac.uk/educol/documents/00002182.htm (accessed 2/3/11). 又は
http://www.cemcentre.org/evidence-based-education/effect-size-calculator (Excel
のcalculator付)
• 南風原朝和. 心理統計学の基礎-統合的理解のために.2002有斐閣
• Rosnow RL. Effect sizes for experimenting psychologists. Can J Exp Psychol.
2003;57(3):221-37.
• Thompson, B., Effect sizes, confidence intervals, and confidence intervals for
effect sizes. Psychology in the Schools, 2007, 44: 423–432.
• Fidler F, Cumming G, Thomason N, Pannuzzo D, Smith J, Fyffe P, Edmonds H,
Harrington C, Schmitt R. Toward improved statistical reporting in the journal of
31
consulting and clinical psychology. J Consult Clin Psychol. 2005 ;73:136-43.
• Odgaard EC, Fowler RL. Confidence intervals for effect sizes: compliance and
clinical significance in the Journal of Consulting and clinical Psychology. J
Consult Clin Psychol. 2010 ;78:287-97.
• McGrath RE, Meyer GJ. When effect sizes disagree: the case of r and d. Psychol
Methods. 2006 ;11:386-401.
• Durlak JA. How to select, calculate, and interpret effect sizes. J Pediatr Psychol.
2009;34:917-28.
• ※Wilkinson L, Task Force Stat I.. Statistical methods in psychology journals Guidelines and explanations. American Psychologist 1999 54(8):594-604.
• Cumming G, Finch S.. A primer on the understanding, use, and calculation of
confidence intervals that are based on central and noncentral distributions.
Educational and Psychological Measurement 2001 61(4):532.
• Adamsen L, Quist M, Andersen C, Moller T, Herrstedt J, Kronborg D,
Baadsgaard MT, Vistisen K, Midtgaard J, Christiansen B, Stage M, Kronborg
MT, Rorth M. Effect of a multimodal high intensity exercise intervention in
cancer patients undergoing chemotherapy: randomised controlled trial. BMJ.
2009 Oct 13;339:b3410
• Cooper M, Rowland N, McArthur K, Pattison S, Cromarty K, Richards K.
Randomised controlled trial of school-based humanistic counselling for
emotional distress in young people: feasibility study and preliminary indications
32
of efficacy. Child Adolesc Psychiatry Ment Health. 2010 Apr 22;4:12.