22
Package ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models. Version 1.3 Date 2014-08-16 Author Dr Chris Wheadon and Dr Ian Stockford Maintainer Dr Chris Wheadon <[email protected]> Description IRT classification uses the probability that candidates of a given ability, will answer correctly questions of a specified difficulty to calculate the probability of their achieving every possible score in a test. Due to the IRT assumption of conditional independence (that is every answer given is assumed to depend only on the latent trait being measured) the probability of candidates achieving these potential scores can be expressed by multiplication of probabilities for item responses for a given ability. Once the true score and the probabilities of achieving all other scores have been determined for a candidate the probability of their score lying in the same category as that of their true score (classification accuracy), or the probability of consistent classification in a category over administrations (classification consistency), can be calculated. License GPL (>= 2) Imports Rcpp (>= 0.9.10), plyr, ggplot2, lattice, methods, R2jags, reshape2 Suggests R2WinBUGS LinkingTo Rcpp Repository CRAN Date/Publication 2014-08-17 12:17:00 Collate 'bugs.R' 'classify.R' 'gpcm.rc.R' 'prob_functions.R' 'scores.R' 'w_lord.R' NeedsCompilation yes 1

Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

  • Upload
    dohuong

  • View
    217

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

Package ‘classify’February 19, 2015

Type Package

Title Classification Accuracy and Consistency under IRT models.

Version 1.3

Date 2014-08-16

Author Dr Chris Wheadon and Dr Ian Stockford

Maintainer Dr Chris Wheadon <[email protected]>

Description IRT classification uses the probability that candidates ofa given ability, will answer correctly questions of a specifieddifficulty to calculate the probability of their achievingevery possible score in a test. Due to the IRT assumption ofconditional independence (that is every answer given is assumedto depend only on the latent trait being measured) theprobability of candidates achieving these potential scores canbe expressed by multiplication of probabilities for itemresponses for a given ability. Once the true score and theprobabilities of achieving all other scores have beendetermined for a candidate the probability of their score lyingin the same category as that of their true score(classification accuracy), or the probability of consistentclassification in a category over administrations(classification consistency), can be calculated.

License GPL (>= 2)

Imports Rcpp (>= 0.9.10), plyr, ggplot2, lattice, methods, R2jags,reshape2

Suggests R2WinBUGS

LinkingTo Rcpp

Repository CRAN

Date/Publication 2014-08-17 12:17:00

Collate 'bugs.R' 'classify.R' 'gpcm.rc.R' 'prob_functions.R''scores.R' 'w_lord.R'

NeedsCompilation yes

1

Page 2: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

2 classify-package

R topics documented:classify-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2across.reps-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7beta.list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8biology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8classification-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9classify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10classify.bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11expected.rc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11gpcm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12gpcm.bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13gpcm.rc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14pcm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15physics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16plot Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16rasch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17scores-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17scores.gpcm.bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18summary-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19thpl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19tpl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20wlord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Index 22

classify-package Classification Accuracy and Consistency under IRT models.

Description

IRT classification uses the probability that candidates of a given ability, will answer correctly ques-tions of a specified difficulty to calculate the probability of their achieving every possible score ina test. Due to the IRT assumption of conditional independence (that is every answer given is as-sumed to depend only on the latent trait being measured) the probability of candidates achievingthese potential scores can be expressed by multiplication of probabilities for item responses for agiven ability. Once the true score and the probabilities of achieving all other scores have been de-termined for a candidate the probability of their score lying in the same category as that of theirtrue score (classification accuracy), or the probability of consistent classification in a category overadministrations (classification consistency), can be calculated.

Details

Package: classifyType: PackageVersion: 1.0Date: 2012-04-30License: GPL (>= 2)

Page 3: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

classify-package 3

Depends: Rcpp (>= 0.9.10), plyr, ggplot2, R2WinBUGS, lattice, reshape2, methods, R2jagsLinkingTo: RcppPackaged: 2012-06-08 12:43:25 UTC; cwheadonBuilt: R 2.15.0; i386-pc-mingw32; 2012-06-08 12:43:33 UTC; windows

