LRtest: Computation of Andersen's LR-test.

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

This LR-test is based on subject subgroup splitting.

Usage

1
2
3
4
5
6
7
8
## 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, ...)

Arguments

object

Object of class "Rm".

splitcr

Split criterion for subject raw score splitting. "all.r" corresponds to a full raw score split, "median" uses the median as split criterion, "mean" performs a mean split. Optionally splitcr can also be a vector which assigns each person to a certain subgroup (e.g., following an external criterion). This vector can be numeric, character or a factor.

se

controls computation of standard errors in the submodels (default: TRUE).

x

Object of class "LR". Also used for visualizing the fit of single items.

beta.subset

If "all", all items are plotted. Otherwise numeric subset vector can be specified.

main

Title of the plot.

xlab

Label on x-axis, default gives name of splitcr and level.

ylab

Label on y-axis, default gives name of splitcr and level.

tlab

Specification of item labels: "item" prints the item names, "number" gives integers corresponding to order of the beta parameters, if "none" no labels are printed. "identify" allows for an interactive labelling. Initially no labels are printed, after clicking close to an item point the corresponding label is added. The identification process is terminated by clicking the second button and selecting 'Stop' from the menu, or from the 'Stop' menu on the graphics window. For more information and basic operation see identify.

xlim

Limits on x-axis.

ylim

Limits on y-axis.

type

Plotting type (see plot).

pos

Position of the item label (see text).

conf

for plotting confidence ellipses for the item parameters. If conf = NULL (the default) no ellipses are drawn. Otherwise, conf must be specified as a list with optional elements: gamma, is the confidence level (numeric), col and lty, color and linetype (see par), which (numeric index vector) specifying for which items ellipses are drawn (must be a subset of beta.subset), and ia, logical, if the ellipses are to be drawn interactively (cf., tlab = "identify" above). For details about the default behavior, if conf is specified as a an empty list, see Details and Examples below. To use conf, the LR object x has to be generated using the option se = TRUE in LRtest(). For specification of col and which see Details and Examples below.

ctrline

for plotting confidence bands (control lines, cf. eg. Wright and Stone, 1999). If ctrline = NULL (the default) no lines are drawn. Otherwise, ctrline must be specified as a list with optional elements: gamma, is the confidence level (numeric), col and lty, color and linetype (see par). If ctrline is specified as ctrline = list(), the default values conf = list(gamma = 0.95, col = "blue", lty = "solid") will be used. See examples below. To use ctrline, the LR object x has to be generated using the option se = TRUE in LRtest().

smooline

spline smoothed confidence bands; must be specified as a list with optional elements: gamma, is the confidence level (numeric), col and lty, color and linetype, spar as smoothing parameter (see smooth.spline).

asp

sets the y/x ratio of the plot (see plot.window).

x_axis

if TRUE, the x-axis will be plotted.

y_axis

if TRUE, the y-axis will be plotted.

set_par

if TRUE, graphical parameters will be set by the function to optimize the plot's appearance. Unless reset_par = FALSE, these will be reset to the previous par settings.

reset_par

if TRUE, graphical parameters will be reset to defaults via par() after plotting (only if set_par = TRUE). To make adjustments after using plotGOF, this reset can be switched off. Note that the changed graphical parameters will remain in place unless they are redefined (using par()) or the device is closed.

...

additional parameters.

Details

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.

Value

LRtest returns an object of class LR containing:

LR

LR-value.

df

Degrees of freedom of the test statistic.

Chisq

Chi-square value with corresponding df.

pvalue

P-value of the test.

likgroup

Log-likelihood 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 splitcr.

call

The matched call.

fitobj

List containing model objects from subgroup fit.

Author(s)

Patrick Mair, Reinhold Hatzinger, Marco J. Maier, Adrian Bruegger

References

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), 1-20.

Mair, P., and Hatzinger, R. (2007). CML based estimation of extended Rasch models with the eRm package in R. Psychology Science, 49, 26-43.

