トップ 履歴 一覧 Farm ソース 検索 ヘルプ PDF RSS ログイン

Forward Difference Coding

*disclaimer
823336

dummy coding

Forward Difference Coding

https://stats.idre.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/#forward

  • 順序のあるカテゴリーについて
  • 順に前から隣接するペアで効果に差があるかを分析
    • 二つだけであれば、単にその間の差
    • 三つ以上なら、順にどう変化するかがわかる
      • 例: 事前テスト、事後テスト、遅延テスト

  • Successive Difference Coding とも呼ばれる
    • 連続したレベル間の差を計算
    • MASSライブラリ内の contr.sdif()

分析例

  • contr.sdif
library(ordinal)
library(MASS)

result.model <- clmm(score ~ 構文 + 時期 + 条件 + 構文:時期 + (1 | ID) + (1 | itemid), data=sample.data
                      ,
                      contrasts=list(
                        構文=contr.sdif,
                        時期=contr.sdif,
                        条件=contr.sdif
                        )
                      )

summary(result.model)

分析結果表

Random effects:
 Groups Name        Variance Std.Dev.
 ID     (Intercept) 1.98281  1.4081  
 itemid (Intercept) 0.06816  0.2611  
Number of groups:  ID 43,  itemid 12 

Coefficients:
                        Estimate Std. Error z value Pr(>|z|)    
構文[B-A]                 0.2873     0.1821   1.578    0.115    
時期[事後-事前]           1.3042     0.1282  10.176  < 2e-16 ***
時期[遅延-事後]          -0.6324     0.1282  -4.934 8.06e-07 ***
条件[D-C]                -0.1908     0.1205  -1.583    0.113    
構文[B-A]:時期[事後-事前]  -0.1706     0.2490  -0.685    0.493    
構文[B-A]:時期[遅延-事後]  -0.1542     0.2525  -0.611    0.541    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Threshold coefficients:
    Estimate Std. Error z value
0|1  -2.1569     0.2430  -8.876
1|2  -1.1253     0.2387  -4.715
2|3   0.4320     0.2372   1.821

  • 構文AとBの間には差がない
  • 時期について
    • 事後から事前を引いたら 1.3042(事後の方が有意に1.3高い)
    • 遅延から事後を引いたら -0.6324(遅延の方が有意に0.6低い
  • 条件CとDの間には差がない
  • 構文と時期の間に交互作用はない