Index:

beta.list Extracts Beta Values from Bugs Sims Filebiology Polytomous Responses from 200 Candidates to 31

Questionsclassification-class Class '"classification"'classify Calculate Classification Statisticsclassify-package Classification Accuracy and Consistency under

IRT Modelsclassify.bug Classification Accuracy and Consistency from

Bugs Replicate Parametersgpcm Generalised Partial Credit Model Derived

Probabilitiesgpcm.bug Extracts IRT Model Parameters from Bugs Modelsgpcm.rc IRT Derived Predicted Conditional Number

Correct Score Distributionpcm Partial Credit Model Derived Probabilitiesphysics Dichotomous Responses from 200 Candidates to 25

Questionsplot.scores Plot Methods for Classification and Scores

Objectsrasch Rasch Derived Probabilitiesscores-class Class '"scores"'scores.gpcm.bug Expected and Conditional Summed Score

Distributionssummary-methods Summary Stats for Classification Accuracy and

Consistencythpl Three Parameter IRT Model Derived Probabilitiestpl Two Parameter IRT model Derived Probabilitieswlord Lord and Wingersky Recursion Formula

Author(s)

Dr Chris Wheadon and Dr Ian Stockford

Maintainer: Dr Chris Wheadon <[email protected]>

References

Curtis, S.M.(2010) BUGS Code for Item Response Theory, Journal of Statistical Software, CodeSnippets, 36(1),1–34.

Hanson, B.A., Beguin, A.A.(2002) Obtaining a common scale for item response theory item pa-rameters using separate versus concurrent estimation in the common-item equating design. AppliedPsychological Measurement, 26, 3–24.

Page 4: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

4 classify-package

Kolen M.J., Brennan, R.L. (2004) Test Equating, Scaling, and Linking. Statistics in Social Scienceand Public Policy.

Lee, W. (2008) Classification consistency and accuracy for complex assessments using item re-sponse theory, (No. 27) CASMA Research Report Iowa City, IA: Center for Advanced Studies inMeasurement and Assessment, University of Iowa.

Lord, F., Wingersky, M. (1984) Comparison of IRT true-score and equipercentile observed-scoreequatings, Applied Psychological Measurement, 8, 452–461.

Lunn, D.J., Thomas, A., Best, N., Spiegelhalter, D. (2000) WinBUGS, A Bayesian modellingframework: concepts, structure, and extensibility. Statistics and Computing, 10, 325–337.

Plummer, M (2012) Just Another Gibbs Sampler, version 3.2.0 http://mcmcjags.sourceforge.net/

Swaminathan, H., Hambleton, R. K., Rogers, H. J. (2007) Assessing the fit of Item Response Theorymodels. In C. R. Rao, S. Sinharay (Eds.), Handbook of statistics, Vol. 26, 683–718.

Wheadon, C., (2014) Classification Accuracy and Consistency under Item Response Theory ModelsUsing the Package classify, Journal of Statistical Software, 56(10) 1–14.

Wheadon, C., Stockford, I., (2011) Classification accuracy and consistency in GCSE and A levelexaminations offered by the Assessment and Qualifications Alliance (AQA) November 2008 to June2009, Ofqual’s Reliability Compendium. Office of Qualification and Examinations Regulation.

Examples

## Not run:

## Rasch or 2pl Model

# Data should be a numeric matrix, with one row per candidate, one column per itemdata(physics)# If reading from csv, the following is recommended:# physics<-read.csv("physics.csv", header=TRUE, sep=",", na.strings = "-")# physics<-physics[complete.cases(physics),]# physics<-physics[sample(1:nrow(physics), 200, replace=FALSE),]# physics<-as.matrix(physics)

n <- nrow(physics)p <- ncol(physics)

# Boundary marks in ascending orderbnds <- c(9,11,13,15,18,21)

# Labels for boundaries (one more boundary than label)lbls <- c("U","E","D","C","B","A","A*")

# Specify bugs file - included in the classify/bugs directory# 2 pl modelmdl <- "tpl.bug"# Rasch model# mdl <- "rasch.bug"

