NPtest: A Function to Perform Nonparametric Rasch Model Tests

View source: R/NPtest.R

NonparametricTestsR Documentation

A Function to Perform Nonparametric Rasch Model Tests

Description

A variety of nonparametric tests as proposed by Ponocny (2001), Koller and Hatzinger (2012), and an ‘exact’ version of the Martin-Löf test are implemented. The function operates on random binary matrices that have been generated using an MCMC algorithm (Verhelst, 2008) from the RaschSampler package (Hatzinger, Mair, and Verhelst, 2009).

Usage

NPtest(obj, n = NULL, method = "T1", ...)

Arguments

obj

A binary data matrix (or data frame) or an object containing the output from the RaschSampler package.

n

If obj is a matrix or a data frame, n is the number of sampled matrices (default is 500)

method

One of the test statistics. See Details below.

...

Further arguments according to method. See Details below. Additionally, the sampling routine can be controlled by specifying burn_in, step, and seed (for details see below and rsctrl). A summary of the sampling object may be obtained using the option RSinfo = TRUE.

Details

The function uses the RaschSampler package, which is now packaged with eRm for convenience. It can, of course, still be accessed and downloaded separately via CRAN.

As an input the user has to supply either a binary data matrix or a RaschSampler output object. If the input is a data matrix, the RaschSampler is called with default values (i.e., rsctrl(burn_in = 256, n_eff = n, step = 32), see rsctrl), where n corresponds to n_eff (the default number of sampled matrices is 500). By default, the starting values for the random number generators (seed) are chosen randomly using system time. Methods other than those listed below can easily be implemented using the RaschSampler package directly.

