# Loading the 'tcals' parameters 
 data(tcals)
 
 # Item bank creation with 'tcals' item parameters
 bank <- createItemBank(tcals)
 # Creation of a starting list: 5 items, initial theta 0, bw 2
 start <- list(nrItems=5, theta=0, halfRange=2)
 # Creation of 'test' list: weighted likelihood
 # estimation of provisional ability, and MEI criterion 
 # for next item selection
 test <- list(method="WL", itemSelect="MEI")
 # Creation of 'final' list: EAP estimation of final
 # ability
 final <- list(method="EAP")
 # Creation of a stopping rule: precision criterion, standard
 # error to be reached 0.3
 stop <- list(rule="precision", thr=0.3)
 # CAT test
 res <- randomCAT(0, bank, start=start, test=test, stop=stop,
 	final=final)
 # New 'test' and 'final' rules (BM and EAP estimation
 # with Jeffreys' prior, randomesque value 5)
 test2 <- list(method="BM", priorDist="Jeffreys", randomesque=5)
 final2 <- list(method="EAP", priorDist="Jeffreys")
 # New stopping rule: classification criterion, with 
 # classification threshold 0 and alpha level 0.05
 stop2 <- list(rule="classification", thr=0, alpha=0.05)
 # CAT test with new 'test', 'stop' and 'final' rules
 res2 <- randomCAT(0, bank, start=start, test=test2, stop=stop2,
 	final=final2)
 # New stopping rule: classification criterion, with 
 # classification threshold 0.5 and alpha level 0.05
 stop3 <- list(rule="classification", thr=0.5, alpha=0.05)
 # CAT test with new 'stop' rule
 res3 <- randomCAT(0, bank, start=start, test=test2, stop=stop3,
 	final=final2)
 # new 'test' and 'stop' rule for next item selection
 test3 <- list(method="WL", itemSelect="MLWI")
 stop4 <- list(rule="length",thr=10)
 res4 <- randomCAT(0, bank, start=start, test=test3, stop=stop4,
 	final=final2)
 # Item bank creation for content balancing
 bank2 <- createItemBank(tcals, cb=TRUE)
 # Creation of the 'cbList' list with arbitrary proportions
 cbList <- list(names=c("Audio1","Audio2","Written1","Written2",
                "Written3"), props=c(0.1,0.2,0.2,0.2,0.3))
 # CAT test with 'start', 'test2', 'stop4' and 'final2' lists
 # and content balancing using 'cbList'
 res5 <- randomCAT(0, bank2, start=start, test=test2, stop=stop4,
 	final=final2, cbControl=cbList)
 # Saving the output in the external 'ou' text file within folder
 # 'Program Files' of hard drive 'C'
 res5 <- randomCAT(0, bank2, start=start, test=test2, stop=stop4,
 	final=final2, cbControl=cbList, save.output = TRUE,
      output=c("out","c:/Program Files/"))
 # Plotting results
 plot(res)
 plot(res, ci=TRUE)
 plot(res, ci=TRUE, trueTh=FALSE)
 plot(res, ci=TRUE, classThr=1)
 # Saving last figure into PDF file 'figure' within folder
 # 'C:/Program Files/'
 plot(res, ci=TRUE, classThr=1, save.plot=TRUE,
      save.options=c("figure","c:/Program Files","pdf"))
 # With mistake
 plot(res, ci=0.05)
 plot(res, classThr=TRUE)Run the code above in your browser using DataLab