# Item marksY <- physics

Page 5: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

classify-package 5

# Mean and standard deviation of deltam.delta <- 0.0s.delta <- 1.0

# Mean and standard deviation of alpha, comment out for Rasch modelm.alpha <- 0.0s.alpha <- 1.0

# Data set for the 2 pl modeldata <- list("Y", "n", "p", "m.delta", "s.delta", "m.alpha", "s.alpha")

# Parameters to monitor for the 2 pl modelmonitor <- c("delta", "theta", "alpha")

# Rasch model# data <- list("Y", "n", "p", "m.delta", "s.delta")# monitor <- c("delta", "theta")

# Set to location of bug filejags.file <- file.path(getwd(), "R/R-2.15.0/library/classify/bugs" ,mdl)

# JAGS# may require set.seed(1234) depending on version of Rsystem.time(jagsout <- jags(data=data, inits=NULL, parameters.to.save=monitor,

model.file=jags.file,n.iter=2000, n.thin=10, n.burnin=1000))

sims <- jagsout$BUGSoutput$sims.matrix

# Bugs# Change this to your bugs directory# bugs.directory = "C:/Program Files/WinBUGS14"# system.time(bugsout <- bugs(data=data, inits=NULL, parameters.to.save=monitor,# model.file=jags.file,# n.iter=2000, n.thin=10, n.burnin=1000))

# sims <- bugsout$sims.matrix

# Estimate conditional score and expected score distributionsscores <- scores.gpcm.bug(Y,sims,mdl)# Plotsplot(scores)# Save plot# ggsave("expected.pdf")plot(scores,type="cond")plot(scores,type="qq",alpha=0.5)

# Estimate accuracy statisticsaccs <- classify.bug(sims,scores,bnds,lbls)summary(accs)plot(accs)plot(accs,type="kappa")

Page 6: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

6 classify-package

plot(accs,type="density")

############################################################################################

## PCM or GPCM models# Data should be a numeric matrix, with one row per candidate, one column per itemdata(biology)# If reading from csv, the following is recommended:# biology<-read.csv("biology.csv", header=TRUE, sep=",", na.strings = "-")# biology<-biology[complete.cases(biology),]# biology<-biology[sample(1:nrow(biology), 200, replace=FALSE),]# biology<-as.matrix(biology)

n <- nrow(biology)p <- ncol(biology)

# Boundary marks in ascending orderbnds <- c(26,30,35,40,45)

# Labels for boundaries (one more boundary than label)lbls <- c("U","E","D","C","B","A")

# Specify bugs file - included in the classify/bugs directory# GPCMmdl <- "gpcm.bug"# PCM#mdl <- "pcm.bug"

# Bugs polytomous models require polytomous scores as categoriesY <- biology + 1# Specify response categoriesK <- as.numeric(apply(Y,2,max,na.rm = TRUE))

# Mean and standard deviation of alpha and beta parameters

m.beta <- 0.0s.beta <- 1.0

# Comment out for PCMm.alpha <- 0.0s.alpha <- 1.0

# GPCMdata <- list("Y", "n", "p", "K","m.beta", "s.beta", "m.alpha", "s.alpha")monitor <- c("beta", "theta", "alpha")

# PCM#data <- list("Y", "n", "p", "K",# "m.beta", "s.beta")#monitor <- c("beta", "theta")

Page 7: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

across.reps-methods 7

# Initial values for beta set to 0, matrix padded with NAbeta <- t(sapply(1:p, function(j) c(rep(NA, K[j]), rep(0.0, max(K) - K[j]))))data <- c(data, "beta")

# Change this to bugs file directoryjags.file <- file.path(getwd(), "R/R-2.15.0/library/classify/bugs" ,mdl)

# Simulations and samplingiter <- 2000burnin <- 1000thin <- 10

## JAGSestimation <- "jags"# may require set.seed(1234) depending on version of Rsystem.time(jagsout <- jags(data=data, inits=NULL, parameters.to.save=monitor,