The currently implemented methods (following Ponocny's notation of T-statistics) and their options are:

T_1:

method = "T1"
Checks for local dependence via increased inter-item correlations. For all item pairs, cases are counted with equal responses on both items.

T_{1m}:

method = "T1m"
Checks for multidimensionality via decreased inter-item correlations. For all item pairs, cases are counted with equal responses on both items.

T_{1l}:

method = "T1l"
Checks for learning. For all item pairs, cases are counted with response pattern (1,1).

T_{md}:

method = "Tmd", idx1, idx2
idx1 and idx2 are vectors of indices specifying items which define two subscales, e.g., idx1 = c(1, 5, 7) and idx2 = c(3, 4, 6)
Checks for multidimensionality based on correlations of person raw scores for the subscales.

T_2:

method = "T2", idx = NULL, stat = "var"
idx is a vector of indices specifying items which define a subscale, e.g., idx = c(1, 5, 7)
stat defines the used statistic as a character object which can be: "var" (variance), "mad1" (mean absolute deviation), "mad2" (median absolute deviation), or "range" (range)
Checks for local dependence within model deviating subscales via increased dispersion of subscale person rawscores.

T_{2m}:

method = "T2m", idx = NULL, stat = "var"
idx is a vector of indices specifying items which define a subscale, e.g., idx = c(1, 5, 7)
stat defines the used statistic as a character object which can be: "var" (variance), "mad1" (mean absolute deviation), "mad2" (median absolute deviation), "range" (range)
Checks for multidimensionality within model deviating subscales via decreased dispersion of subscale person rawscores.

T_4:

method = "T4", idx = NULL, group = NULL, alternative = "high"
idx is a vector of indices specifying items which define a subscale, e.g., idx = c(1, 5, 7)
group is a logical vector defining a subject group, e.g., group = ((age >= 20) & (age < 30))
alternative specifies the alternative hypothesis and can be: "high" or "low".
Checks for group anomalies (DIF) via too high (low) raw scores on item(s) for specified group.

T_{10}:

method = "T10", splitcr = "median"
splitcr defines the split criterion for subject raw score splitting. "median" uses the median as split criterion, "mean" performs a mean-split. Optionally, splitcr can also be a vector which assigns each person to one of two subgroups (e.g., following an external criterion). This vector can be numeric, character, logical, or a factor.
Global test for subgroup-invariance. Checks for different item difficulties in two subgroups (for details see Ponocny, 2001).

T_{11}:

method = "T11"
Global test for local dependence. The statistic calculates the sum of absolute deviations between the observed inter-item correlations and the expected correlations.

T_{pbis}:

method = "Tpbis", idxt, idxs
Test for discrimination. The statistic calculates a point-biserial correlation for a test item (specified via idxt) with the person row scores for a subscale of the test sum (specified via idxs). If the correlation is too low, the test item shows different discrimination compared to the items of the subscale.

Martin-Löf

The ‘exact’ version of the Martin-Löf statistic is specified via method = "MLoef" and optionally splitcr (see MLoef).

Q_{3h}:

method = "Q3h"
Checks for local dependence by detecting an increased correlation of inter-item residuals. Low p-values correspond to a high ("h") correlation between two items.

Q_{3l}:

method = "Q3l"
Checks for local dependence by detecting a decreased correlation of inter-item residuals. Low p-values correspond to a low ("l") correlation between two items.

Value

Depending on the method argument, a list is returned which has one of the following classes: 'T1obj', 'T1mobj', 'T1lobj', 'Tmdobj', 'T2obj', 'T2mobj', 'T4obj', 'T10obj', 'T11obj', 'Tpbisobj', 'Q3hobj' or 'Q3lobj'.

The main output element is prop giving the one-sided p-value, i.e., the number of statistics from the sampled matrices which are equal or exceed the statistic based on the observed data. For T_1, T_{1m}, and T_{1l}, prop is a vector. For the Martin-Löf test, the returned object is of class 'MLobj'. Besides other elements, it contains a prop vector and MLres, the output object from the asymptotic Martin-Löf test on the input data.

Note

The RaschSampler package is no longer required to use NPtest since eRm version 0.15-0.

Author(s)

Reinhold Hatzinger

References

Ponocny, I. (2001). Nonparametric goodness-of-fit tests for the Rasch model. Psychometrika, 66(3), 437–459. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/BF02294444")}

Verhelst, N. D. (2008). An efficient MCMC algorithm to sample binary matrices with fixed marginals. Psychometrika, 73(4), 705–728. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11336-008-9062-3")}

Verhelst, N., Hatzinger, R., & Mair, P. (2007). The Rasch sampler. Journal of Statistical Software, 20(4), 1–14. https://www.jstatsoft.org/v20/i04

Koller, I., & Hatzinger, R. (2013). Nonparametric tests for the Rasch model: Explanation, development, and application of quasi-exact tests for small samples. Interstat, 11, 1–16. http://interstat.statjournals.net/YEAR/2013/abstracts/1311002.php

Koller, I., Maier, M. J., & Hatzinger, R. (2015). An Empirical Power Analysis of Quasi-Exact Tests for the Rasch Model: Measurement Invariance in Small Samples. Methodology, 11(2), 45–54. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1027/1614-2241/a000090")}

Debelak, R., & Koller, I. (2019). Testing the Local Independence Assumption of the Rasch Model With Q3-Based Nonparametric Model Tests. Applied Psychological Measurement \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1177/0146621619835501")}

Examples

### Preparation:

# data for examples below
X <- as.matrix(raschdat1)

# generate 100 random matrices based on original data matrix
rmat <- rsampler(X, rsctrl(burn_in = 100, n_eff = 100, seed = 123))

## the following examples can also directly be used by setting
## rmat <- as.matrix(raschdat1)
## without calling rsampler() first
t1 <- NPtest(rmat, n = 100, method = "T1")


### Examples ###################################################################

###--- T1 ----------------------------------------------------------------------
t1 <- NPtest(rmat, method = "T1")
# choose a different alpha for selecting displayed values
print(t1, alpha = 0.01)


###--- T2 ----------------------------------------------------------------------
t21 <- NPtest(rmat, method = "T2", idx = 1:5, burn_in = 100, step = 20,
              seed = 7654321, RSinfo = TRUE)
# default stat is variance
t21

t22 <- NPtest(rmat, method = "T2", stat = "mad1",
              idx = c(1, 22, 5, 27, 6, 9, 11))
t22


###--- T4 ----------------------------------------------------------------------
age <- sample(20:90, 100, replace = TRUE)
# group MUST be a logical vector
# (value of TRUE is used for group selection)
age <- age < 30
t41 <- NPtest(rmat, method = "T4", idx = 1:3, group = age)
t41

sex <- gl(2, 50)
# group can also be a logical expression (generating a vector)
t42 <- NPtest(rmat, method = "T4", idx = c(1, 4, 5, 6), group = sex == 1)
t42


###--- T10 ---------------------------------------------------------------------
t101 <- NPtest(rmat, method = "T10")       # default split criterion is "median"
t101

## Not run: 
split <- runif(100)
t102 <- NPtest(rmat, method = "T10", splitcr = split > 0.5)
t102

t103 <- NPtest(rmat, method = "T10", splitcr = sex)
t103
## End(Not run)


###--- T11 ---------------------------------------------------------------------
t11 <- NPtest(rmat, method = "T11")
t11


###--- Tpbis -------------------------------------------------------------------
tpb <- NPtest(X[, 1:5], method = "Tpbis", idxt = 1, idxs = 2:5)
tpb


###--- Martin-Löf --------------------------------------------------------------
## Not run: 
# takes a while ...
split <- rep(1:3, each = 10)
NPtest(raschdat1, n = 100, method = "MLoef", splitcr = split)
## End(Not run)

eRm documentation built on March 19, 2024, 3:06 a.m.

Related to NPtest in eRm...