Raschpackage eRM
Models
and the R
Reinhold Hatzinger
Institute for Statistics and Mathematics
WU Vienna
Munich 2010
Intro
What is eRm?
eRm short for extended
is an R package
Rasch modelling
is open source: no license fees, source code available,
GPL: share, change, and redistribute under certain conditions
for Rasch family models:
utilities for tting, testing, and displaying results
currently implemented models:
LPCM, PCM, LRSM, RSM, LLTM, RM, (LLRA)
uses CML estimation
Munich 2010
Intro
What is Item Response Theory (IRT)?
IRT is built around the central idea:
probability of a subject's certain reaction to a stimulus
described as a
a latent trait
can be
characterising the subject's location on
plus one or more parameters characterising the
function
0.6
0.4
0.0
0.2
Probability
0.8
1.0
stimulus
Latent Dimension
Munich 2010
The Rasch Model
The Rasch Model (RM) (Rasch, 1960)
exp(v i)
P (Xvi = 1 v , i) =
1 + exp(v i)
Xvi . . . person v gives correct
v . . . `ability' of person v
i . . . `diculty' of item i
I1
P1
P2
P3
P4
si
1
1
1
0
3
I2
0
0
1
1
2
Munich 2010
I3
0
1
0
1
2
I4
0
0
0
1
1
rv
1
2
2
3
answer to item
Raw Scores:
i xvi = rv
v xvi = si
The Rasch Model
0.6
0.4
Item 1
Item 2
Item 3
0.0
0.2
Probability to Solve
0.8
1.0
Several ICCs
Latent Dimension
Munich 2010
The Rasch Model
Rasch Model Assumptions / Properties
unidimensionality
P (Xvi = 1 v , i, ) = P (Xvi = 1 v , i)
response probability does not depend on other variables
suciency
f (xvi, ..., xvk v ) = g(rv v )h(xvi, ..., xvk )
score rv = i xvi (sum of responses) contains
all informaraw
tion on ability, regardless which items have been solved
conditional independence
for xed
Xvi Xvj v , i, j
there is no correlation between any two items
monotonicity for
response
Munich 2010
v > w f (xvi v , i) > f (xwi w , i), v , w
probability increases with higher values of
The Rasch Model
Parameter Estimation
Item Parameter Estimation
likelihood based methods:
dier in their treatment of person parameters
joint ML estimation (JML)
conditional ML estimation (CML)
marginal ML estimation(MML)
other methods available:
less often used
not covered here
Person Parameter Estimation
ML and weighted ML estimation
Bayes approaches
Munich 2010
The Rasch Model
Joint Maximum Likelihood (JML)
Lu =
exp(v v rv ) exp( i isi)
v i(1 + exp(v i))
sucient statistics are:
rv = i xvi for v
si = v xvi for i
problem: item parameter estimates inconsistent as
biased in nite samples with k(k 1)
Marginal Maximum Likelihood (MML)
integrate out the person parameter
nr
exp(r)
exp( isi)
Lm =
dG()
r
k (1 + exp( i))
i
i=1
distribution for must be specied, usually N (0, 1)
can be estimated in R using the ltm package (Rizopoulos,2009)
Munich 2010
The Rasch Model
Conditional Maximum Likelihood (CML)
condition on
rv
Lc = exp( isi)/ exp( xii)nr
i
r xr
person parameters do not occur in the conditional likelihood
items can be compared independent of persons (separation)
leads to specic objectivity
person free item calibration
`sample-independence':
actual sample not of relevance for inference on item parameters
CML estimates are unbiased and consistent as n
for estimability set 1 = 0 or i = 0
items with score si = 0 or n and person with rv = 0 or
removed prior to estimation
Munich 2010
are
The Rasch Model
MML vs CML
MML Advantages:
gives also estimates for persons with rv = 0 or
when research aims at person distribution
allows estimation of additional parameters
(2PL, 3PL models)
faster with large k
rv = k
CML Advantages:
when RM is used as measurement model (scale construction)
MML parameters can be biased if G() incorrectly specied
CML closer to concept of person-free assessment
allows for specic objectivity
several goodness-of-t tests not available with MML
distributional properties of CML and MML estimates are the
same asymtotically
Munich 2010
10
The Rasch Model
Person Parameter Estimation
using the unconditional likelihood
Lu =
exp(v v rv ) exp( i isi)
v i(1 + exp(v i))
and assuming the s to be known (from prior estimation)
slightly biased (bias smaller than s.e.'s of estimates)
no estimates for rv = 0 and rv = k
can be approximated using, e.g., spline interpolation
weighted ML estimation:
likelihood function is skewed, additional source of estimation bias
Warm (1989) suggests unbiasing correction, computationally unfeasible
Munich 2010
11
eRm
The R package eRm (extended Rasch modelling)
> library(eRm)
main functions concerning t of the RM:
RM(data) ts the RM and generates object of class dRm
[Link](drmobj) generates object of class ppar
plots from drm object:
plotPImap(), plotICC(), plotjointICC()
plots from ppar object:
plot()
extract information from drm object:
coef(), vcov(), confint(), logLik(), [Link]()
extract information from ppar object:
confInt(), logLik()
Munich 2010
12
eRm
Fitting the RM
> [Link] <- RM(data)
> [Link]
Results of RM estimation:
Call: RM(X = data)
Conditional log-likelihood: -156.3100
Number of iterations: 12
Number of parameters: 4
Basic Parameters eta:
eta 1
eta 2
eta 3
eta 4
Estimate 0.4292685 -1.1743542 -0.1496732 0.02667262
[Link] 0.1945618 0.2243309 0.1918824 0.19118379
default is: RM(datamatrix, sum0 = TRUE, other options)
sum0 denes constraints (for estimability):
TRUE . . . sum zero, FALSE . . . rst item set to 0
the output gives easiness (not diculty) parameters!
Munich 2010
13
eRm
> summary([Link])
Results of RM estimation:
Call: RM(X = data)
Conditional log-likelihood: -156.3100
Number of iterations: 12
Number of parameters: 4
Basic Parameters (eta) with 0.95 CI:
Estimate Std. Error lower CI upper CI
eta 1
0.429
0.195
0.048
0.811
eta 2
-1.174
0.224
-1.614
-0.735
eta 3
-0.150
0.192
-0.526
0.226
eta 4
0.027
0.191
-0.348
0.401
Item Easiness Parameters (beta) with 0.95 CI:
Estimate Std. Error lower CI upper CI
beta I1
0.868
0.206
0.464
1.272
beta I2
0.429
0.195
0.048
0.811
beta I3
-1.174
0.224
-1.614 -0.735
beta I4
-0.150
0.192
-0.526
0.226
beta I5
0.027
0.191
-0.348
0.401
Munich 2010
14
eRm
Extracting Information
the item parameter estimates
> coef([Link])
eta 1
eta 2
eta 3
eta 4
0.42926853 -1.17435425 -0.14967319 0.02667262
the variance-covariance matrix of item parameter estimates
> vcov([Link])
[,1]
[1,] 0.037854306
[2,] -0.012554175
[3,] -0.008073628
[4,] -0.007959444
Munich 2010
[,2]
-0.01255417
0.05032436
-0.01171606
-0.01178009
[,3]
-0.008073628
-0.011716057
0.036818867
-0.007484464
[,4]
-0.007959444
-0.011780088
-0.007484464
0.036551241
15
eRm
Extracting Information (cont'd)
conndence intervals for the item parameter estimates
> confint([Link], "beta")
2.5 %
97.5 %
beta I1 0.46444284 1.2717297
beta I2 0.04793435 0.8106027
beta I3 -1.61403476 -0.7346737
beta I4 -0.52575584 0.2264095
beta I5 -0.34804072 0.4013860
the conditional log likelihood
> logLik([Link])
'Conditional log Lik.' -156.3100 (df=4)
Munich 2010
16
eRm
Plot ICCs
0.6
0.4
Item 1
Item 2
Item 3
Item 4
Item 5
0.0
0.2
Probability to Solve
0.8
1.0
> plotjointI([Link], xlim = c(-5, 5))
Latent Dimension
Munich 2010
17
eRm
Plot single ICC
0.6
0.4
0.0
0.2
Probability to Solve
0.8
1.0
> plotI([Link], i = 3)
Latent Dimension
Munich 2010
18
eRm
Plot ICCs
> plotICC([Link], [Link] = 1:4, ask = F, empICC = list("raw"),
+
empCI = list(lty = "solid"))
0.8
q
q
q
0.4
0.8
0.4
0.0
Probability to Solve
ICC plot for item I2
q
q
0.0
Probability to Solve
ICC plot for item I1
ICC plot for item I4
0.0
Latent Dimension
0.8
0.4
q
q
q
q
q
q
0.0
0.4
0.8
Munich 2010
Probability to Solve
Latent Dimension
ICC plot for item I3
Probability to Solve
Latent Dimension
Latent Dimension
19
eRm
Plot Person-Item Map
> plotPImap([Link])
PersonItem Map
Person
Parameter
Distribution
I1
q
I1
I2
ttx
I2
I3
q
I3
I4
q
I4
I5
q
I5
Latent Dimension
Munich 2010
20
eRm
Person Parameter Estimation
> pp <- [Link]([Link])
> pp
Person Parameters:
Raw Score
0
1
2
3
4
5
Estimate
-2.6310979
-1.5189967
-0.4615091
0.4374933
1.5217580
2.6659917
[Link]
NA
1.1498599
0.9565426
0.9636302
1.1669396
NA
if NAs in the data, dierent person parameters are estimated for
every NA-pattern group
Munich 2010
21
eRm
Methods for Person Parameter Estimation Results
> logLik(pp)
'Unconditional (joint) log Lik.' -10.85398 (df=4)
> confint(pp)
2.5 %
P1 -3.772681
P2 -1.451187
P3 -1.451187
P5 -2.336298
P6 -1.451187
P7 -2.336298
...
97.5 %
0.7346872
2.3261739
2.3261739
1.4132799
2.3261739
1.4132799
attention: confint(pp) gives values for all subjects
if there are Nas in the data, condence intervals are printed for
each NA group
Munich 2010
22
eRm
Plot of Person Parameter Estimates
> plot(pp)
Plot of the Person Parameters
1
0
Person Parameters (Theta)
Person Raw Scores
Munich 2010
23
Testing the Rasch Model
Testing the RM Overview
RM allows to evaluate the quality of measurement
crucial assumptions empirically testable
aim: nd set of items that conform to the RM (`data t model')
various tests/diagnostics have been proposed
some implemented in eRm:
Andersen LR test
Wald-type test
nonparametric tests
item/person t indices
graphical procedures
Munich 2010
24
Testing the Rasch Model
Andersen's Likelihood Ratio Test (Andersen, 1973)
`global' test (all items investigated simultaneously)
powerful against violations of suciency and monotonicity
can detect DIF (dierential item functioning or item bias ):
basic idea:
consistent item parameter estimates (`invariance') obtained from
any subgroup where the model holds
divide the sample according to score r,
obtain J 1 likelihoods of the form
(r)
Lc
r = 1, . . . , J 1
= exp( j sj )/(r; 1, . . . , J )nr
(r)
the total likelihood is
Munich 2010
(r)
Lc = Lc
r
25
Testing the Rasch Model
Andersen's Likelihood Ratio Test (cont'd)
then
=
Lc
(r)
r Lc
Z = 2 ln
= 1,
only if the RM holds
is asymptotically
2-distributed
with
df = (J 2)(J 1)
test can be used for any partition of the sample according to
extraneous variables (e.g., gender, age, ...)
Wald Test
allows for testing single items idea is again: sample into subgroups (usually 2)
(1)
(2)
(1)
(2)
using separate estimates j and j (and j , j ),
(1)
(2)
(1) (2)
Sj = (j j )/ + N (0, 1)
Munich 2010
26
Testing the Rasch Model
Nonparametric (`exact') Tests
Idea:
Parameter estimates depend only on marginals r and s
for any statistic of the data matrix, one can approximate the
null distribution
take random sample from the collection of equally likely data
matrices, compute null distribution of statistic
valid and powerful, even in small samples
Person/Item Fit
objective is to detect noticeable patterns
Expected response: vi = exp(v i)/(1 + exp(v i))
Residuals: evi = xvi vi
e2
1
vi
Example: Outt MSQ for items: ui =
n v vi(1 vi)
test statistics, e.g., nu2, are 2 with corresponding df
i
Munich 2010
27
Testing the Rasch Model
Graphical Procedure
underlying idea again subgroup homogeneity, plot
(1)
vs
(2)
I3
I4
I1
I5
I2
Beta for Group: Raw Scores > Median
Graphical Model Check
Beta for Group: Raw Scores <= Median
Munich 2010
28
eRm
Likelihoodratio- and Wald Tests
LR Test:
> lrt <- LRtest([Link], se = TRUE)
> lrt
Andersen LR-test:
LR-value: 2.407
Chi-square df: 4
p-value: 0.661
Wald Test:
> Waldtest([Link])
Wald test on item level (z-values):
beta
beta
beta
beta
beta
I1
I2
I3
I4
I5
z-statistic p-value
-0.832
0.405
-0.352
0.725
0.428
0.668
1.300
0.194
-0.411
0.681
Munich 2010
29
eRm
Item Fit Statistics
> itemfit(pp)
Itemfit Statistics:
Chisq df p-value Outfit MSQ Infit MSQ
I1 80.938 84
0.574
0.952
0.966
I2 78.491 84
0.649
0.923
0.934
I3 82.480 84
0.526
0.970
0.961
I4 85.144 84
0.445
1.002
1.024
I5 74.275 84
0.767
0.874
0.908
Nonparametric Tests
> t11 <- NPtest(data, method = "T11")
> t11
Nonparametric RM model test: T11 (global test - local dependence)
(sum of deviations between observed and expected inter-item correlations)
Number of sampled matrices: 500
one-sided p-value: 0.934
Munich 2010
30
eRm
Graphical Procedure
> plotGOF(lrt, conf = list())
I3
q
q
I4
q I5
I2
q
q
q
q
I1
q
q
Beta for Group: Raw Scores > Median
Graphical Model Check
Beta for Group: Raw Scores <= Median
Munich 2010
31
eRm
Polytomous Models
Partial Credit Modell (PCM)
exp[h(v + i) + hi]
P (Xvi = h) = mi
l=0 exp[l(v + i) + li]
h . . . response categories (h = 0, . . . , mi)
mi . . . number of response categories may
hi . . . category parameter
dier across items
Rating Scale Modell (RSM)
simplication:
mi = m . . . distances between categories are equal across all item
hi = h . . . `equistant scoring'
Munich 2010
32
eRm
ICCs for the PCM
0.8
0.6
0.2
0.4
Category 0
Category 1
Category 2
Category 3
0.0
probability for responding in category
1.0
ICC plot for item I2
Latent Dimension
Munich 2010
33
eRm
Comparison RSM vs PCM
RSM
PCM
Person
Parameter
Distribution
Person
Parameter
Distribution
QA20_1
q
q
ttx
q
q
q
q
QA20_3
q
q
q
q
q
q
Latent Dimension
Munich 2010
q q
q
q
qq qq
QA20_5
QA20_4
QA20_6
qq
2 34
qq
QA20_6
QA20_5
2 3
QA20_2
QA20_4
q q
q
ttx
QA20_3
QA20_2
QA20_1
Latent Dimension
34
eRm
R commands
main functions concerning t of polytomous models:
PCM(data) ts the PCM and generates object of class Rm
RSM(data) ts the RSM and generates object of class Rm
thresholds(rmobj) displays the itemparameter estimates as
thresholds
all other functions are the same as previously presented
(except for plotjointICC())
Munich 2010
35
eRm Summary
eRm Summary
core of eRm is the Linear Partial Credit Model (LPCM):
P (Xvi = h) =
where the
ih's
exp(hv + ih)
mi
l=0 exp(lv + ih)
are linearly reparameterised
mi
ih = wihpp
p
allows for a general algorithm:
according to the specication of the design matrix W = ((wih,p))
various models can be estimated
currently functions for:
LPCM, PCM, LRSM, RSM, LLTM, RM
Munich 2010
36
eRm Summary
The model hierarchy in eRm
the LPCM is the most general unidimensional model in this family
all other models are submodels
they are obtained by appropriately dening the design matrix W
LPCM
PCM
LRSM
RSM
LLTM
RM
Munich 2010
37
eRm Summary
eRm Features
Scope:
Scale Analysis (measurement models)
Modelling latent change (statistical models)
uni- and multidimensional (LLRA)
Models:
RM, RSM, PCM, LLTM, LRSM, LPCM, (LLRA)
Treatment of missing values (MCAR)
Dierent constraints for parameter estimation
Design matrix (default / user dened)
Estimation:
Itemparameters, `basic'- and eect parameters,
threshold parameters (all using CML)
Personparameters (JML)
Covariance matrices (condence intervals)
Support for stepwise item selection
Munich 2010
38
eRm Summary
eRm Features (cont'd)
Diagnostics, Model Tests, and Fit Statistics:
Andersen LR-test, Wald Test for single items
Global and item level nonparametric tests (for RM)
Itemt, Persont (using Pearson residuals)
Information criteria (AIC, BIC, cAIC)
Check for existence of ML estimates
`well-conditioned datamatrix' (for RM)
some (nonpsychometric) logistic regression diagnostics
Plots:
Goodness-of-Fit Plots
ICC-Plots for single items (with optional empirical ICCs)
Joint ICC-Plot (for RM)
Person-Item Map
Miscellaneous :
Simulation of data matrices according to RM violations
...
Munich 2010
39
eRm Summary
Further Infos:
R Forge:
[Link]
Development platform
latest releases downloads
Discusssion and help forum
Project homepage [Link]
Publications:
Mair & Hatzinger (2007). Journal Statistical Software
Mair & and Hatzinger (2007). Psychology Science
Hatzinger & Rusch (2009). Psychology Science Quarterley
Munich 2010
40