wrongProb: Function to find the probability of choosing the wrong...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/wrongProb.R

Description

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.

Usage

1
2
3
4
5
wrongProb(...)
## Default S3 method:
wrongProb(dat, key, ...)
## S3 method for class 'formula'
wrongProb(formula, data, na.action = NULL, subset, key, ...)

Arguments

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 NAs. 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

Value

a list cnotaining the probabilitiy of choosing each incorrect option for each test item appearing on the test.

Author(s)

Harold Doran

See Also

See Also as cheat

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)

wasabi1989/MiscPsycho documentation built on Jan. 19, 2020, 12:29 a.m.