LRtest {eRm}  R Documentation 
This LRtest is based on subject subgroup splitting.
## S3 method for class 'Rm'
LRtest(object, splitcr = "median", se = TRUE)
## S3 method for class 'LR'
plotGOF(x, beta.subset = "all", main = "Graphical Model Check", xlab, ylab,
tlab = "item", xlim, ylim, type = "p", pos = 4, conf = NULL, ctrline = NULL,
smooline = NULL, asp = 1, x_axis = TRUE, y_axis = TRUE, set_par = TRUE,
reset_par = TRUE, ...)
object 
Object of class 
splitcr 
Split criterion for subject raw score splitting.

se 
controls computation of standard errors in the submodels (default: 
x 
Object of class 
beta.subset 
If 
main 
Title of the plot. 
xlab 
Label on 
ylab 
Label on 
tlab 
Specification of item labels: 
xlim 
Limits on 
ylim 
Limits on 
type 
Plotting type (see 
pos 
Position of the item label (see 
conf 
for plotting confidence ellipses for the item parameters.
If 
ctrline 
for plotting confidence bands (control lines, cf. eg. Wright and Stone, 1999).
If 
smooline 
spline smoothed confidence bands; must be specified as a list with optional elements: 
asp 
sets the 
x_axis 
if 
y_axis 
if 
set_par 
if 
reset_par 
if 
... 
additional parameters. 
If the data set contains missing values and mean
or median
is specified as split criterion, means or medians are calculated for each missing value subgroup and consequently used for raw score splitting.
When using interactive selection for both labelling of single points (tlab = "identify"
and drawing confidence ellipses at certain points (ia = TRUE
) then first all plotted points are labelled and afterwards all ellipses are generated.
Both identification processes can be terminated by clicking the second (right) mouse button and selecting ‘Stop’ from the menu, or from the ‘Stop’ menu on the graphics window.
Using the specification which
in allows for selectively drawing ellipses for certain items only, e.g., which = 1:3
draws ellipses for items 1 to 3 (as long as they are included in beta.subset
).
The default is drawing ellipses for all items.
The element col
in the conf
list can either be a single color specification such as "blue"
or a vector with color specifications for all items.
The length must be the same as the number of ellipses to be drawn.
For color specification a palette can be set up using standard palettes (e.g., rainbow
) or palettes from the colorspace
or RColorBrewer
package.
An example is given below.
summary
and print
methods are available for objects of class LR
.
LRtest
returns an object of class LR
containing:
LR 
LRvalue. 
df 
Degrees of freedom of the test statistic. 
Chisq 
Chisquare value with corresponding df. 
pvalue 
Pvalue of the test. 
likgroup 
Loglikelihood values for the subgroups 
betalist 
List of beta parameters for the subgroups. 
selist 
List of standard errors of beta's. 
etalist 
List of eta parameters for the subgroups. 
spl.gr 
Names and levels for 
call 
The matched call. 
fitobj 
List containing model objects from subgroup fit. 
Patrick Mair, Reinhold Hatzinger, Marco J. Maier, Adrian Bruegger
Fischer, G. H., and Molenaar, I. (1995). Rasch Models  Foundations, Recent Developements, and Applications. Springer.
Mair, P., and Hatzinger, R. (2007). Extended Rasch modeling: The eRm package for the application of IRT models in R. Journal of Statistical Software, 20(9), 120.
Mair, P., and Hatzinger, R. (2007). CML based estimation of extended Rasch models with the eRm package in R. Psychology Science, 49, 2643.
Wright, B.D., and Stone, M.H. (1999). Measurement essentials. Wide Range Inc., Wilmington. (https://www.rasch.org/measess/meall.pdf 28Mb).
# the object used is the result of running ... RM(raschdat1)
res < raschdat1_RM_fitted # see ? raschdat1_RM_fitted
# LRtest on dichotomous Rasch model with userdefined split
splitvec < sample(1:2, 100, replace = TRUE)
lrres < LRtest(res, splitcr = splitvec)
lrres
summary(lrres)
## Not run:
# goodnessoffit plot with interactive labelling of items w/o standard errors
plotGOF(lrres, tlab = "identify")
## End(Not run)
# LRtest with a full rawscore split
X < sim.rasch(1000, 2:2, seed = 5)
res2 < RM(X)
full_lrt < LRtest(res2, splitcr = "all.r")
full_lrt
## Not run:
# LRtest with mean split, standard errors for beta's
lrres2 < LRtest(res, split = "mean")
## End(Not run)
# to save computation time, the results are loaded from raschdat1_RM_lrres2
lrres2 < raschdat1_RM_lrres2 # see ?raschdat1_RM_lrres2
# goodnessoffit plot
# additional 95 percent control line with user specified style
plotGOF(lrres2, ctrline = list(gamma = 0.95, col = "red", lty = "dashed"))
# goodnessoffit plot for items 1, 14, 24, and 25
# additional 95 percent confidence ellipses, default style
plotGOF(lrres2, beta.subset = c(14, 25, 24, 1), conf = list())
## Not run:
# goodnessoffit plot for items 1, 14, 24, and 25
# for items 1 and 24 additional 95 percent confidence ellipses
# using colors for these 2 items from the colorspace package
library("colorspace")
my_colors < rainbow_hcl(2)
plotGOF(lrres2, beta.subset = c(14, 25, 24, 1),
conf = list(which = c(1, 14), col = my_colors))
## End(Not run)
# first, save current graphical parameters in an object
old_par < par(mfrow = c(1, 2), no.readonly = TRUE)
# plots
plotGOF(lrres2, ctrline = list(gamma = 0.95, col = "red", lty = "dashed"),
xlim = c(3, 3), x_axis = FALSE, set_par = FALSE)
axis(1, seq(3, 3, .5))
plotGOF(lrres2, conf = list(), xlim = c(3, 3), x_axis = FALSE, set_par = FALSE)
axis(1, seq(3, 3, .5))
text(2, 2, labels = "Annotation")
# reset graphical parameters
par(old_par)