### This script builds a QMatrix inside of S from an Assessment Model ### Description file. ### Load required software library(XML) if(.Platform$OS.type == "unix") { StatShop <- system("echo $STATSHOP", intern=TRUE) } else if(.Platform$OS.type == "windows") { StatShop <- system(paste(Sys.getenv("COMSPEC"),"/c","echo %STATSHOP%"), intern=TRUE) } source(paste(StatShop,"R","Asp","amd.R",sep=.Platform$file.sep)) ### This part of the script reads the assessment model description and ### and builds a collection of parameter objects. ### NOTE: It assume that you have first used setwd() to change to the ### directory containing the amd file. This is necessary or else it ### will not be able to find the associated GM files. ## This command finds the name of the AMD files in the current ## directory. Rest of the script assumes that the first one is the ## one you want to use. amds <- system("ls *.amd.xml",TRUE) ## This version of the command for Assessment Description files, it ## looks at link models. alllmp <- getLMParametersForAMD(amds[1]) ## Uncomment the next line for use with Assessment Model Description ## files, it looks at evidence models. #allemp <- getEMParametersForAMD(amds[1]) ### This command builds the Q-Matrix QM <- buildQMatrix(alllmp) ### This command writes it out. write.table(QM,"QMatrix.csv",sep=",",eol="\r\n") ########################################################## ### Anchors ### The rest of this script is for validating anchors. It works with ### the ICT version 0 model and creates subsets of the Q-Matrix ### corresponding to the anchors. ## Subset Q matrix containing only anchor tasks QMA <- QM[-grep("C1",QM$EM),] QMA <- QMA[-grep("M2",QMA$EM),] QMA <- QMA[-grep("M1 I",QMA$observable),] ## Subsets for each anchor QMAccess <- QMA[grep("Access",QMA$EM),] ## Searchin on just Cr gets both P7 and P4 models QMCreate <- QMA[grep("Cr",QMA$EM),] QMComm <- QMA[grep("Comm",QMA$EM),] QMDefine <- QMA[grep("Define",QMA$EM),] QMEval <- QMA[grep("Eval",QMA$EM),] QMManage <- QMA[grep("Manage",QMA$EM),] QMInt <- QMA[grep("Integrate",QMA$EM),] QMInt <- QMInt[-grep("Create",QMInt$EM),] apply(QMAccess[,4:ncol(QM)],2,sum) apply(QMCreate[,4:ncol(QM)],2,sum) apply(QMComm[,4:ncol(QM)],2,sum) apply(QMDefine[,4:ncol(QM)],2,sum) apply(QMEval[,4:ncol(QM)],2,sum) apply(QMManage[,4:ncol(QM)],2,sum) apply(QMInt[,4:ncol(QM)],2,sum)