wrongProb {MiscPsycho} | R Documentation |
This functions supplements the cheat
function. It uses classical test methods for computing the probability of choosing the incorrect test option to the ith item.
wrongProb(...) ## Default S3 method: wrongProb(dat, key, ...) ## S3 method for class 'formula': wrongProb(formula, data, na.action = NULL, subset, key, ...)
formula |
an object of class "formula" (or one that can be
coerced to that class): a symbolic description of the model
to be fitted. The details of model specification are given
under Details . |
data |
an optional data frame, list or environment (or object
coercible by as.data.frame to a data frame) containing
the variables in the model. If not found in data , the
variables are taken from environment(formula) ,
typically the environment from which cheat is called. |
dat |
A data frame or matrix with item responses. Implemented only for the default method. |
na.action |
a function which indicates what should happen when the data
contain NA s. Defaults to getOption("na.action") . |
subset |
an optional vector specifying a subset of observations to be used. |
key |
a numeric vector containing the correct resposnes to each test item |
... |
Not implemented |
a list cnotaining the probabilitiy of choosing each incorrect option for each test item appearing on the test.
Harold Doran
See Also as cheat
NumStu <- 30 NumItems <- 50 dat <- matrix(0, nrow=NumStu, ncol=NumItems) set.seed(1234) for(i in 1:NumStu){ dat[i,] <- sample(1:4, NumItems, replace=TRUE) } dat <- data.frame(dat) ## Add in explicit answer copying dat[(NumStu+1),] <- dat[NumStu,] dat[(NumStu+2),] <- c(dat[(NumStu-1), 1:25], dat[(NumStu-2), 26:50 ]) ## Answer Key set.seed(1234) key <- sample(1:4, NumItems, replace=TRUE) ## Formula interface ff <- as.formula(paste('~', paste( names(dat), collapse= "+"))) mm <- wrongProb(ff, data = dat, key = key) ## Default interface mm <- wrongProb(dat, key = key)