Title: | Implementation of a Method to Check the Cancellation Axioms of Additive Conjoint Measurement |
---|---|
Description: | Implementation of a procedure---Domingue (2012) <https://eric.ed.gov/?id=ED548657>, Domingue (2014) <doi:10.1007/s11336-013-9342-4>; see also Karabatsos (2001) <https://psycnet.apa.org/record/2002-01665-005> and Kyngdon (2011) <doi:10.1348/2044-8317.002004>---to test the single and double cancellation axioms of conjoint measure in data that is dichotomously coded and measured with error. |
Authors: | Ben Domingue [aut, cre], Liam Fox [ctb], Vithor Franco [ctb] |
Maintainer: | Ben Domingue <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.2.0 |
Built: | 2024-12-13 07:51:32 UTC |
Source: | https://github.com/ben-domingue/conjointchecks |
Implementation of a procedure (Domingue, 2012; see also Karabatsos, 2001 and Kyngdon, 2011) to test the single and double cancellation axioms of conjoint measure in data that is dichotomously coded and measured with error.
Ben Domingue [email protected]
Domingue, B. (2012). Evaluating the Equal-Interval Hypothesis with Test Score Scales. Doctoral Dissertation, University of Colorado Boulder, May 2012.
Karabatsos, G. (2001). The rasch model, additive conjoint measurement, and new models of probabilistic measurement theory. Journal of Applied Measurement, 2(4), 389-423.
Kyngdon, A. (2011). Plausible measurement analogies to some psychometric models of test per- formance. British Journal of Mathematical and Statistical Psychology, 64(3), 478-497.
Perline, R., Wright, B. D., & Wainer, H. (1979). The Rasch model as additive conjoint measurement. Applied Psychological Measurement, 3(2), 237-255.
Internal function; should not be used directly.
CCIterate(nIter, old, old_ll, single, burn, N, n)
CCIterate(nIter, old, old_ll, single, burn, N, n)
nIter |
Number of iterations. |
old |
Numeric matrix. |
old_ll |
Numeric matrix. |
single |
Should do single cancellation. |
burn |
Number of initial values to remove. |
N |
Integer matrix. |
n |
Numeric matrix. |
Ben Domingue [email protected]
Perline, R., Wright, B. D., & Wainer, H. (1979). The Rasch model as additive conjoint measurement. Applied Psychological Measurement, 3(2), 237-255.
### INTERNAL FUNCTION ###
### INTERNAL FUNCTION ###
The formal S4 class for checks. This class contains transformed version of the raw response data as well as summaries of the checks.
Objects of class checks
contains all information returned by
ConjointChecks
.
Object created by a call to function ConjointChecks
.
N
:matrix containing the number of respondents at each item/ability intersection
n
:matrix containing the number of correct responses at each item/ability intersection
Checks
:List containing information about each checked 3-matrix
tab
:matrix containing information about the detected violations at each item/ability intersection
means
:vector containing weighted and unweighted means for the detected violations (where weights are the number of individuals at each ability level)
check.counts
:matrix giving the number of times a item/ability cell was sampled
Ben Domingue [email protected]
ConjointChecks
, summary.checks
, plot.checks
Given two matrices, n
and N
(which contain the number of
correct responses and the number of total responses for each cell), a
check of single and double cancellation is performed in n.3mat
matrices. To check large numbers of 3-matrices (to see why, see Domingue (2012)),
parallel options help.
ConjointChecks(N,n,n.3mat=1,CR=c(.025,.975),single=FALSE,mc.cores=1)
ConjointChecks(N,n,n.3mat=1,CR=c(.025,.975),single=FALSE,mc.cores=1)
N |
Matrix containing the total number of responses. |
n |
Matrix containing the number of correct responses. |
n.3mat |
Number of 3-matrices to sample or the string "adjacent" if all adjacently formed 3-matrices are to be checked. |
CR |
Width of the credible region taken from the
posterior. Defaults to a 95% credible region ( |
single |
Also test single cancellation. |
mc.cores |
The number of cores to parallelize over. |
Ben Domingue [email protected]
Perline, R., Wright, B. D., & Wainer, H. (1979). The Rasch model as additive conjoint measurement. Applied Psychological Measurement, 3(2), 237-255.
###################################################### #parole data #page 244 (table 2) of Perline, Wright, and Wainer #about 9% were bad in perline matrix(c(15,47,61,84,82,86,60,47,8),9,9,byrow=FALSE)->N per <-structure(c(0, 0.06, 0.07, 0.18, 0.13, 0.13, 0.17, 0.17, 1, 0, 0.04, 0.15, 0.24, 0.33, 0.28, 0.47, 0.85, 1, 0, 0.04, 0.08, 0.12, 0.3, 0.64, 0.85, 1, 1, 0, 0.19, 0.39, 0.4, 0.51, 0.58, 0.82, 0.98, 1, 0, 0.06, 0.18, 0.52, 0.73, 0.95, 1, 1, 1, 0, 0.23, 0.33, 0.51, 0.68, 0.91, 0.93, 1, 1, 0.27, 0.51, 0.61, 0.64, 0.68, 0.77, 0.9, 1, 1, 0, 0.21, 0.52, 0.68, 0.84, 0.97, 0.97, 1, 1, 0.73, 0.64, 0.67, 0.7, 0.78, 0.78, 0.9, 1, 1), .Dim = c(9L, 9L) ) round(per*N)->n ConjointChecks(N,n,n.3mat=1)->out ###################################################### #Data from Rasch (1960) data #page 250 (table 5) of Perline, Wright, and Wainer #about 4% showed violations matrix(c(49,112,32,76,82,102,119,133,123,94,61,17,10),13,7,byrow=FALSE)->N per <-structure(c(0, 0, 0, 0, 0.02, 0.01, 0.02, 0.03, 0.06, 0.09, 0.23, 0.35, 0.7, 0.01, 0, 0.04, 0.05, 0.09, 0.09, 0.16, 0.28, 0.39, 0.66, 0.8, 0.91, 0.85, 0, 0.02, 0.07, 0.07, 0.24, 0.28, 0.45, 0.59, 0.76, 0.87, 0.9, 1, 0.85, 0.01, 0.04, 0.12, 0.21, 0.42, 0.62, 0.73, 0.83, 0.9, 0.93, 0.98, 1, 1, 0.06, 0.11, 0.4, 0.7, 0.7, 0.79, 0.84, 0.88, 0.94, 0.95, 0.98, 1, 1, 0.48, 0.84, 0.84, 0.86, 0.86, 0.9, 0.95, 0.96, 0.98, 0.99, 0.99, 1, 1, 0.92, 0.98, 0.98, 0.99, 0.98, 0.99, 0.99, 1, 1, 1, 1, 1, 1), .Dim = c(13L, 7L)) round(per*N)->n ConjointChecks(N,n,n.3mat=1)->out ########### #simulated rasch example n.3mat<-1000 n.items<-20 n.respondents<-2000 #simulate data rnorm(n.items)->diff rnorm(n.respondents)->abil matrix(abil,n.respondents,n.items,byrow=FALSE)->m1 matrix(diff,n.respondents,n.items,byrow=TRUE)->m2 m1-m2 -> kern exp(kern)/(1+exp(kern))->pv runif(n.items*n.respondents)->test ifelse(pv>test,1,0)->resp ##now check PrepareChecks(resp)->tmp ConjointChecks(tmp$N,tmp$n,n.3mat=n.3mat,mc.cores=1)->rasch1000
###################################################### #parole data #page 244 (table 2) of Perline, Wright, and Wainer #about 9% were bad in perline matrix(c(15,47,61,84,82,86,60,47,8),9,9,byrow=FALSE)->N per <-structure(c(0, 0.06, 0.07, 0.18, 0.13, 0.13, 0.17, 0.17, 1, 0, 0.04, 0.15, 0.24, 0.33, 0.28, 0.47, 0.85, 1, 0, 0.04, 0.08, 0.12, 0.3, 0.64, 0.85, 1, 1, 0, 0.19, 0.39, 0.4, 0.51, 0.58, 0.82, 0.98, 1, 0, 0.06, 0.18, 0.52, 0.73, 0.95, 1, 1, 1, 0, 0.23, 0.33, 0.51, 0.68, 0.91, 0.93, 1, 1, 0.27, 0.51, 0.61, 0.64, 0.68, 0.77, 0.9, 1, 1, 0, 0.21, 0.52, 0.68, 0.84, 0.97, 0.97, 1, 1, 0.73, 0.64, 0.67, 0.7, 0.78, 0.78, 0.9, 1, 1), .Dim = c(9L, 9L) ) round(per*N)->n ConjointChecks(N,n,n.3mat=1)->out ###################################################### #Data from Rasch (1960) data #page 250 (table 5) of Perline, Wright, and Wainer #about 4% showed violations matrix(c(49,112,32,76,82,102,119,133,123,94,61,17,10),13,7,byrow=FALSE)->N per <-structure(c(0, 0, 0, 0, 0.02, 0.01, 0.02, 0.03, 0.06, 0.09, 0.23, 0.35, 0.7, 0.01, 0, 0.04, 0.05, 0.09, 0.09, 0.16, 0.28, 0.39, 0.66, 0.8, 0.91, 0.85, 0, 0.02, 0.07, 0.07, 0.24, 0.28, 0.45, 0.59, 0.76, 0.87, 0.9, 1, 0.85, 0.01, 0.04, 0.12, 0.21, 0.42, 0.62, 0.73, 0.83, 0.9, 0.93, 0.98, 1, 1, 0.06, 0.11, 0.4, 0.7, 0.7, 0.79, 0.84, 0.88, 0.94, 0.95, 0.98, 1, 1, 0.48, 0.84, 0.84, 0.86, 0.86, 0.9, 0.95, 0.96, 0.98, 0.99, 0.99, 1, 1, 0.92, 0.98, 0.98, 0.99, 0.98, 0.99, 0.99, 1, 1, 1, 1, 1, 1), .Dim = c(13L, 7L)) round(per*N)->n ConjointChecks(N,n,n.3mat=1)->out ########### #simulated rasch example n.3mat<-1000 n.items<-20 n.respondents<-2000 #simulate data rnorm(n.items)->diff rnorm(n.respondents)->abil matrix(abil,n.respondents,n.items,byrow=FALSE)->m1 matrix(diff,n.respondents,n.items,byrow=TRUE)->m2 m1-m2 -> kern exp(kern)/(1+exp(kern))->pv runif(n.items*n.respondents)->test ifelse(pv>test,1,0)->resp ##now check PrepareChecks(resp)->tmp ConjointChecks(tmp$N,tmp$n,n.3mat=n.3mat,mc.cores=1)->rasch1000
Internal function. Wrapper of the code that checks ONLY the double cancellation bits.
DoubleCancel(N,n,n.3mat=1,CR=c(.025,.975),mc.cores=1)
DoubleCancel(N,n,n.3mat=1,CR=c(.025,.975),mc.cores=1)
N |
Matrix containing the total number of responses. |
n |
Matrix containing the number of correct responses. |
n.3mat |
Number of 3-matrices to sample or the string "adjacent" if all adjacently formed 3-matrices are to be checked. |
CR |
Width of the credible region taken from the
posterior. Defaults to a 95% credible region ( |
mc.cores |
The number of cores to parallelize over. |
Ben Domingue [email protected]
Perline, R., Wright, B. D., & Wainer, H. (1979). The Rasch model as additive conjoint measurement. Applied Psychological Measurement, 3(2), 237-255.
### INTERNAL FUNCTION ###
### INTERNAL FUNCTION ###
The formal S4 class for list.null. This class contains a null list.
Objects of class are used internally.
Object used internally.
Ben Domingue [email protected]
ConjointChecks
, summary.checks
, plot.checks
Internal funcion. This checks to see whether the p-value (rasch difficulty) ordering should be used or if ordering should be 'as is'.
ManyBands(th, se, cc.type, resp, bands=seq(10,50,by=10), uniform.bands=TRUE, trim.window=NULL, pv.order=TRUE,mc.cores=1)
ManyBands(th, se, cc.type, resp, bands=seq(10,50,by=10), uniform.bands=TRUE, trim.window=NULL, pv.order=TRUE,mc.cores=1)
th |
Threshold. |
se |
Standard error. |
cc.type |
Type of cancellation check. |
resp |
resp. |
bands |
Values of the bands. |
uniform.bands |
Is the distribution of the bands uniform? |
trim.window |
trim.window. |
pv.order |
Use the p-value ordering. |
mc.cores |
The number of cores to parallelize over. |
Ben Domingue [email protected]
Perline, R., Wright, B. D., & Wainer, H. (1979). The Rasch model as additive conjoint measurement. Applied Psychological Measurement, 3(2), 237-255.
### INTERNAL FUNCTION ###
### INTERNAL FUNCTION ###
Internal function. This checks both single and double cancellation.
omni.check(N,n,n.iter,burn=1000,thin=4,CR,single)
omni.check(N,n,n.iter,burn=1000,thin=4,CR,single)
N |
Matrix containing the total number of responses. |
n |
Matrix containing the number of correct responses. |
n.iter |
Total number of samples. |
burn |
Number of initial samples that should be discarded. |
thin |
Amount of thinning. |
CR |
Width of the credible region taken from the
posterior. Defaults to a 95% credible region ( |
single |
Also test single cancellation. |
Ben Domingue [email protected]
Perline, R., Wright, B. D., & Wainer, H. (1979). The Rasch model as additive conjoint measurement. Applied Psychological Measurement, 3(2), 237-255.
### INTERNAL FUNCTION ###
### INTERNAL FUNCTION ###
Internal function. Checks ONLY the double cancellation bits.
omni.check_double(N,n,n.iter,burn=1000,thin=4,CR)
omni.check_double(N,n,n.iter,burn=1000,thin=4,CR)
N |
Matrix containing the total number of responses. |
n |
Matrix containing the number of correct responses. |
n.iter |
Total number of samples. |
burn |
Number of initial samples that should be discarded. |
thin |
Amount of thinning. |
CR |
Width of the credible region taken from the
posterior. Defaults to a 95% credible region ( |
Ben Domingue [email protected]
Perline, R., Wright, B. D., & Wainer, H. (1979). The Rasch model as additive conjoint measurement. Applied Psychological Measurement, 3(2), 237-255.
### INTERNAL FUNCTION ###
### INTERNAL FUNCTION ###
Internal function. Code that checks ONLY the single cancellation bits.
omni.check_single(N,n,n.iter,burn=1000,thin=4,CR,single)
omni.check_single(N,n,n.iter,burn=1000,thin=4,CR,single)
N |
Matrix containing the total number of responses. |
n |
Matrix containing the number of correct responses. |
n.iter |
Total number of samples. |
burn |
Number of initial samples that should be discarded. |
thin |
Amount of thinning. |
CR |
Width of the credible region taken from the
posterior. Defaults to a 95% credible region ( |
single |
Also test single cancellation. |
Ben Domingue [email protected]
Perline, R., Wright, B. D., & Wainer, H. (1979). The Rasch model as additive conjoint measurement. Applied Psychological Measurement, 3(2), 237-255.
### INTERNAL FUNCTION ###
### INTERNAL FUNCTION ###
ConjointChecks
.Takes output from ConjointChecks
and produces a matplot
showing
the percentage of reported violations at each cell.
## S3 method for class 'checks' plot(x,items=NULL,item.labels=TRUE,...)
## S3 method for class 'checks' plot(x,items=NULL,item.labels=TRUE,...)
x |
Object returned by |
items |
Vector of item numbers to include in a single plot. Defaults to all, but this is less helpful for diagnostic purposes. |
item.labels |
Should item numbers be included? Defaults to |
... |
further arguments passed to or from other methods |
No return value, called for side effects
Tufte, E. R. (2001). The visual display of quantitative information (2nd ed.). Chesire, CT: Graphics Press.
opar <- par() par(mfrow=c(3,2)) plot(rasch1000) plot(rasch1000,items=c(5,10,15)) for (i in c(3,9,13,18)) plot(rasch1000,items=i) par(opar)
opar <- par() par(mfrow=c(3,2)) plot(rasch1000) plot(rasch1000,items=c(5,10,15)) for (i in c(3,9,13,18)) plot(rasch1000,items=i) par(opar)
ConjointChecks
.Takes output from ConjointChecks
and produces a matrix showing
the percentage of reported violations at each cell.
PrepareChecks(resp,ss.lower=10, collapse.columns = FALSE)
PrepareChecks(resp,ss.lower=10, collapse.columns = FALSE)
resp |
Raw dichotomously coded response data. Columns represent items and rows represent individuals. |
ss.lower |
Only sum scores that have at least this many distinct individuals with that sum score will be used. |
collapse.columns |
Sum over columns. |
Returns n
and N
, respectively, containing the number of
correct responses and the number of total responses for each cell.
#simulated Rasch example n.items<-20 n.respondents<-2000 #simulate data rnorm(n.items)->diff rnorm(n.respondents)->abil matrix(abil,n.respondents,n.items,byrow=FALSE)->m1 matrix(diff,n.respondents,n.items,byrow=TRUE)->m2 m1-m2 -> kern exp(kern)/(1+exp(kern))->pv runif(n.items*n.respondents)->test ifelse(pv>test,1,0)->resp #now check PrepareChecks(resp)->obj
#simulated Rasch example n.items<-20 n.respondents<-2000 #simulate data rnorm(n.items)->diff rnorm(n.respondents)->abil matrix(abil,n.respondents,n.items,byrow=FALSE)->m1 matrix(diff,n.respondents,n.items,byrow=TRUE)->m2 m1-m2 -> kern exp(kern)/(1+exp(kern))->pv runif(n.items*n.respondents)->test ifelse(pv>test,1,0)->resp #now check PrepareChecks(resp)->obj
Object created by first generating Rasch data and then running ConjointChecks
on 1000 sampled 3 matrices
rasch1000
rasch1000
An object of class checks
.
Simulated via Rasch model.
Internal function. Wrapper of the code that checks ONLY the single cancellation bits.
SingleCancel(N,n,CR=c(.025,.975),single,mc.cores=1)
SingleCancel(N,n,CR=c(.025,.975),single,mc.cores=1)
N |
Matrix containing the total number of responses. |
n |
Matrix containing the number of correct responses. |
CR |
Width of the credible region taken from the
posterior. Defaults to a 95% credible region ( |
single |
Also test single cancellation. |
mc.cores |
The number of cores to parallelize over. |
Ben Domingue [email protected]
Perline, R., Wright, B. D., & Wainer, H. (1979). The Rasch model as additive conjoint measurement. Applied Psychological Measurement, 3(2), 237-255.
### INTERNAL FUNCTION ###
### INTERNAL FUNCTION ###
ConjointChecks
.Takes output from ConjointChecks
and produces a matrix showing
the percentage of reported violations at each cell.
## S3 method for class 'checks' summary(object, ...)
## S3 method for class 'checks' summary(object, ...)
object |
Object returned by |
... |
further arguments passed to or from other methods |
No return value, called for side effects
summary(rasch1000)
summary(rasch1000)