R/qdc.zsc.R

Defines functions qdc.zsc

Documented in qdc.zsc

qdc.zsc <- function(results) {
  # Extract the scores of distinguishing statements from an object of class QmethodRes
  nstat <- results$brief$nstat
  nfactors <- results$brief$nfactors
  zsc <- results$zsc
  if (sum(is.na(colSums(zsc)))>0) {
    zsc <- results$zsc[,!is.na(colSums(zsc))>0]
    nfactors <- sum(!is.na(colSums(zsc)))
  }
  dac <- results$qdc$dist.and.cons
  names(dac) <- rownames(results$qdc)
  qdc.zsc <- matrix(NA, nrow=nrow(zsc), ncol=ncol(zsc), dimnames=dimnames(zsc))
  
  # Find which are the distinguishing statements
  for (i in 1:nfactors) {
    qdc.zsc[grep(paste0("all|f", i), dac), i] <- zsc[grep(paste0("all|f", i), dac), i]
  }
  if (nfactors==2) {
    for (i in 1:nfactors) {
      qdc.zsc[grep("Distinguishing", dac), i] <- zsc[grep("Distinguishing", dac), i]
    }
  }
  return(qdc.zsc)
}

Try the qmethod package in your browser

Any scripts or data that you put into this service are public.

qmethod documentation built on April 1, 2023, 12:18 a.m.