model.file=jags.file,n.iter=iter, n.thin=thin, n.burnin=burnin))

sims <- jagsout$BUGSoutput$sims.matrix

## Bugs#estimation <- "bugs"# Change this to your bugs directory#bugs.directory = "C:/Program Files/WinBUGS14"#system.time(bugsout <- jags(data=data, inits=NULL, parameters.to.save=monitor,# model.file=jags.file,# n.iter=iter, n.thin=thin, n.burnin=burnin))#sims <- bugsout$sims.matrix

# Estimate conditional score and expected score distributionsscores <- scores.gpcm.bug(biology,sims,mdl)# Plotsplot(scores)# Save plot#ggsave("expected.pdf")plot(scores,type="cond")plot(scores,type="qq",alpha=0.5)

# Estimate accuracy statisticsaccs <- classify.bug(sims,scores,bnds,lbls)summary(accs)plot(accs)plot(accs,type="kappa")plot(accs,type="density")

## End(Not run)

across.reps-methods Summarises classification values across bugs or jags replications

Page 8: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

8 biology

Description

Summarises classification values across bugs or jags replications

Methods

signature(object = "classification")

beta.list Extract Beta Values from Bugs Sims File

Description

Extracts beta values from bugs sims file.

Usage

beta.list(v)

Arguments

v Bugs sims file

Details

Draws heavily on Curtis, S.M.(2010).

Value

Returns list of beta parameters.

References

Curtis, S.M.(2010) BUGS Code for Item Response Theory, Journal of Statistical Software, CodeSnippets, 36(1),1–34

biology Polytomous Responses from 200 Candidates to 31 Questions

Description

Sample data set for polytomous IRT models.

Usage

data(biology)

Format

A matrix containing responses.

Page 9: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

classification-class 9

classification-class Class "classification"

Description

S4 object with classification statistics.

Slots

acc: Classification accuracy summary statistic across replications.

fp: False positive summary statistic across replications.

fn: False negative summary statistic across replications.

cand.acc: Candidate level accuracy across replications.

cand.fn: Candidate level false negative across replications.

cand.fp: Candidate level false positive across replications.

consist: Classification consistency summary statistic across replications.

cand.consist: Candidate level classification consistency across replications.

Xij: Summary matrix of classification probability into all grade combinations.

kappa: Kappa value for classification accuracy across replications.

item.scores: Raw item scores used.

bnds: Grade bounaries used.

tru.grades: Candidate grades.

tru.scores: Candidate true scores.

acc.by.grade: Accuracy by grade.

fp.by.grade: False positive by grade.

fn.by.grade: False negative by grade.

consist.by.grade: Consistency by grade.

labels: Grade labels.

m.acc: Mean of Classification accuracy summary statistic across replications.

m.consist: Mean of Candidate level classification consistency across replications.

m.kappa: Mean of Kappa value for classification accuracy across replications.

m.fp: Mean of Candidate level false positive across replications.

m.fn: Mean of Candidate level false negative across replications.

sd.acc: SD of Classification accuracy summary statistic across replications.

sd.consist: SD of Candidate level classification consistency across replications.

sd.kappa: SD of Kappa value for classification accuracy across replications.

sd.fp: SD of Candidate level false positive across replications.

sd.fn: SD of Candidate level false negative across replications.

Page 10: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

10 classify

m.acc.by.grade: Mean accuracy by grade.m.fp.by.grade: Mean false positive by grade.m.fn.by.grade: Mean false negative by grade.m.consist.by.grade: Mean consistency by grade.max: Maximum test score.

Methods

plot Plots.across.reps Summarise stats across replications.summary Summary statistics.

classify Calculate Classification Statistics

Description

Internal function to calculate classification statistics.

Usage

classify(cssd, expected, bnds, cats, lbls=NULL)

Arguments

cssd Conditional Summed Score Distributionexpected Numeric vector of Expected Scoresbnds Numeric vector of grade boundaries, specified in ascending order, including the

minimum and maximum mark on the test.cats Numeric vector of item categories.lbls Character vector of grade labels. Optional.

Value

