外国語教育メディア学会(LET)関西支部 メソドロジー研究部会 報告論集第6号 住 政二郎(2014)「PROX法と同時最尤推定法の概説」で使用したコードです。

データの読み込み

dat <- read.csv("http://lang-tech.net/doc/jmle.csv", header = T, sep=",", na.strings="NA", dec=".", strip.white=TRUE, fileEncoding = "CP932")

dat # データの確認
##   Observed item.1 item.2 item.3 item.4 item.5
## 1 person 1      1      1      1      1      0
## 2 person 2      1      1      0      0      1
## 3 person 3      1      1      0      1      0
## 4 person 4      1      0      1      0      0
## 5 person 5      0      1      0      0      0

TAMパッケージのインストールと読み込み

TAMパッケージについて(http://cran.r-project.org/web/packages/TAM/TAM.pdf), 同時最尤推定法については p.72参照

install.packages("TAM", repos="http://cran.rstudio.com/")
## 
## The downloaded binary packages are in
##  /var/folders/r3/71p2ncyj3zxg9cc0r5jqvwv00000gn/T//RtmpsvzDnL/downloaded_packages
library(TAM)
## Loading required package: CDM
## Loading required package: mvtnorm
## **********************************
## ** CDM 4.2-12 (2015-02-23)      **
## ** Cognitive Diagnostic Models  **
## **********************************
## 
## Loading required package: MASS
## ::...........................::
## :: TAM 1.5-2 (2015-02-24)    ::
## :: Test Analysis Modules     ::
## ::...........................::

項目困難度と受験者能力の計算

mod1a <- tam.jml(dat[, -1])
## ....................................................
## Iteration 1     2015-03-28 14:43:56
## 
##  MLE/WLE estimation        |----
##  Item parameter estimation |----
##   Deviance = 22.4997
##   Mean WLE change: -0.087669
##   Maximum parameter change: 0.372634
## ....................................................
## Iteration 2     2015-03-28 14:43:56
## 
##  MLE/WLE estimation        |---
##  Item parameter estimation |---
##   Deviance = 22.4177 | Deviance change: 0.082
##   Mean WLE change: -0.004482
##   Maximum parameter change: 0.086368
## ....................................................
## Iteration 3     2015-03-28 14:43:56
## 
##  MLE/WLE estimation        |---
##  Item parameter estimation |--
##   Deviance = 22.4121 | Deviance change: 0.0056
##   Mean WLE change: -0.001488
##   Maximum parameter change: 0.023742
## ....................................................
## Iteration 4     2015-03-28 14:43:57
## 
##  MLE/WLE estimation        |--
##  Item parameter estimation |--
##   Deviance = 22.4117 | Deviance change: 4e-04
##   Mean WLE change: -0.000453
##   Maximum parameter change: 0.006789
## ....................................................
## Iteration 5     2015-03-28 14:43:57
## 
##  MLE/WLE estimation        |--
##  Item parameter estimation |--
##   Deviance = 22.4117 | Deviance change: 0
##   Mean WLE change: -0.000133
##   Maximum parameter change: 0.001964
## ....................................................
## Iteration 6     2015-03-28 14:43:57
## 
##  MLE/WLE estimation        |--
##  Item parameter estimation |--
##   Deviance = 22.4116 | Deviance change: 0
##   Mean WLE change: -3.9e-05
##   Maximum parameter change: 0.00057
## ....................................................
## Iteration 7     2015-03-28 14:43:57
## 
##  MLE/WLE estimation        |--
##  Item parameter estimation |--
##   Deviance = 22.4116 | Deviance change: 0
##   Mean WLE change: -1.1e-05
##   Maximum parameter change: 0.000165
## ....................................................
## Iteration 8     2015-03-28 14:43:57
## 
##  MLE/WLE estimation        |--
##  Item parameter estimation |-
##   Deviance = 22.4116 | Deviance change: 0
##   Mean WLE change: 1.6e-05
##   Maximum parameter change: 5.2e-05
## 
##  MLE/WLE estimation        |-------
## ....................................................
## 
## Start:  2015-03-28 14:43:56
## End:  2015-03-28 14:43:57 
## Time difference of 0.02493 secs

項目困難度の出力

summary(mod1a)
## ------------------------------------------------------------
## TAM 1.5-2 (2015-02-24) 
## 
## Start of Analysis: 2015-03-28 14:43:56 
## End of Analysis: 2015-03-28 14:43:57 
## Time difference of 0.02493 secs
## Computation time: 0.02493 
## R version 3.0.3 (2014-03-06) x86_64, darwin10.8.0 | nodename = Seijiros-iMac.local | login = iMac 
## 
## Joint Maximum Likelihood Estimation in TAM 
## 
## IRT Model 
## ------------------------------------------------------------
## Number of iterations = 8 
## 
## Deviance =  22.41  | Log Likelihood =  -11.21 
## Number of persons =  5 
## Number of items =  5 
## 
## Item Parameters Xsi
##   xsi.label xsi.index    xsi se.xsi
## 1    item.1         1 -1.503  1.287
## 2    item.2         2 -1.503  1.287
## 3    item.3         3  0.485  1.058
## 4    item.4         4  0.485  1.058
## 5    item.5         5  1.487  1.229

受験者能力の出力

mod1a$theta
## [1]  1.8449146  0.5224688  0.5224688 -0.7360080 -2.1538441