Wright, B.D., and Stone, M.H. (1999). Measurement essentials. Wide Range Inc., Wilmington. (http://www.rasch.org/measess/me-all.pdf 28Mb).

See Also

Waldtest, MLoef

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# the object used is the result of running ... RM(raschdat1)
res <- raschdat1_RM_fitted       # see ? raschdat1_RM_fitted

# LR-test on dichotomous Rasch model with user-defined split
splitvec <- sample(1:2, 100, replace = TRUE)
lrres <- LRtest(res, splitcr = splitvec)
lrres
summary(lrres)

## Not run: 
# goodness-of-fit plot with interactive labelling of items w/o standard errors
plotGOF(lrres, tlab = "identify")
## End(Not run)

# LR-test with a full raw-score split
X <- sim.rasch(1000, -2:2, seed = 5)
res2 <- RM(X)
full_lrt <- LRtest(res2, splitcr = "all.r")
full_lrt

## Not run: 
# LR-test 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

# goodness-of-fit plot
# additional 95 percent control line with user specified style
plotGOF(lrres2, ctrline = list(gamma = 0.95, col = "red", lty = "dashed"))

# goodness-of-fit 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: 
# goodness-of-fit 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)

Example output

Andersen LR-test: 
LR-value: 50.16 
Chi-square df: 29 
p-value:  0.009 


Andersen LR-test: 
LR-value: 50.16 
Chi-square df: 29 
p-value:  0.009 


Subject Subgroup: splitvec 1:
Log-likelihood:  -826.5974

Beta Parameters: 
           beta I1   beta I2   beta I3    beta I4    beta I5   beta I6
Estimate 1.5769591 -0.204538 0.8838265 -0.9229661 -1.2386948 -0.204538
Std.Err. 0.3308768  0.285238 0.2946569  0.3099578  0.3295284  0.285238
           beta I7   beta I8   beta I9   beta I10   beta I11  beta I12
Estimate 0.7953922 0.7085500 0.4551073 -1.2386948 -0.6386171 0.5386345
Std.Err. 0.2918161 0.2893935 0.2843615  0.3295289  0.2970478 0.2856873
           beta I13   beta I14  beta I15   beta I16  beta I17  beta I18
Estimate -1.8972385 -1.6058085 0.4551073 -0.2887352 0.9741371 0.2078141
Std.Err.  0.3908983  0.3599987 0.2843611  0.2868130 0.2979538 0.2823291
           beta I19  beta I20  beta I21  beta I22  beta I23   beta I24
Estimate -0.6386171 0.2078141 0.8838265 1.0666416 0.3722564 -0.2045380
Std.Err.  0.2970478 0.2823293 0.2946569 0.3017533 0.2833662  0.2852383
           beta I25  beta I26  beta I27   beta I28   beta I29  beta I30
Estimate -0.9229661 1.3612032 0.2078141 -0.4605482 -1.0239756 0.7953922
Std.Err.  0.3099578 0.3168173 0.2823292  0.2910853  0.3155961 0.2918166


Subject Subgroup: splitvec 2:
Log-likelihood:  -582.8042

Beta Parameters: 
          beta I1   beta I2   beta I3    beta I4    beta I5   beta I6   beta I7
Estimate 1.590843 0.4354233 0.6735384 -0.2783138 -1.3906231 0.5539485 0.5539485
Std.Err. 0.381350 0.3394390 0.3426242  0.3452502  0.4031739 0.3406953 0.3406955
           beta I8   beta I9   beta I10   beta I11  beta I12   beta I13
Estimate 0.7946884 0.6735384 -0.9308808 -0.6580522 0.1997494 -1.0759563
Std.Err. 0.3452663 0.3426237  0.3712475  0.3578246 0.3388340  0.3799971
           beta I14  beta I15   beta I16   beta I17   beta I18   beta I19
Estimate -3.2686843 0.1997494 -1.0759563 -0.5283044 -0.5283044 -0.9308808
Std.Err.  0.7240102 0.3388335  0.3799962  0.3527555  0.3527553  0.3712472
          beta I20  beta I21  beta I22  beta I23  beta I24   beta I25  beta I26
Estimate 1.4456859 1.0439166 0.9179442 1.1733013 0.3175029 -0.6580522 1.0439166
Std.Err. 0.3721909 0.3529612 0.3486849 0.3582033 0.3388238  0.3578244 0.3529612
           beta I27    beta I28   beta I29  beta I30
Estimate -0.5283044 -0.03697666 -0.4019440 0.6735384
Std.Err.  0.3527558  0.34073007  0.3485961 0.3426234


Andersen LR-test: 
LR-value: 7.585 
Chi-square df: 12 
p-value:  0.817 

eRm documentation built on March 18, 2018, 2:21 p.m.

Related to LRtest in eRm...