List of classification statistics:Candidate level accuracyCandidate level false negativesCandidate level false positivesSummary of consistencyMatrix of grade probability combinationsKappaCandidate level classification consistencySummary of accuracy by gradeSummary of false positives by gradeSummary of false negatives by gradeSummary of consistency by grade

Page 11: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

classify.bug 11

classify.bug Classification Accuracy and Consistency from Bugs Replicate Param-eters

Description

Calculates classification statistics under IRT models in bugs.

Usage

classify.bug(sims, scores, bnds, lbls=NULL)

Arguments

sims bugs sims matrix.

scores scores

bnds Numeric vector of grade boundaries, monotonically increasing.

lbls Character vector of grade labels. Optional.

Details

Calculates classification statistics under IRT models in bugs.

Value

classification

expected.rc Expected scores under the PCM or the GPCM.

Description

Calculates expected scores under the PCM or the GPCM.

Usage

expected.rc(beta=NULL,theta=NULL,cats=NULL,alpha=NULL)

Arguments

beta Matrix of Beta parameters

theta Vector of Theta parameters

cats Vector Item category parameters

alpha Vector of Alpha parameters (optional)

Page 12: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

12 gpcm

Details

The beta parameters are the intersection points of adjacent category information functions. Thereshould be one less delta parameter than categories. Assumes that the location parameter is zero. Ifno alpha parameters are supplied it assumes the PCM.

Value

Vector of expected scores

Examples

#One item with three categoriesbeta <- matrix(c(0,-1.586,-3.798),nrow=1,ncol=3)theta <- 0.674cats <- 3alpha <- 1expected.rc(beta,theta,cats,alpha)

gpcm Generalised Partial Credit Model Derived Probabilities

Description

Calculate vector of probabilities of success from person and item parameters under the GeneralisedPartial Credit Model.

Usage

gpcm(theta=NULL,alpha=NULL,delta=NULL,n=NULL)

Arguments

theta Theta parameter

alpha Alpha parameter

delta Vector of delta parameters

n Number of item categories

Details

The delta parameters are the intersection points of adjacent category information functions. Thereshould be one less delta parameter than categories. Assumes that the location parameter is zero

Value

Vector of probabilities of success

Page 13: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

gpcm.bug 13

Examples

## Generalized Partial Credit Model## Item parameters from Embretson & Reise (2000, p. 112) item 5theta <- 1alpha <- .683delta <- c(-3.513,-.041,.182)n <- 4gpcm(theta,alpha,delta,n)

gpcm.bug Extract IRT Model Parameters from Bugs Models

Description

Internal function which draws heavily on Curtis, S.M.(2010).

Usage

gpcm.bug(v, cats, mdl, gibbs=c("bugs","jags"))

Arguments

v Bugs sims matrix

cats Numeric vector of item categories

mdl Bugs file: Partial Credit Model - "pcm.bug" or Generalised Partial Credit Model- "gpcm.bug" or Rasch model - "rasch.bug" or 2pl model "tpl.bug"

gibbs Gibbs sampler: "bugs" or "jags"

Details

Extracts IRT Model Parameters from Bugs Models

Value

List with theta and beta parameters

References

Curtis, S.M.(2010) BUGS Code for Item Response Theory, Journal of Statistical Software, CodeSnippets, 36(1),1–34

Page 14: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

14 gpcm.rc

gpcm.rc IRT Derived Predicted Conditional Number Correct Score Distribu-tion

Description

Obtains the predicted number-correct score distribution from parameters estimated under the Gen-eralised Partial Credit Model.

Usage

gpcm.rc(beta=NULL,theta=NULL,cats=NULL,alpha=NULL)

Arguments

beta Item threshold parameters. These should be a matrix, with rows for items andcolumns for categories. Following Muraki, the first column should be zero.

theta Theta parameters

cats Vector of item categories. A dichotomous item is specified as two categories.

alpha Discrimination parameters. If none are specified the model will default to thePartial Credit Model.

Details

The beta parameters are defined as the intersection points of adjacent category information func-tions. There should be the same number of beta parameters as categories, with the first column,following Muraki, specified as zero.

Value

Vector of probabilities of achieving any item score

Examples

beta <- matrix(c(0,-1.586,-3.798),nrow=1,ncol=3)theta <- 0.674cats <- 3alpha <- 1gpcm.rc(beta,theta,cats,alpha)

Page 15: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

pcm 15

pcm Partial Credit Model Derived Probabilities

Description

Calculate vector of probabilities of success from person and item parameters under the Partial CreditModel.

Usage

pcm(theta=NULL, delta=NULL, n=NULL)

Arguments

theta Theta parameter

delta Vector of delta parameters

n Number of item categories

Details

The delta parameters are the intersection points of adjacent category information functions. Thereshould be one less delta parameter than categories.

Value

Vector of probabilities of success

Examples

# Example from The Theory and Practice of Item Response Theory# By Rafael Jaime De Ayala# p.204theta <- 0n <- 3d <- c(-1,1)

pcm(theta,d,n)

#0.2119416 0.5761169 0.2119416

Page 16: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

16 plot Classification

physics Dichotomous Responses from 200 Candidates to 25 Questions

Description

Sample data set for the Rasch and 2PL models.

Usage

data(physics)

Format

A matrix containing responses.

plot Classification Plot Methods for Classification and Scores s4 objects

Description

Produces various plots of score distributions and classification statistics.

Usage

## S3 method for class 'scores'plot(x, type = c("exp","cond","qq"),alpha = 0.05, ...)## S3 method for class 'classification'plot(x, type = c("acc", "kappa", "density"), ...)

Arguments

x an object inheriting either from class scores or class classificationtype the type of plot:

"exp": Expected summed scores compared to observed"cond": Conditional summed scores compared to observed"qq": QQ plot of conditional summed scores compared to observed"acc": Classification accuracy"kappa": Kappa"density" Density

alpha Alpha value for points on qq plot.... extra graphical parameters

Details

Produces various plots of score distributions and classification statistics.

Page 17: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

rasch 17

rasch Rasch Derived Probabilities

Description

Calculate vector of probabilities of success from person and item parameters under the Rasch model.

Usage

rasch(theta=NULL, delta=NULL)

Arguments

theta Vector of theta parameters

delta Vector of delta parameters

Details

Calculates vector of probabilities of success from person and item parameters under the Raschmodel.

Value

Vector of probabilities of success, persons in columns, items in rows

Examples

theta <- c(-5:5)delta <- c(-5:5)rasch(theta,delta)

scores-class Class "scores"

Description

S4 object for score distributions.

Page 18: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

18 scores.gpcm.bug

Slots

item: Item scores

expected: Expected scores

conditional: Conditional Summed scores

summed: Summed scores

persons: Number of persons

items: Number of items

sims: Number of simulations

max: Maximum test score

cats: Item categories

model: Bugs model

estimation: Bugs estimation software

scores.gpcm.bug Expected and Conditional Summed Score Distributions

Description

Obtains the predicted number-correct score distribution from the IRT models specified in the bugsfiles pcm.bug, gpcm.bug, rasch.bug, tpl.bug.

Usage

scores.gpcm.bug(item.scores,sims,mdl = c("rasch.bug", "pcm.bug", "tpl.bug","gpcm.bug"),gibbs = c("bugs","jags"))

Arguments

item.scores Matrix of item scores, one candidate per row.

sims Winbugs sims matrix

mdl Bugs file: "rasch.bug", "pcm.bug", "tpl.bug", "gpcm.bug"

gibbs Gibbs sampler: "bugs" or "jags"

Value

an object of class scores

Page 19: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

summary-methods 19

summary-methods Summary Statistics for S4 Class Classification

Description

Summary Statistics for S4 Class Classification

Methods

signature(object = "classification") Produces summary statistics from the S4 classifica-tion object.

thpl Three Parameter IRT Model Derived Probabilities

Description

Calculate vector of probabilities of success from person and item parameters under the 3pl IRTmodel.

Usage

thpl(theta=NULL,beta=NULL,alpha=NULL,eta=NULL)

Arguments

theta Vector of theta parametersbeta Vector of beta parametersalpha Vector of alpha parameterseta Vector of eta parameters

Details

Three Parameter IRT Model Derived Probabilities

Value

Vector of probabilities of success, persons in columns, items in rows

Examples

theta <- c(-2:2)beta <- rep(0,5)alpha <- rep(1,5)eta <- seq(from=0.2,by=0.2,to=1)thpl(theta,beta,alpha,eta)

Page 20: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

20 wlord

tpl Two Parameter IRT Model Derived Probabilities

Description

Calculate vector of probabilities of success from person and item parameters under the 2pl IRTmodel.

Usage

tpl(theta=NULL, beta=NULL, alpha=NULL)

Arguments

theta Vector of theta parameters

beta Vector of beta parameters

alpha Vector of alpha parameters

Details

Calculates vector of probabilities of success from person and item parameters under the 2pl IRTmodel.

Value

Vector of probabilities of success, persons in columns, items in rows

Examples

theta <- c(-2:2)beta <- rep(0,5)alpha <- seq(from=0.2,by=0.2,to=1)tpl(theta,beta,alpha)

wlord Lord and Wingersky Recursion Formula

Description

The Lord and Wingersky Recursion Formula allows for efficient computation of the predictednumber-correct score distribution (also known as the expected score distribution) given probabilitiesof correct responses to items.

Page 21: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

wlord 21

Usage

wlord(probs=NULL,cats=NULL)

Arguments

probs Probability matrix specifying the probability of achieving each category. Thereshould be one row per item and one column per category. Where the number ofcategories differs between items, the matrix should be padded with zeros.

cats Numeric vector specifying the number of categories in each item. A dichoto-mous item, for example, has two categories.

Details

The Lord and Wingersky Recursion Formula is a particularly useful short-cut in computations withthe probabilities derived from IRT models. The algorithm simplifies the process of calculating thecompound probabilities involved when the probability of achieving any score on an assessmentinstrument is required. It is essentially an elegant solution to combining the probabilities of re-sponding in any particular category with the multiple ways in which any test score can be achievedthrough responses to different categories on different items.

Value

A vector of probabilities of achieving every test score

References

Kolen MJ, Brennan RL (2004). Test Equating, Scaling, and Linking. Statistics in Social Scienceand Public Policy. Springer, New York.Lord F, Wingersky M (1984). Comparison of IRT true-score and equipercentile observed-scoreequatings. Applied Psychological Measurement, 8, 452-461.

Examples

#This reproduces the example on page 183 of Kolen & Brennan (2004)probs <- matrix(c(.74,.73,.82,.26,.27,.18),nrow=3,ncol=2, byrow = FALSE)cats <- c(2,2,2)wlord(probs,cats)

Page 22: Package ‘classify’ - The Comprehensive R Archive … ‘classify’ February 19, 2015 Type Package Title Classification Accuracy and Consistency under IRT models

Index

∗Topic bugsclassify-package, 2

∗Topic classificationclassify-package, 2

∗Topic irtclassify-package, 2

∗Topic jagsclassify-package, 2

∗Topic packageclassify-package, 2

∗Topic reliabilityclassify-package, 2

∗Topic winbugsclassify-package, 2

across-reps (classification-class), 9across.reps (across.reps-methods), 7across.reps,classification-method

(across.reps-methods), 7across.reps-methods, 7

beta.list, 8biology, 8

classification, 11classification (classification-class), 9classification-class, 9classify, 10classify-package, 2classify.bug, 11

expected.rc, 11

gpcm, 12gpcm.bug, 13gpcm.rc, 14

pcm, 15physics, 16plot Classification, 16

plot.classification (plotClassification), 16

plot.scores (plot Classification), 16

rasch, 17

scores, 11, 18scores,missing-method (scores-class), 17scores-class, 17scores.gpcm.bug, 18summary (summary-methods), 19summary,classification-method

(summary-methods), 19summary-methods, 19

thpl, 19tpl, 20

wlord, 20

22