From d6e74c2e006885e9c7fe22bc031f79174e2b2d07 Mon Sep 17 00:00:00 2001 From: Koen Derks Date: Fri, 22 Nov 2024 14:04:44 +0100 Subject: [PATCH 1/6] Add ctt --- NAMESPACE | 1 + R/classicaltesttheory.R | 362 +++++++++++++++ inst/Description.qml | 5 + inst/qml/classicalTestTheory.qml | 143 ++++++ tests/testthat/binary.csv | 100 ++++ tests/testthat/binary2.csv | 51 +++ tests/testthat/scored.csv | 100 ++++ tests/testthat/scored2.csv | 74 +++ tests/testthat/test-classicaltesttheory.R | 533 ++++++++++++++++++++++ 9 files changed, 1369 insertions(+) create mode 100755 R/classicaltesttheory.R create mode 100755 inst/qml/classicalTestTheory.qml create mode 100644 tests/testthat/binary.csv create mode 100644 tests/testthat/binary2.csv create mode 100755 tests/testthat/scored.csv create mode 100644 tests/testthat/scored2.csv create mode 100644 tests/testthat/test-classicaltesttheory.R diff --git a/NAMESPACE b/NAMESPACE index 24c60671..90fbba43 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -6,6 +6,7 @@ export(raterAgreement) export(standardErrorOfMeasurement) export(unidimensionalReliabilityBayesian) export(unidimensionalReliabilityFrequentist) +export(classicalTestTheory) importFrom(jaspBase,.quitAnalysis) importFrom(jaspBase,.readDataSetToEnd) importFrom(jaspBase,createJaspContainer) diff --git a/R/classicaltesttheory.R b/R/classicaltesttheory.R new file mode 100755 index 00000000..29952ca7 --- /dev/null +++ b/R/classicaltesttheory.R @@ -0,0 +1,362 @@ +# +# Copyright (C) 2013-2023 University of Amsterdam +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +classicalTestTheory <- function(jaspResults, dataset, options, ...) { + dataset <- .cttReadData(dataset, options) + ready <- .cttReady(options) + + # Create the summary table + .irtCTTSummaryTable(dataset, options, jaspResults, ready, position = 1) + + # Create the descriptives table + .irtCTTDescriptivesTable(dataset, options, jaspResults, ready, position = 3) + + # Create the Cronbachs alpha table + .irtCTTAlphaTable(dataset, options, jaspResults, ready, position = 5) + + # Create the item statistics table + .irtCTTItemStatisticsTable(dataset, options, jaspResults, ready, position = 7) + + # Create the histogram of test scores + .irtCTTHistogram(dataset, options, jaspResults, ready, position = 9) + + # Create the difficulty and discrimination plot + .irtCTTDiscrimination(dataset, options, jaspResults, ready, position = 11) + + # Create the correlation heatmap + .irtCTTHeatmap(dataset, options, jaspResults, ready, position = 13) +} + +.cttReadData <- function(dataset, options) { + variables <- unlist(options[["items"]]) + variables <- variables[variables != ""] + dataset <- jaspBase::excludeNaListwise(dataset, variables) + .hasErrors(dataset, + type = c("infinity", "observations"), + all.target = c(options[["items"]], options[["covariates"]]), + observations.amount = paste0("< ", nrow(dataset)) + ) + return(dataset) +} + +.cttReady <- function(options) { + ready <- length(options[["items"]]) > 1 && all(unlist(options[["items"]]) != "") + return(ready) +} + +.irtCTTState <- function(dataset, options, jaspResults) { + if (!is.null(jaspResults[["state"]])) { + return(jaspResults[["state"]]$object) + } + p <- try({ + items <- dataset[, unlist(options[["items"]]), drop = FALSE] + if (!options[["customMaxScore"]]) { + maxScores <- apply(items, 2, max) + } else { + maxScores <- items[1, ] + items <- items[-1, ] + } + sumScores <- rowSums(items) + maxScore <- sum(maxScores) + descriptives <- data.frame( + items = length(options[["items"]]), + n = nrow(items), + min = min(sumScores, na.rm = TRUE), + max = max(sumScores, na.rm = TRUE), + mean = mean(sumScores, na.rm = TRUE), + median = median(sumScores, na.rm = TRUE), + sd = sd(sumScores, na.rm = TRUE), + skew = moments::skewness(sumScores, na.rm = TRUE), + kurt = moments::kurtosis(sumScores, na.rm = TRUE) + ) + rir <- alpha <- numeric(length(options[["items"]])) + for (i in seq_along(options[["items"]])) { + rir[i] <- cor(items[, i], rowSums(items[, -i, drop = FALSE])) + if (ncol(items) > 2) { + alpha[i] <- ltm::cronbach.alpha(items[, -i, drop = FALSE])[["alpha"]] + } else { + alpha[i] <- NA + } + } + itemInfo <- data.frame( + item = unlist(options[["items"]]), + score = as.numeric(colMeans(items)), + sd = as.numeric(apply(items, 2, sd)), + rit = as.numeric(apply(items, 2, function(x) cor(x, rowSums(items)))), + rir = rir, + p = as.numeric(colMeans(items) / maxScores), + alpha = alpha + ) + result <- list() + result[["items"]] <- items + result[["avgP"]] <- mean(itemInfo[["p"]], na.rm = TRUE) + result[["avgRit"]] <- mean(itemInfo[["rit"]], na.rm = TRUE) + result[["avgRir"]] <- mean(itemInfo[["rir"]], na.rm = TRUE) + result[["maxScore"]] <- maxScore + result[["maxScores"]] <- maxScores + result[["sumScores"]] <- sumScores + result[["descriptives"]] <- descriptives + result[["itemInfo"]] <- itemInfo + result[["cronbach"]] <- ltm::cronbach.alpha(items, CI = TRUE, probs = c((1 - options[["tableCronbachsAlphaCI"]]) / 2, options[["tableCronbachsAlphaCI"]] + (1 - options[["tableCronbachsAlphaCI"]]) / 2)) + }) + if (jaspBase:::isTryError(p)) { + jaspBase:::.quitAnalysis(gettextf("An error occurred in the analysis: %1$s", jaspBase:::.extractErrorMessage(p))) + } + jaspResults[["state"]] <- createJaspState(result) + jaspResults[["state"]]$dependOn(options = .irtCommonDeps(type = "ctt")) + return(jaspResults[["state"]]$object) +} + +.irtCTTSummaryTable <- function(dataset, options, jaspResults, ready, position) { + if (options[["explanatoryText"]]) { + text <- createJaspHtml(gettext("

Explanatory Text: Classical Test Theory

Classical Test Theory (CTT) is a framework for assessing and understanding the reliability and validity of psychological and educational tests. It suggests that an observed test score is composed of two components: the true score (the actual ability being measured) and noise (random variability in test scores). CTT focuses on quantifying and separating these components to evaluate the quality and consistency of a test.")) + text$position <- position + text$dependOn(options = "explanatoryText") + jaspResults[["tableSummaryText"]] <- text + } + if (!is.null(jaspResults[["tableSummary"]])) { + return() + } + # Table + tb <- createJaspTable(title = gettext("Test Summary")) + tb$position <- position + 1 + tb$addColumnInfo(name = "items", title = gettext("Items"), type = "integer") + tb$addColumnInfo(name = "n", title = gettext("Respondents"), type = "integer") + tb$addColumnInfo(name = "avgp", title = gettext("Avg. difficulty (P)"), type = "number") + tb$addColumnInfo(name = "avgrit", title = gettext("Avg. ritem-total"), type = "number") + tb$addColumnInfo(name = "avgrir", title = gettext("Avg. ritem-rest"), type = "number") + tb$dependOn(options = .irtCommonDeps(type = "ctt")) + jaspResults[["tableSummary"]] <- tb + if (!ready) { + tb$addFootnote(gettext("The maximum possible test score is ....")) + return() + } + state <- .irtCTTState(dataset, options, jaspResults) + tb[["items"]] <- state[["descriptives"]][["items"]] + tb[["n"]] <- state[["descriptives"]][["n"]] + tb[["avgp"]] <- state[["avgP"]] + tb[["avgrit"]] <- state[["avgRit"]] + tb[["avgrir"]] <- state[["avgRir"]] + tb$addFootnote(gettextf("The maximum possible test score is %1$s.", state[["maxScore"]])) +} + +.irtCTTDescriptivesTable <- function(dataset, options, jaspResults, ready, position) { + if (options[["explanatoryText"]] && options[["tableDescriptives"]]) { + text <- createJaspHtml(gettext("

Explanatory Text: Descriptive Statistics

The table below provides descriptive statistics the test scores (i.e., sum of item scores). It includes information about the lowest and highest recorded test score, the average (mean), the middle point (median), a measure of how spread out the scores are (standard deviation), and two measures that describe the shape of the score distribution (skewness and kurtosis).")) + text$position <- position + text$dependOn(options = c("explanatoryText", "tableDescriptives")) + jaspResults[["tableDescriptivesText"]] <- text + } + if (!is.null(jaspResults[["tableDescriptives"]]) || !options[["tableDescriptives"]]) { + return() + } + tb <- createJaspTable(title = gettext("Descriptive Statistics of Sum Scores")) + tb$position <- position + 1 + tb$addColumnInfo(name = "min", title = gettext("Min."), type = "number") + tb$addColumnInfo(name = "max", title = gettext("Max."), type = "number") + tb$addColumnInfo(name = "mean", title = gettext("Mean"), type = "number") + tb$addColumnInfo(name = "median", title = gettext("Median"), type = "number") + tb$addColumnInfo(name = "sd", title = gettext("Std. dev"), type = "number") + tb$addColumnInfo(name = "skew", title = gettext("Skewness"), type = "number") + tb$addColumnInfo(name = "kurt", title = gettext("Kurtosis"), type = "number") + tb$dependOn(options = c(.irtCommonDeps(type = "ctt"), "tableDescriptives")) + jaspResults[["tableDescriptives"]] <- tb + if (!ready) { + return() + } + state <- .irtCTTState(dataset, options, jaspResults) + tb[["min"]] <- state[["descriptives"]][["min"]] + tb[["max"]] <- state[["descriptives"]][["max"]] + tb[["mean"]] <- state[["descriptives"]][["mean"]] + tb[["median"]] <- state[["descriptives"]][["median"]] + tb[["sd"]] <- state[["descriptives"]][["sd"]] + tb[["skew"]] <- state[["descriptives"]][["skew"]] + tb[["kurt"]] <- state[["descriptives"]][["kurt"]] +} + +.irtCTTAlphaTable <- function(dataset, options, jaspResults, ready, position) { + if (options[["explanatoryText"]] && options[["tableCronbachsAlpha"]]) { + text <- createJaspHtml(gettextf("

Explanatory Text: Test Reliability

Cronbach's %1$s is a way to quantify how reliable (i.e., consistent) a test is. It tells us if all the questions in the test are measuring the same construct. This helps to understand if the test is consistent and if it is a good measure of what it is supposed to measure. When interpreting Cronbach's %1$s for a test, a high %1$s value (i.e., close to 1) indicates good internal consistency, suggesting that the test items are reliably measuring the same construct. On the other hand, a low %1$s value (i.e., close to 0) may suggest that some items in the assessment are not contributing to the overall measurement consistency and might need revision or removal. A rule of thumb is that a 'good' test has at least an %1$s value of 0.8.", "\u03B1")) + text$position <- position + text$dependOn(options = c("explanatoryText", "tableCronbachsAlpha")) + jaspResults[["tableCronbachsAlphaText"]] <- text + } + if (!is.null(jaspResults[["tableCronbachsAlpha"]]) || !options[["tableCronbachsAlpha"]]) { + return() + } + tb <- createJaspTable(title = gettext("Test Reliability")) + tb$position <- position + 1 + tb$addColumnInfo(name = "alpha", title = gettextf("Cronbach's %1$s", "\u03B1"), type = "number") + overtitle <- gettextf("%1$s%% Confidence interval", round(options[["tableCronbachsAlphaCI"]] * 100, 3)) + tb$addColumnInfo(name = "alpha_lower", title = gettext("Lower"), type = "number", overtitle = overtitle) + tb$addColumnInfo(name = "alpha_upper", title = gettext("Upper"), type = "number", overtitle = overtitle) + tb$dependOn(options = c(.irtCommonDeps(type = "ctt"), "tableCronbachsAlpha")) + jaspResults[["tableCronbachsAlpha"]] <- tb + if (!ready) { + return() + } + if (length(options[["items"]]) < 2) { + tb$addFootnote(gettext("There must be at least two items to compute Cronbach's alpha.")) + return() + } + state <- .irtCTTState(dataset, options, jaspResults) + tb[["alpha"]] <- state[["cronbach"]][["alpha"]] + tb[["alpha_lower"]] <- as.numeric(state[["cronbach"]][["ci"]][1]) + tb[["alpha_upper"]] <- as.numeric(state[["cronbach"]][["ci"]][2]) +} + +.irtCTTItemStatisticsTable <- function(dataset, options, jaspResults, ready, position) { + if (options[["explanatoryText"]] && options[["tableItemStatistics"]]) { + text <- createJaspHtml(gettextf("

Explanatory Text: Item Information

In educational testing and assessment, several statistics can evaluate the performance and quality of test items. These statistics help us understand how well each question or item is working and contributing to the overall quality of the test. Let's break down these important concepts in a straightforward manner:\n\n1. Avg. Score: This is the typical score that people get on a specific test item. It gives us an idea of how well test-takers are performing on that particular question.\n2. Std. dev: Standard deviation is a measure of how much individual scores on a test item vary from the average score. It helps us see how consistent or spread out the scores are for that item.\n3. Difficulty (P): Difficulty refers to how hard or easy a test item is for the test-takers. We estimate this by looking at the average score that people achieve on the item, and then we divide it by the range of possible scores. Essentially, it helps us understand if the item is generally difficult or not.\n4. ritem-total, ritem-rest: These correlations indicate how well a specific test item relates to the overall test score and how it relates to the rest of the test items. In simple terms, they show how closely linked the item is to the overall performance and to the other questions in the test.\n5. %1$s if removed: Cronbach's %1$s is a measure of the internal consistency or reliability of a test. The column represents what happens to the reliability of the test when a particular item is removed. It helps us assess how important or unimportant a specific question is for the overall reliability of the test.", "\u03B1")) + text$position <- position + text$dependOn(options = c("explanatoryText", "tableItemStatistics")) + jaspResults[["tableItemStatisticsText"]] <- text + } + if (!is.null(jaspResults[["tableItemStatistics"]]) || !options[["tableItemStatistics"]]) { + return() + } + tb <- createJaspTable(title = gettext("Item Information")) + tb$position <- position + 1 + tb$addColumnInfo(name = "item", title = gettext("Item"), type = "string") + tb$addColumnInfo(name = "score", title = gettext("Avg. score"), type = "number") + tb$addColumnInfo(name = "sd", title = gettext("Std. dev"), type = "number") + tb$addColumnInfo(name = "p", title = gettext("Difficulty (P)"), type = "number") + tb$addColumnInfo(name = "rit", title = gettext("ritem-total"), type = "number") + tb$addColumnInfo(name = "rir", title = gettext("ritem-rest"), type = "number") + tb$addColumnInfo(name = "alpha", title = gettextf("%1$s if removed", "\u03B1"), type = "number") + tb$dependOn(options = c(.irtCommonDeps(type = "ctt"), "tableItemStatistics")) + jaspResults[["tableItemStatistics"]] <- tb + if (!ready) { + return() + } + state <- .irtCTTState(dataset, options, jaspResults) + tb[["item"]] <- state[["itemInfo"]][["item"]] + tb[["score"]] <- state[["itemInfo"]][["score"]] + tb[["sd"]] <- state[["itemInfo"]][["sd"]] + tb[["p"]] <- state[["itemInfo"]][["p"]] + tb[["rit"]] <- state[["itemInfo"]][["rit"]] + tb[["rir"]] <- state[["itemInfo"]][["rir"]] + tb[["alpha"]] <- state[["itemInfo"]][["alpha"]] +} + +.irtCTTHistogram <- function(dataset, options, jaspResults, ready, position) { + if (options[["explanatoryText"]] && options[["plotHistogram"]]) { + text <- createJaspHtml(gettext("

Explanatory Text: Histogram of Sum Scores

The figure below displays a histogram of the test (i.e., sum) scores. It shows the frequencies of different total scores or sums of responses, which can help you understand the central tendency and variability of the data. Additionally, you can assess patterns or trends in the distribution, such as skewness or bimodality,")) + text$position <- position + text$dependOn(options = c("explanatoryText", "plotHistogram")) + jaspResults[["plotHistogramText"]] <- text + } + if (!is.null(jaspResults[["plotHistogram"]]) || !options[["plotHistogram"]]) { + return() + } + fg <- createJaspPlot(title = gettext("Histogram of Sum Scores"), height = 320, width = 480) + fg$position <- position + 1 + fg$dependOn(options = c(.irtCommonDeps(type = "ctt"), "plotHistogram")) + jaspResults[["plotHistogram"]] <- fg + if (!ready) { + return() + } + state <- .irtCTTState(dataset, options, jaspResults) + plotdata <- data.frame(x = seq_len(state[["maxScore"]]), y = rep(NA, state[["maxScore"]])) + for (i in seq_len(state[["maxScore"]])) { + plotdata$y[i] <- length(which(state[["sumScores"]] < i & state[["sumScores"]] >= (i - 1))) + } + xBreaks <- jaspGraphs::getPrettyAxisBreaks(plotdata$x, min.n = 4) + yBreaks <- jaspGraphs::getPrettyAxisBreaks(plotdata$y, min.n = 4) + p <- ggplot2::ggplot(data = plotdata, mapping = ggplot2::aes(x = x, y = y)) + + ggplot2::geom_col(fill = "lightgray", col = "black") + + ggplot2::scale_x_continuous(name = gettext("Sum Score"), breaks = xBreaks, limits = range(xBreaks)) + + ggplot2::scale_y_continuous(name = gettext("Counts"), breaks = yBreaks, limits = range(yBreaks)) + + jaspGraphs::geom_rangeframe() + + jaspGraphs::themeJaspRaw() + fg$plotObject <- p +} + +.irtCTTDiscrimination <- function(dataset, options, jaspResults, ready, position) { + if (options[["explanatoryText"]] && options[["plotItems"]]) { + text <- createJaspHtml(gettext("

Explanatory Text: Difficulty and Discrimination Plot

The figure below displays a bar chart of the item difficulty (measured by P) and discrimination (measured by ritem-total or Rit). This figure shows which items were the easiest to answer (left) and which items were the most difficult to answer (right).")) + text$position <- position + text$dependOn(options = c("explanatoryText", "plotItems")) + jaspResults[["plotItemsText"]] <- text + } + if (!is.null(jaspResults[["plotItems"]]) || !options[["plotItems"]]) { + return() + } + fg <- createJaspPlot(title = gettext("Item Difficulty and Discrimination Plot"), height = 320, width = 750) + fg$position <- position + fg$dependOn(options = c(.irtCommonDeps(type = "ctt"), "plotItems")) + jaspResults[["plotItems"]] <- fg + if (!ready) { + return() + } + state <- .irtCTTState(dataset, options, jaspResults) + plotdata <- data.frame( + x = factor(rep(options[["items"]], 2)), + y = c(state[["itemInfo"]][["p"]], state[["itemInfo"]][["rit"]]), + type = c(rep(gettext("Difficulty (P)"), length(options[["items"]])), rep(gettext("Discrimination (Rit)"), length(options[["items"]]))) + ) + plotdata$x <- factor(plotdata$x, levels = plotdata$x[order(subset(plotdata$y, plotdata$type == gettext("Difficulty (P)")))]) + xxName <- gettext("difficulty") + yBreaks <- jaspGraphs::getPrettyAxisBreaks(c(0, plotdata$y), min.n = 4) + xName <- gettextf("Item (ordered by %1$s)", xxName) + p <- ggplot2::ggplot(data = plotdata, mapping = ggplot2::aes(x = x, y = y, fill = type)) + + ggplot2::geom_col(position = ggplot2::position_dodge(0.75), col = "black", width = 0.75) + + ggplot2::scale_x_discrete(name = xName) + + ggplot2::scale_y_continuous(name = NULL, breaks = yBreaks, limits = range(yBreaks)) + + ggplot2::scale_fill_manual(name = NULL, values = c("firebrick", "dodgerblue")) + + jaspGraphs::geom_rangeframe() + + jaspGraphs::themeJaspRaw(legend.position = "top") + + ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 45, hjust = 1, vjust = 1.2, size = 12)) + fg$plotObject <- p +} + +.irtCTTHeatmap <- function(dataset, options, jaspResults, ready, position) { + if (options[["explanatoryText"]] && options[["plotCorrelationHeatmap"]]) { + text <- createJaspHtml(gettext("

Explanatory Text: Correlation Heatmap

A correlation heat map displays Pearson correlations between item scores. The Pearson correlation coefficient describes linear correlation between two items. Positive correlations are shown in blue, while negative correlations are shown in red.")) + text$position <- position + text$dependOn(options = c("explanatoryText", "plotCorrelationHeatmap")) + jaspResults[["plotCorrelationHeatmapText"]] <- text + } + if (!is.null(jaspResults[["plotCorrelationHeatmap"]]) || !options[["plotCorrelationHeatmap"]]) { + return() + } + fg <- createJaspPlot(title = gettext("Item Correlation Heatmap"), height = 40 * length(options[["items"]]), width = 40 * length(options[["items"]]) + 100) + fg$position <- position + 1 + fg$dependOn(options = c(.irtCommonDeps(type = "ctt"), "plotCorrelationHeatmap", "plotCorrelationHeatmapShowValues")) + jaspResults[["plotCorrelationHeatmap"]] <- fg + if (!ready) { + return() + } + state <- .irtCTTState(dataset, options, jaspResults) + plotdata <- as.data.frame(cor(state[["items"]])) + plotdata$row <- rownames(plotdata) + plotdata <- reshape2::melt(plotdata, id.var = "row") + colnames(plotdata) <- c("row", "col", "value") + plotdata$row <- factor(plotdata$row, levels = options[["items"]]) + plotdata$col <- factor(plotdata$col, levels = options[["items"]]) + p <- ggplot2::ggplot(data = plotdata, mapping = ggplot2::aes(x = col, y = row, fill = value)) + + ggplot2::geom_raster() + + ggplot2::scale_x_discrete(name = NULL) + + ggplot2::scale_y_discrete(name = NULL) + + ggplot2::scale_fill_gradient2(name = NULL, low = "#721A1D", mid = "white", high = "#322C89", limits = c(-1, 1)) + + jaspGraphs::geom_rangeframe() + + jaspGraphs::themeJaspRaw(legend.position = "right") + if (options[["plotCorrelationHeatmapShowValues"]]) { + p <- p + ggplot2::geom_text(label = round(plotdata$value, 2)) + } + fg$plotObject <- p +} diff --git a/inst/Description.qml b/inst/Description.qml index 713fce22..51483e68 100644 --- a/inst/Description.qml +++ b/inst/Description.qml @@ -54,6 +54,11 @@ Description qml: "StandardErrorOfMeasurement.qml" func: "standardErrorOfMeasurement" } + Analysis + { + title: qsTr("Classical Test Theory") + func: "classicalTestTheory" + } Separator {} diff --git a/inst/qml/classicalTestTheory.qml b/inst/qml/classicalTestTheory.qml new file mode 100755 index 00000000..4142e07b --- /dev/null +++ b/inst/qml/classicalTestTheory.qml @@ -0,0 +1,143 @@ +// +// Copyright (C) 2013-2018 University of Amsterdam +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public +// License along with this program. If not, see +// . +// + +import QtQuick +import QtQuick.Layouts +import JASP +import JASP.Controls + +import "./common" as COMMON + +Form +{ + info: qsTr("Classical Test Theory (CTT) is a traditional framework for analyzing test scores. It focuses on observed scores as the primary measure of an individual's ability and assumes that these scores consist of a true score and measurement error. CTT provides simple reliability indices, such as Cronbach's alpha, to assess the consistency of test scores but doesn't account for item characteristics or the latent ability of individuals, limiting its ability to address more complex assessments.") + + VariablesForm + { + AvailableVariablesList + { + name: "variablesList" + info: qsTr("Select the variables to be analyzed.") + } + + AssignedVariablesList + { + name: "items" + title: qsTr("Item Scores") + allowedColumns: ["scale"] + info: qsTr("Select the variables representing item scores for the analysis.") + } + } + + Group + { + title: qsTr("Data") + + CheckBox + { + name: "customMaxScore" + text: qsTr("First row is maximum item score") + info: qsTr("Check this if the first row in your data represents maximum item scores.") + } + } + + Column + { + spacing: 20 * preferencesModel.uiScale + + Group + { + title: qsTr("Display") + + CheckBox + { + name: "explanatoryText" + text: qsTr("Explanatory text") + info: qsTr("Include explanatory text in the report.") + } + } + + Group + { + title: qsTr("Tables") + + CheckBox + { + name: "tableDescriptives" + text: qsTr("Descriptive statistics") + info: qsTr("Generate a table of descriptive statistics for the test (i.e., sum) scores.") + } + + CheckBox + { + name: "tableCronbachsAlpha" + text: qsTr("Test reliability") + info: qsTr("Calculate test reliability using Cronbach's Alpha.") + + CIField + { + name: "tableCronbachsAlphaCI" + text: qsTr("Confidence interval") + info: qsTr("Specify the confidence interval for Cronbach's Alpha.") + } + } + + CheckBox + { + name: "tableItemStatistics" + text: qsTr("Item information") + info: qsTr("Generate a table of item-level statistics.") + } + } + + Group + { + title: qsTr("Plots") + + CheckBox + { + name: "plotHistogram" + text: qsTr("Histogram of sum scores") + info: qsTr("Create a histogram of the test (i.e., sum) scores.") + } + + CheckBox + { + name: "plotItems" + text: qsTr("Item difficulty and discrimination") + info: qsTr("Generate a plot showing the item difficulty and discrimination parameters.") + } + + CheckBox + { + name: "plotCorrelationHeatmap" + text: qsTr("Item correlations") + info: qsTr("Generate a heatmap of correlations between item scores.") + + CheckBox + { + name: "plotCorrelationHeatmapShowValues" + text: qsTr("Display values") + info: qsTr("Display correlation values in the heatmap.") + } + } + } + } + + COMMON.DownloadReport { } +} diff --git a/tests/testthat/binary.csv b/tests/testthat/binary.csv new file mode 100644 index 00000000..111849b9 --- /dev/null +++ b/tests/testthat/binary.csv @@ -0,0 +1,100 @@ +ID,Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11,Q12,Q13,Q14,Q15,Q16,Q17,Q18,Q19,Q20,Q21,Q22,Q23,Q24,Q25,Q26,Q27,Q28,Q29,Q30,Q31,Q32,Q33,Q34,Q35,Q36,Q37,Q38,Q39,Q40,Q41,Q42,Q43 +1,1,0,0,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,0,0,1,0,0,0,1,1,1,0,0,0,0,0,1,1,0,1,1,1,0,0,0,0,0 +2,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,0,0,1,1,1,0,1,1,0,0,0,0,0,1,0,1,1,1,0,1,0,0 +3,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,1,1,1,1,0,1,0,0,1,0,0,1,0,1,1,1,1,0,0,1,1 +4,0,0,1,1,1,0,1,0,0,1,1,1,0,1,1,0,1,0,1,1,0,1,0,0,0,1,1,1,0,0,0,0,1,0,0,1,0,1,1,0,0,1,0 +5,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,0,1,1,1,1,0,1,1,1,0,0,1,1 +6,1,0,1,1,0,1,0,0,0,1,1,0,1,0,1,0,0,1,0,1,1,0,1,1,0,0,0,1,0,0,1,1,1,1,0,0,0,1,1,0,0,0,0 +7,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,1,1,0,0,0,0 +8,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,0,0,1,1 +9,1,0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+71,0,1,1,1,1,1,1,0.67,2,1.5,2,1,1,3,0,0,1,3,0,0,2,0,3,0,1,2,4,3,2,2,2,0,4,1,0,1,1,0,2,0,0,1,2,2,3,4,0 +72,1,1,1,1,1,0,1,0.67,2,1.5,2,1,1,3,0,2,0,3,0,4,2,0,0,0,0,2,2,3,2,2,2,0,4,1,2,1,1,1.5,2,2,0,1,2,2,2,0,0 +73,1,1,1,1,1,1,1,1,2,1.5,2,1,1,3,1,2,0,3,1,4,2,2,1,0,1,2,4,3,2,2,2,0,0,1,2,1,0,0.67,3,2,0,1,2,2,4,4,1 +74,1,1,1,1,1,1,1,1,1,2,1,1,1,2,0,2,0,3,1,4,2,0,3,0,1,0,4,0,1,2,2,0,0,1,2,1,1,0,0,2,0,1,2,0,0,0,0 diff --git a/tests/testthat/test-classicaltesttheory.R b/tests/testthat/test-classicaltesttheory.R new file mode 100644 index 00000000..7fc7c199 --- /dev/null +++ b/tests/testthat/test-classicaltesttheory.R @@ -0,0 +1,533 @@ +context("[IRT] Classical Test Theory") + +# Consistency test 1, file: binary.csv ######################################### + +options <- analysisOptions("classicalTestTheory") +options$items <- c("Q1", "Q2", "Q3", "Q4", "Q5", "Q6", "Q7", "Q8", "Q9", "Q10", "Q11", "Q12", "Q13", "Q14", "Q15", "Q16", "Q17", "Q18", "Q19", "Q20", "Q21", "Q22", "Q23", "Q24", "Q25", "Q26", "Q27", "Q28", "Q29", "Q30", "Q31", "Q32", "Q33", "Q34", "Q35", "Q36", "Q37", "Q38", "Q39", "Q40", "Q41", "Q42", "Q43") +options$customMaxScore <- FALSE +options$plotCorrelationHeatmap <- TRUE +options$plotHistogram <- TRUE +options$plotItems <- TRUE +options$tableCronbachsAlpha <- TRUE +options$tableDescriptives <- TRUE +options$tableItemStatistics <- TRUE +set.seed(1) +results <- runAnalysis("classicalTestTheory", "binary.csv", options) + +test_that("Item Correlation Heatmap plot matches", { + plotName <- results[["results"]][["plotCorrelationHeatmap"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "item-correlation-heatmap-1") +}) + +test_that("Histogram of Sum Scores plot matches", { + plotName <- results[["results"]][["plotHistogram"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "histogram-of-sum-scores-1") +}) + +test_that("Item Difficulty and Discrimination Plot matches", { + plotName <- results[["results"]][["plotItems"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "item-difficulty-and-discrimination-plot-1") +}) + +test_that("Test Reliability table results match", { + table <- results[["results"]][["tableCronbachsAlpha"]][["data"]] + jaspTools::expect_equal_tables( + table, + list(0.889547959988228, 0.846508008323858, 0.916134580141315) + ) +}) + +test_that("Descriptive Statistics of Sum Scores table results match", { + table <- results[["results"]][["tableDescriptives"]][["data"]] + jaspTools::expect_equal_tables( + table, + list( + 2.56340040017259, 40, 23.4545454545455, 24, 4, 8.54074594944217, + -0.224781704543678 + ) + ) +}) + +test_that("Item Information table results match", { + table <- results[["results"]][["tableItemStatistics"]][["data"]] + jaspTools::expect_equal_tables( + table, + list( + 0.887618350342237, "Q1", 0.666666666666667, 0.347591980764636, + 0.395894501980162, 0.666666666666667, 0.473803541479343, 0.886448561310041, + "Q2", 0.404040404040404, 0.422660887407708, 0.469512619319047, + 0.404040404040404, 0.49320261016887, 0.885858642159483, "Q3", + 0.636363636363636, 0.461002188606611, 0.504999388715257, 0.636363636363636, + 0.483493778415228, 0.88621667612025, "Q4", 0.818181818181818, + 0.461407639692688, 0.496759343248992, 0.818181818181818, 0.387657443028554, + 0.888138304366302, "Q5", 0.323232323232323, 0.312826594755356, + 0.362053438639018, 0.323232323232323, 0.470090803826778, 0.887029757465421, + "Q6", 0.545454545454545, 0.386283378421056, 0.435572353254021, + 0.545454545454545, 0.500463606960979, 0.887893167227372, "Q7", + 0.686868686868687, 0.328775065449762, 0.377015568747514, 0.686868686868687, + 0.466127438264859, 0.886643298531238, "Q8", 0.646464646464647, + 0.411074179885296, 0.457286040810093, 0.646464646464647, 0.480499980104298, + 0.886205125284887, "Q9", 0.525252525252525, 0.437172543807153, + 0.484095955176844, 0.525252525252525, 0.501903201160737, 0.885754161305689, + "Q10", 0.656565656565657, 0.468780775903847, 0.511810733171556, + 0.656565656565657, 0.477271500229107, 0.886851196049235, "Q11", + 0.494949494949495, 0.397358870658065, 0.446326922614578, 0.494949494949495, + 0.502518907629606, 0.885288861003517, "Q12", 0.515151515151515, + 0.493249690234436, 0.537108413493487, 0.515151515151515, 0.502313755995161, + 0.886823916021133, "Q13", 0.767676767676768, 0.404874510944395, + 0.446008097476569, 0.767676767676768, 0.424463234346504, 0.886280048100412, + "Q14", 0.727272727272727, 0.439354578601723, 0.481161261171939, + 0.727272727272727, 0.447628258171794, 0.888910075872708, "Q15", + 0.818181818181818, 0.244751529111002, 0.287184617501532, 0.818181818181818, + 0.387657443028554, 0.886712151630352, "Q16", 0.787878787878788, + 0.415795712835666, 0.455189535158361, 0.787878787878788, 0.410890701806659, + 0.889098334859378, "Q17", 0.505050505050505, 0.257587400087347, + 0.31210463741184, 0.505050505050505, 0.502518907629606, 0.88694435997992, + "Q18", 0.606060606060606, 0.391529037409299, 0.439667659967765, + 0.606060606060606, 0.491108322108806, 0.885947949531992, "Q19", + 0.515151515151515, 0.452926928816721, 0.499052422843385, 0.515151515151515, + 0.502313755995162, 0.88564483606331, "Q20", 0.424242424242424, + 0.472329064782446, 0.516893974782547, 0.424242424242424, 0.496742636335202, + 0.885171852193804, "Q21", 0.494949494949495, 0.50034733884224, + 0.543805587069383, 0.494949494949495, 0.502518907629606, 0.889018987939846, + "Q22", 0.555555555555556, 0.261719139249559, 0.315773007898445, + 0.555555555555556, 0.49943278484293, 0.887608697344554, "Q23", + 0.515151515151515, 0.350476575122602, 0.401533946802498, 0.515151515151515, + 0.502313755995161, 0.88986597878406, "Q24", 0.363636363636364, + 0.20210697519516, 0.25609399605667, 0.363636363636364, 0.483493778415228, + 0.884783730233453, "Q25", 0.737373737373737, 0.544343937310354, + 0.580272097888561, 0.737373737373737, 0.44230053929239, 0.88665871481649, + "Q26", 0.575757575757576, 0.409363796068735, 0.457201904090654, + 0.575757575757576, 0.496742636335202, 0.886258773963827, "Q27", + 0.545454545454545, 0.433974733572468, 0.480930909223175, 0.545454545454545, + 0.500463606960979, 0.888980942894191, "Q28", 0.484848484848485, + 0.264890699257377, 0.319151376133811, 0.484848484848485, 0.502313755995161, + 0.886219492535083, "Q29", 0.484848484848485, 0.436258934148329, + 0.483267835812377, 0.484848484848485, 0.502313755995161, 0.88774939527641, + "Q30", 0.252525252525253, 0.337124640890812, 0.382051071574535, + 0.252525252525253, 0.436671883156537, 0.888348359463818, "Q31", + 0.424242424242424, 0.303406110222096, 0.355747249141795, 0.424242424242424, + 0.496742636335202, 0.88428819831304, "Q32", 0.353535353535354, + 0.561557826416684, 0.599467414843483, 0.353535353535354, 0.480499980104298, + 0.887672362542716, "Q33", 0.545454545454545, 0.346330592196771, + 0.397375674543155, 0.545454545454545, 0.500463606960979, 0.889837876052086, + "Q34", 0.636363636363636, 0.203949058362162, 0.25789114690619, + 0.636363636363636, 0.483493778415228, 0.886904024074741, "Q35", + 0.535353535353535, 0.39408617745935, 0.44309059551095, 0.535353535353535, + 0.501286738449699, 0.886950122176769, "Q36", 0.555555555555556, + 0.391208337820021, 0.440168435252378, 0.555555555555556, 0.49943278484293, + 0.889412771343135, "Q37", 0.727272727272727, 0.220735771703533, + 0.270304409957408, 0.727272727272727, 0.447628258171794, 0.887925794772865, + "Q38", 0.696969696969697, 0.326210478288408, 0.374111516499348, + 0.696969696969697, 0.461906993344902, 0.886714468247132, "Q39", + 0.838383838383838, 0.427602068488912, 0.462672030494686, 0.838383838383838, + 0.369971612454052, 0.888225248551025, "Q40", 0.131313131313131, + 0.302300477575752, 0.33819731563888, 0.131313131313131, 0.339461297318015, + 0.888721270165779, "Q41", 0.171717171717172, 0.259130069580139, + 0.300293523935615, 0.171717171717172, 0.379053710060048, 0.889276469293747, + "Q42", 0.323232323232323, 0.236731247416707, 0.28834887774186, + 0.323232323232323, 0.470090803826778, 0.886708705565086, "Q43", + 0.434343434343434, 0.406216266765539, 0.454344781246639, 0.434343434343434, + 0.498192982885396 + ) + ) +}) + +test_that("Test Summary table results match", { + table <- results[["results"]][["tableSummary"]][["data"]] + jaspTools::expect_equal_tables( + table, + list(0.545454545454545, 0.375055902561138, 0.421344004412721, 43, 99) + ) +}) + +# Consistency test 2, file: binary2.csv ######################################## + +options <- analysisOptions("classicalTestTheory") +options$items <- c("Q1", "Q2", "Q3", "Q4", "Q5", "Q6", "Q7", "Q8", "Q9", "Q10", "Q11", "Q12", "Q13", "Q14", "Q15", "Q16", "Q17", "Q18", "Q19", "Q20") +options$plotCorrelationHeatmap <- TRUE +options$customMaxScore <- FALSE +options$plotHistogram <- TRUE +options$plotItems <- TRUE +options$tableCronbachsAlpha <- TRUE +options$tableDescriptives <- TRUE +options$tableItemStatistics <- TRUE +set.seed(1) +results <- runAnalysis("classicalTestTheory", "binary2.csv", options) + +test_that("Item Correlation Heatmap plot matches", { + plotName <- results[["results"]][["plotCorrelationHeatmap"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "item-correlation-heatmap-2") +}) + +test_that("Histogram of Sum Scores plot matches", { + plotName <- results[["results"]][["plotHistogram"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "histogram-of-sum-scores-2") +}) + +test_that("Item Difficulty and Discrimination Plot matches", { + plotName <- results[["results"]][["plotItems"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "item-difficulty-and-discrimination-plot-2") +}) + +test_that("Test Reliability table results match", { + table <- results[["results"]][["tableCronbachsAlpha"]][["data"]] + jaspTools::expect_equal_tables( + table, + list(0.709304580537563, 0.571062930538064, 0.792856262630907) + ) +}) + +test_that("Descriptive Statistics of Sum Scores table results match", { + table <- results[["results"]][["tableDescriptives"]][["data"]] + jaspTools::expect_equal_tables( + table, + list(2.30037595393627, 19, 11.1, 11.5, 3, 3.7211475078946, -0.177881049258767) + ) +}) + +test_that("Item Information table results match", { + table <- results[["results"]][["tableItemStatistics"]][["data"]] + jaspTools::expect_equal_tables( + table, + list( + 0.701824212271973, "Q1", 0.8, 0.238234538235264, 0.339328306123689, + 0.8, 0.404061017820884, 0.68194016312305, "Q2", 0.56, 0.444144293155973, + 0.549064591167952, 0.56, 0.501426536422407, 0.684953089240579, + "Q3", 0.44, 0.414323435846851, 0.522814491191795, 0.44, 0.501426536422407, + 0.7053133957442, "Q4", 0.46, 0.206733390524851, 0.33442801535778, + 0.46, 0.503457433905889, 0.674189074451859, "Q5", 0.56, 0.519803996722433, + 0.614689841108345, 0.56, 0.501426536422407, 0.705976634227755, + "Q6", 0.72, 0.191070240896555, 0.307134444609423, 0.72, 0.453557367611073, + 0.718588254472837, "Q7", 0.54, 0.0652261027947391, 0.199349598731185, + 0.54, 0.503457433905889, 0.704632072705951, "Q8", 0.26, 0.205458570693149, + 0.318105121499561, 0.26, 0.443087497693452, 0.705640502888209, + "Q9", 0.9, 0.184333754536444, 0.262413890068987, 0.9, 0.303045763365663, + 0.713635225046238, "Q10", 0.36, 0.112069901857977, 0.239792002994074, + 0.36, 0.484873221385061, 0.690083632019116, "Q11", 0.6, 0.363976142732779, + 0.476543891030621, 0.6, 0.494871659305394, 0.668414727411778, + "Q12", 0.46, 0.574052977043173, 0.661230636228575, 0.46, 0.503457433905889, + 0.695862166054817, "Q13", 0.36, 0.304938612280157, 0.420767099593375, + 0.36, 0.484873221385061, 0.706986648734221, "Q14", 0.62, 0.186459031378769, + 0.312073313402448, 0.62, 0.490314351478015, 0.684268499791858, + "Q15", 0.76, 0.445995231729357, 0.536463409948143, 0.76, 0.4314191105869, + 0.69102519141972, "Q16", 0.66, 0.356832993358516, 0.466469287331464, + 0.66, 0.478518120698406, 0.714986826118415, "Q17", 0.34, 0.0945332120441771, + 0.221200423722291, 0.34, 0.478518120698407, 0.697763347763348, + "Q18", 0.5, 0.284901441149095, 0.407193967348427, 0.5, 0.505076272276105, + 0.708457711442786, "Q19", 0.6, 0.171633252289402, 0.299225233902948, + 0.6, 0.494871659305394, 0.707363628403817, "Q20", 0.6, 0.183363777112674, + 0.310307649973428, 0.6, 0.494871659305394 + ) + ) +}) + +test_that("Test Summary table results match", { + table <- results[["results"]][["tableSummary"]][["data"]] + jaspTools::expect_equal_tables( + table, + list(0.555, 0.277404244819117, 0.389929760766726, 20, 50) + ) +}) + +# Consistency test 3, file: scored.csv ######################################### + +options <- analysisOptions("classicalTestTheory") +options$items <- c("1a", "1b", "1c", "1d", "1e", "1f", "2a", "2b", "2c", "2d", "2e", "2f", "3a", "3b", "3c", "3d", "3e", "3f", "4a", "4b", "4c", "4d", "4e", "5a", "5b", "5c", "5d", "5e", "5f", "5g", "5h", "5i", "6a", "6b", "6c", "6d", "7a", "7b", "7c", "7d", "7e", "7f", "7g") +options$plotCorrelationHeatmap <- TRUE +options$customMaxScore <- FALSE +options$plotHistogram <- TRUE +options$plotItems <- TRUE +options$tableCronbachsAlpha <- TRUE +options$tableDescriptives <- TRUE +options$tableItemStatistics <- TRUE +set.seed(1) +results <- runAnalysis("classicalTestTheory", "scored.csv", options) + +test_that("Item Correlation Heatmap plot matches", { + plotName <- results[["results"]][["plotCorrelationHeatmap"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "item-correlation-heatmap-3") +}) + +test_that("Histogram of Sum Scores plot matches", { + plotName <- results[["results"]][["plotHistogram"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "histogram-of-sum-scores-3") +}) + +test_that("Item Difficulty and Discrimination Plot matches", { + plotName <- results[["results"]][["plotItems"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "item-difficulty-and-discrimination-plot-3") +}) + +test_that("Test Reliability table results match", { + table <- results[["results"]][["tableCronbachsAlpha"]][["data"]] + jaspTools::expect_equal_tables( + table, + list(0.829334057073083, 0.73516844798705, 0.877006995788597) + ) +}) + +test_that("Descriptive Statistics of Sum Scores table results match", { + table <- results[["results"]][["tableDescriptives"]][["data"]] + jaspTools::expect_equal_tables( + table, + list( + 5.02044971289884, 79.5, 54.7727272727273, 57, 10, 14.5665735481981, + -1.35514418077972 + ) + ) +}) + +test_that("Item Information table results match", { + table <- results[["results"]][["tableItemStatistics"]][["data"]] + jaspTools::expect_equal_tables( + table, + list( + 0.825407872456555, "1a", 0.545454545454545, 0.310587545323532, + 0.372009841855288, 1.09090909090909, 1.00092721392196, 0.829021219581504, + "1b", 0.98989898989899, 0.305819140562084, 0.312066870182252, + 0.98989898989899, 0.100503781525921, 0.821194757297456, "1c", + 0.750841750841751, 0.446583336940427, 0.507502156732886, 2.25252525252525, + 1.12796940853939, 0.825040003420433, "1d", 0.686868686868687, + 0.326579358121729, 0.383155098908431, 1.37373737373737, 0.932254876529718, + 0.828811258537718, "1e", 0.161616161616162, 0.154442646193458, + 0.179186860486002, 0.161616161616162, 0.369971612454052, 0.828475096374059, + "1f", 0.707070707070707, 0.175487801961505, 0.205839054450631, + 0.707070707070707, 0.457422353230807, 0.825252343839647, "2a", + 0.757575757575758, 0.32246037283752, 0.374944912316436, 1.51515151515152, + 0.861460984507896, 0.830941833948788, "2b", 0.323232323232323, + 0.0938374666871952, 0.157618962831734, 0.646464646464647, 0.940181607653557, + 0.823057666025013, "2c", 0.777777777777778, 0.655200449533896, + 0.671417985858415, 0.777777777777778, 0.417855447018673, 0.826064048771513, + "2d", 0.797979797979798, 0.448070782333193, 0.467135089539046, + 0.797979797979798, 0.34933750652523, 0.820475994408571, "2e", + 0.843434343434343, 0.64317519228432, 0.667667227724622, 1.68686868686869, + 0.61687931949921, 0.834109085596035, "2f", 0.818181818181818, + -0.0955040641744162, -0.0426297777541689, 1.63636363636364, + 0.775314886057107, 0.822625613576115, "3a", 0.797979797979798, + 0.445579506094514, 0.489438028576387, 1.5959595959596, 0.807101034557328, + 0.825286367813827, "3b", 0.638047138047138, 0.316893791627561, + 0.38858588353448, 1.91414141414141, 1.17595034091061, 0.831039942688473, + "3c", 0.878787878787879, -0.0933034938060058, -0.0709564044089731, + 0.878787878787879, 0.328034569878315, 0.834124735789869, "3d", + 0.474747474747475, 0.229033616923777, 0.357556647235747, 1.8989898989899, + 2.00761280464295, 0.82492722448934, "3e", 0.818181818181818, + 0.521813031844428, 0.541044982787497, 0.818181818181818, 0.387657443028553, + 0.819163342191373, "3f", 0.656565656565657, 0.494663382899795, + 0.590434337466842, 2.62626262626263, 1.90908600091643, 0.824939396633458, + "4a", 0.661616161616162, 0.343459851100549, 0.391039612190446, + 1.32323232323232, 0.793188898780504, 0.828230688546693, "4b", + 0.95959595959596, 0.206221943939458, 0.232166206600303, 1.91919191919192, + 0.395814006949349, 0.816380090081959, "4c", 0.601010101010101, + 0.551325356750977, 0.644784469294559, 3.60606060606061, 2.03448926458657, + 0.830425541760166, "4d", 0.404040404040404, 0.122612046252644, + 0.189033834316667, 0.808080808080808, 0.98640522033774, 0.832092861310518, + "4e", 0.124579124579125, 0.0342669502694558, 0.0950516700215364, + 0.373737373737374, 0.887393093139797, 0.829657095484388, "5a", + 0.464646464646465, 0.0846006575554281, 0.118718096165657, 0.464646464646465, + 0.501286738449699, 0.822764737510034, "5b", 0.51010101010101, + 0.423640553655342, 0.472597525604939, 1.02020202020202, 0.880396454987786, + 0.824849936262149, "5c", 0.898989898989899, 0.648895144368651, + 0.660851448125922, 0.898989898989899, 0.302875656272066, 0.823049760450035, + "5d", 0.53030303030303, 0.416535224849759, 0.464452589318387, + 1.06060606060606, 0.854975615097807, 0.827356131256216, "5e", + 0.545454545454545, 0.255350364224133, 0.287326226409865, 0.545454545454545, + 0.500463606960979, 0.8267514074199, "5f", 0.292929292929293, + 0.259033386666708, 0.317146679769048, 0.585858585858586, 0.914844706461614, + 0.828606582615656, "5g", 0.181818181818182, 0.171918029986198, + 0.223334037983787, 0.363636363636364, 0.775314886057107, 0.824315638264913, + "5h", 0.390572390572391, 0.355411378506915, 0.439200948635655, + 1.17171717171717, 1.42170064905325, 0.828699958706545, "5i", + 0.656565656565657, 0.156390260451006, 0.188271830545924, 0.656565656565657, + 0.477271500229107, 0.830964440503085, "6a", 0.282828282828283, + -0.02972602632599, 0.00133650283268321, 0.282828282828283, 0.452665665702851, + 0.825495216073241, "6b", 0.717171717171717, 0.309782447656383, + 0.365428011357325, 1.43434343434343, 0.905331331405701, 0.822309737786764, + "6c", 0.838383838383838, 0.42132281154728, 0.516562267715603, + 4.19191919191919, 1.73014549156273, 0.819157372166777, "6d", + 0.666666666666667, 0.548977709364202, 0.593613494854295, 1.33333333333333, + 0.947607082958685, 0.827442658618, "7a", 0.888888888888889, + 0.324414711713778, 0.343748785936796, 0.888888888888889, 0.315869027652895, + 0.819138192812406, "7b", 0.919191919191919, 0.593638181804164, + 0.629560452229106, 2.75757575757576, 0.821781403613318, 0.828257657680071, + "7c", 0.909090909090909, 0.241882358087676, 0.260513021161164, + 0.909090909090909, 0.288942798198532, 0.826268295606949, "7d", + 0.429292929292929, 0.278909244686928, 0.340981983653898, 0.858585858585859, + 0.989847452791579, 0.825614562502229, "7e", 0.232323232323232, + 0.307870186868763, 0.360151696167467, 0.464646464646465, 0.848926468693007, + 0.823177044437233, "7f", 0.494949494949495, 0.383683449403653, + 0.464263866994404, 1.48484848484848, 1.40235688173435, 0.821014957520047, + "7g", 0.666666666666667, 0.438900025328202, 0.515992801255663, + 2, 1.42141062443803 + ) + ) +}) + +test_that("Test Summary table results match", { + table <- results[["results"]][["tableSummary"]][["data"]] + jaspTools::expect_equal_tables( + table, + list(0.620742306788818, 0.315133397974437, 0.364375484127085, 43, 99) + ) +}) + +# Consistency test 4, file: scored2.csv ######################################## + +options <- analysisOptions("classicalTestTheory") +options$items <- c("1a", "1b", "1c", "1d", "1e", "1f", "1g", "1h", "1i", "2a", "2b", "2c", "2d", "2e", "2f", "3a", "3b", "3c", "3d", "3e", "3f", "3g", "4a", "4b", "4c", "4d", "4e", "4f", "5a", "5b", "5c", "5d", "5e", "5f", "5g", "6a", "6b", "6c", "6d", "6e", "6f", "7a", "7b", "7c", "7d", "7e", "7f") +options$plotCorrelationHeatmap <- TRUE +options$customMaxScore <- FALSE +options$plotHistogram <- TRUE +options$plotItems <- TRUE +options$tableCronbachsAlpha <- TRUE +options$tableDescriptives <- TRUE +options$tableItemStatistics <- TRUE +set.seed(1) +results <- runAnalysis("classicalTestTheory", "scored2.csv", options) + +test_that("Item Correlation Heatmap plot matches", { + plotName <- results[["results"]][["plotCorrelationHeatmap"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "item-correlation-heatmap-4") +}) + +test_that("Histogram of Sum Scores plot matches", { + plotName <- results[["results"]][["plotHistogram"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "histogram-of-sum-scores-4") +}) + +test_that("Item Difficulty and Discrimination Plot matches", { + plotName <- results[["results"]][["plotItems"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "item-difficulty-and-discrimination-plot-4") +}) + +test_that("Test Reliability table results match", { + table <- results[["results"]][["tableCronbachsAlpha"]][["data"]] + jaspTools::expect_equal_tables( + table, + list(0.842179292006487, 0.757417413034678, 0.889849674902588) + ) +}) + +test_that("Descriptive Statistics of Sum Scores table results match", { + table <- results[["results"]][["tableDescriptives"]][["data"]] + jaspTools::expect_equal_tables( + table, + list( + 3.77295225094427, 87, 58.022602739726, 59.67, 13.17, 14.1654501465319, + -0.662397617792948 + ) + ) +}) + +test_that("Item Information table results match", { + table <- results[["results"]][["tableItemStatistics"]][["data"]] + jaspTools::expect_equal_tables( + table, + list( + 0.841049339431467, "1a", 0.671232876712329, 0.205322821872927, + 0.237197658222613, 0.671232876712329, 0.47301616487964, 0.841888571938734, + "1b", 0.780821917808219, 0.134183924299201, 0.163003702607099, + 0.780821917808219, 0.416552495773534, 0.841937736299186, "1c", + 0.958904109589041, 0.159060465892691, 0.172798822146357, 0.958904109589041, + 0.199885812151697, 0.84255819202078, "1d", 0.958904109589041, + 0.0369152462511328, 0.0510031450721802, 0.958904109589041, 0.199885812151697, + 0.843410760973421, "1e", 0.958904109589041, -0.131614370036826, + -0.117735126830827, 0.958904109589041, 0.199885812151697, 0.841532184772616, + "1f", 0.89041095890411, 0.182759013927911, 0.204178439229569, + 0.89041095890411, 0.314538631950585, 0.842252153933355, "1g", + 0.986301369863014, 0.128868021722698, 0.136988919448999, 0.986301369863014, + 0.117041147196131, 0.842382631797695, "1h", 0.891232876712329, + 0.072832186577499, 0.0851351258165446, 0.891232876712329, 0.175285047260166, + 0.83829236114358, "1i", 0.842465753424658, 0.385999377329272, + 0.420235542286275, 1.68493150684932, 0.574376771639563, 0.843526788139729, + "2a", 0.770547945205479, -0.0534259352479937, -0.0294001229880557, + 1.54109589041096, 0.341091229421737, 0.839527790500566, "2b", + 0.780821917808219, 0.298287324704043, 0.336669985666584, 1.56164383561644, + 0.600608519426178, 0.840177484307567, "2c", 0.876712328767123, + 0.338757569272932, 0.359363542669226, 0.876712328767123, 0.331042355440947, + 0.839976363520101, "2d", 0.89041095890411, 0.375773728338998, + 0.394763372502014, 0.89041095890411, 0.314538631950585, 0.835969031373748, + "2e", 0.707762557077626, 0.41541922674205, 0.483691760900148, + 2.12328767123288, 1.18959850229035, 0.840499903936586, "2f", + 0.534246575342466, 0.245497189348116, 0.278673065522264, 0.534246575342466, + 0.502277916120977, 0.840025361363471, "3a", 0.726027397260274, + 0.261450490013402, 0.320031461316576, 1.45205479452055, 0.898163185655575, + 0.838067544041151, "3b", 0.301369863013699, 0.456632545809128, + 0.482255846178886, 0.301369863013699, 0.462028483575096, 0.836747148664076, + "3c", 0.858447488584475, 0.402034612455665, 0.454403355812812, + 2.57534246575342, 0.896254679503948, 0.84248366713909, "3d", + 0.47945205479452, 0.0909256210243481, 0.126086553938774, 0.47945205479452, + 0.50303492923498, 0.838883157464488, "3e", 0.616438356164384, + 0.416457634522909, 0.527432717272594, 2.46575342465753, 1.95847298637386, + 0.837694018204713, "3f", 0.89041095890411, 0.40643469411003, + 0.44317331711636, 1.78082191780822, 0.629077263901169, 0.836028354733845, + "3g", 0.205479452054795, 0.447205141616188, 0.492568751410669, + 0.410958904109589, 0.813695555242257, 0.833359692094889, "4a", + 0.561643835616438, 0.492542962264193, 0.559950660195059, 1.68493150684932, + 1.28966740252377, 0.841620969112698, "4b", 0.273972602739726, + 0.192218031863699, 0.252908085727045, 0.547945205479452, 0.898163185655575, + 0.841713308804523, "4c", 0.671232876712329, 0.150376105227277, + 0.182931286774769, 0.671232876712329, 0.47301616487964, 0.835170430054435, + "4d", 0.821917808219178, 0.499580712310678, 0.539841195579924, + 1.64383561643836, 0.770459152672011, 0.836403329004406, "4e", + 0.712328767123288, 0.404718085461256, 0.481134255777537, 2.84931506849315, + 1.31941941016065, 0.833901549597996, "4f", 0.726027397260274, + 0.475988056628875, 0.547879838458075, 2.17808219178082, 1.34724477848336, + 0.835060542195669, "5a", 0.73972602739726, 0.512704445294726, + 0.551070686641768, 1.47945205479452, 0.747395273992281, 0.83856127486779, + "5b", 0.726027397260274, 0.324449338814008, 0.380595987781746, + 1.45205479452055, 0.898163185655575, 0.842947599558227, "5c", + 0.990890410958904, -0.068052896498981, -0.0571106568785357, + 1.98178082191781, 0.155664725770854, 0.841563748715858, "5d", + 0.13013698630137, 0.163185840074065, 0.199340802937539, 0.26027397260274, + 0.527767764064259, 0.839029835839442, "5e", 0.684931506849315, + 0.399841971590727, 0.50786832348553, 2.73972602739726, 1.87103207749296, + 0.840300932818648, "5f", 0.945205479452055, 0.427141408496782, + 0.440321177215116, 0.945205479452055, 0.229153694111865, 0.836979937977451, + "5g", 0.349315068493151, 0.400472521940696, 0.44897912417149, + 0.698630136986301, 0.828065542005538, 0.838715132863733, "6a", + 0.547945205479452, 0.38372841849814, 0.413691964236509, 0.547945205479452, + 0.501140252336026, 0.843337833882042, "6b", 0.561643835616438, + 0.0229162465135563, 0.0581537494999103, 0.561643835616438, 0.499619337592326, + 0.837385367511268, "6c", 0.324794520547945, 0.417800001821942, + 0.455429185670147, 0.649589041095891, 0.652027688480252, 0.838901416975193, + "6d", 0.515981735159817, 0.315714776818874, 0.385145650183527, + 1.54794520547945, 1.10605776283775, 0.835154277432019, "6e", + 0.63013698630137, 0.457510387848651, 0.510924594079674, 1.26027397260274, + 0.972216786242684, 0.840707762071622, "6f", 0.10958904109589, + 0.285242079633279, 0.305575472089421, 0.10958904109589, 0.314538631950585, + 0.842577485525166, "7a", 1, "", "", 1, 0, 0.841248111992031, + "7b", 0.780821917808219, 0.201875056519376, 0.257955518895805, + 1.56164383561644, 0.833104991547068, 0.832954807670114, "7c", + 0.657534246575342, 0.54626798212688, 0.592726263723645, 1.31506849315068, + 0.955636965134993, 0.837718250173357, "7d", 0.541095890410959, + 0.402202889227032, 0.499427408023013, 2.16438356164384, 1.68336384980703, + 0.83781710935883, "7e", 0.424657534246575, 0.442103210484609, + 0.551648965245866, 1.6986301369863, 1.99084663388085, 0.835299463072246, + "7f", 0.349315068493151, 0.491539604618094, 0.532531516114483, + 0.698630136986301, 0.776118037751727 + ) + ) +}) + +test_that("Test Summary table results match", { + table <- results[["results"]][["tableSummary"]][["data"]] + jaspTools::expect_equal_tables( + table, + list(0.667110171961527, 0.296040081915756, 0.339596541107537, 47, 73) + ) +}) + +################################################################################ From edc2e7a5017efce26a8336f566fc7da64f7adc24 Mon Sep 17 00:00:00 2001 From: Koen Derks Date: Fri, 22 Nov 2024 14:09:01 +0100 Subject: [PATCH 2/6] Update tests --- R/classicaltesttheory.R | 65 ++--- .../histogram-of-sum-scores-1.svg | 108 ++++++++ .../histogram-of-sum-scores-2.svg | 86 ++++++ .../histogram-of-sum-scores-3.svg | 159 +++++++++++ .../histogram-of-sum-scores-4.svg | 155 +++++++++++ .../item-correlation-heatmap-1.svg | 230 ++++++++++++++++ .../item-correlation-heatmap-2.svg | 138 ++++++++++ .../item-correlation-heatmap-3.svg | 230 ++++++++++++++++ .../item-correlation-heatmap-4.svg | 246 +++++++++++++++++ ...m-difficulty-and-discrimination-plot-1.svg | 232 ++++++++++++++++ ...m-difficulty-and-discrimination-plot-2.svg | 140 ++++++++++ ...m-difficulty-and-discrimination-plot-3.svg | 234 ++++++++++++++++ ...m-difficulty-and-discrimination-plot-4.svg | 249 ++++++++++++++++++ tests/testthat/test-classicaltesttheory.R | 2 +- 14 files changed, 2243 insertions(+), 31 deletions(-) create mode 100644 tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-1.svg create mode 100644 tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-2.svg create mode 100644 tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-3.svg create mode 100644 tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-4.svg create mode 100644 tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-1.svg create mode 100644 tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-2.svg create mode 100644 tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-3.svg create mode 100644 tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-4.svg create mode 100644 tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-1.svg create mode 100644 tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-2.svg create mode 100644 tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-3.svg create mode 100644 tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-4.svg diff --git a/R/classicaltesttheory.R b/R/classicaltesttheory.R index 29952ca7..2ed625c3 100755 --- a/R/classicaltesttheory.R +++ b/R/classicaltesttheory.R @@ -20,25 +20,25 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { ready <- .cttReady(options) # Create the summary table - .irtCTTSummaryTable(dataset, options, jaspResults, ready, position = 1) + .cttSummaryTable(dataset, options, jaspResults, ready, position = 1) # Create the descriptives table - .irtCTTDescriptivesTable(dataset, options, jaspResults, ready, position = 3) + .cttDescriptivesTable(dataset, options, jaspResults, ready, position = 3) # Create the Cronbachs alpha table - .irtCTTAlphaTable(dataset, options, jaspResults, ready, position = 5) + .cttAlphaTable(dataset, options, jaspResults, ready, position = 5) # Create the item statistics table - .irtCTTItemStatisticsTable(dataset, options, jaspResults, ready, position = 7) + .cttItemStatisticsTable(dataset, options, jaspResults, ready, position = 7) # Create the histogram of test scores - .irtCTTHistogram(dataset, options, jaspResults, ready, position = 9) + .cttHistogram(dataset, options, jaspResults, ready, position = 9) # Create the difficulty and discrimination plot - .irtCTTDiscrimination(dataset, options, jaspResults, ready, position = 11) + .cttDiscrimination(dataset, options, jaspResults, ready, position = 11) # Create the correlation heatmap - .irtCTTHeatmap(dataset, options, jaspResults, ready, position = 13) + .cttHeatmap(dataset, options, jaspResults, ready, position = 13) } .cttReadData <- function(dataset, options) { @@ -58,7 +58,12 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { return(ready) } -.irtCTTState <- function(dataset, options, jaspResults) { +.cttDeps <- function(type = "none") { + deps <- c("items", "customMaxScore", "tableCronbachsAlphaCI") + return(deps) +} + +.cttState <- function(dataset, options, jaspResults) { if (!is.null(jaspResults[["state"]])) { return(jaspResults[["state"]]$object) } @@ -117,11 +122,11 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { jaspBase:::.quitAnalysis(gettextf("An error occurred in the analysis: %1$s", jaspBase:::.extractErrorMessage(p))) } jaspResults[["state"]] <- createJaspState(result) - jaspResults[["state"]]$dependOn(options = .irtCommonDeps(type = "ctt")) + jaspResults[["state"]]$dependOn(options = .cttDeps()) return(jaspResults[["state"]]$object) } -.irtCTTSummaryTable <- function(dataset, options, jaspResults, ready, position) { +.cttSummaryTable <- function(dataset, options, jaspResults, ready, position) { if (options[["explanatoryText"]]) { text <- createJaspHtml(gettext("

Explanatory Text: Classical Test Theory

Classical Test Theory (CTT) is a framework for assessing and understanding the reliability and validity of psychological and educational tests. It suggests that an observed test score is composed of two components: the true score (the actual ability being measured) and noise (random variability in test scores). CTT focuses on quantifying and separating these components to evaluate the quality and consistency of a test.")) text$position <- position @@ -139,13 +144,13 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { tb$addColumnInfo(name = "avgp", title = gettext("Avg. difficulty (P)"), type = "number") tb$addColumnInfo(name = "avgrit", title = gettext("Avg. ritem-total"), type = "number") tb$addColumnInfo(name = "avgrir", title = gettext("Avg. ritem-rest"), type = "number") - tb$dependOn(options = .irtCommonDeps(type = "ctt")) + tb$dependOn(options = .cttDeps()) jaspResults[["tableSummary"]] <- tb if (!ready) { tb$addFootnote(gettext("The maximum possible test score is ....")) return() } - state <- .irtCTTState(dataset, options, jaspResults) + state <- .cttState(dataset, options, jaspResults) tb[["items"]] <- state[["descriptives"]][["items"]] tb[["n"]] <- state[["descriptives"]][["n"]] tb[["avgp"]] <- state[["avgP"]] @@ -154,7 +159,7 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { tb$addFootnote(gettextf("The maximum possible test score is %1$s.", state[["maxScore"]])) } -.irtCTTDescriptivesTable <- function(dataset, options, jaspResults, ready, position) { +.cttDescriptivesTable <- function(dataset, options, jaspResults, ready, position) { if (options[["explanatoryText"]] && options[["tableDescriptives"]]) { text <- createJaspHtml(gettext("

Explanatory Text: Descriptive Statistics

The table below provides descriptive statistics the test scores (i.e., sum of item scores). It includes information about the lowest and highest recorded test score, the average (mean), the middle point (median), a measure of how spread out the scores are (standard deviation), and two measures that describe the shape of the score distribution (skewness and kurtosis).")) text$position <- position @@ -173,12 +178,12 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { tb$addColumnInfo(name = "sd", title = gettext("Std. dev"), type = "number") tb$addColumnInfo(name = "skew", title = gettext("Skewness"), type = "number") tb$addColumnInfo(name = "kurt", title = gettext("Kurtosis"), type = "number") - tb$dependOn(options = c(.irtCommonDeps(type = "ctt"), "tableDescriptives")) + tb$dependOn(options = c(.cttDeps(), "tableDescriptives")) jaspResults[["tableDescriptives"]] <- tb if (!ready) { return() } - state <- .irtCTTState(dataset, options, jaspResults) + state <- .cttState(dataset, options, jaspResults) tb[["min"]] <- state[["descriptives"]][["min"]] tb[["max"]] <- state[["descriptives"]][["max"]] tb[["mean"]] <- state[["descriptives"]][["mean"]] @@ -188,7 +193,7 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { tb[["kurt"]] <- state[["descriptives"]][["kurt"]] } -.irtCTTAlphaTable <- function(dataset, options, jaspResults, ready, position) { +.cttAlphaTable <- function(dataset, options, jaspResults, ready, position) { if (options[["explanatoryText"]] && options[["tableCronbachsAlpha"]]) { text <- createJaspHtml(gettextf("

Explanatory Text: Test Reliability

Cronbach's %1$s is a way to quantify how reliable (i.e., consistent) a test is. It tells us if all the questions in the test are measuring the same construct. This helps to understand if the test is consistent and if it is a good measure of what it is supposed to measure. When interpreting Cronbach's %1$s for a test, a high %1$s value (i.e., close to 1) indicates good internal consistency, suggesting that the test items are reliably measuring the same construct. On the other hand, a low %1$s value (i.e., close to 0) may suggest that some items in the assessment are not contributing to the overall measurement consistency and might need revision or removal. A rule of thumb is that a 'good' test has at least an %1$s value of 0.8.", "\u03B1")) text$position <- position @@ -204,7 +209,7 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { overtitle <- gettextf("%1$s%% Confidence interval", round(options[["tableCronbachsAlphaCI"]] * 100, 3)) tb$addColumnInfo(name = "alpha_lower", title = gettext("Lower"), type = "number", overtitle = overtitle) tb$addColumnInfo(name = "alpha_upper", title = gettext("Upper"), type = "number", overtitle = overtitle) - tb$dependOn(options = c(.irtCommonDeps(type = "ctt"), "tableCronbachsAlpha")) + tb$dependOn(options = c(.cttDeps(), "tableCronbachsAlpha")) jaspResults[["tableCronbachsAlpha"]] <- tb if (!ready) { return() @@ -213,13 +218,13 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { tb$addFootnote(gettext("There must be at least two items to compute Cronbach's alpha.")) return() } - state <- .irtCTTState(dataset, options, jaspResults) + state <- .cttState(dataset, options, jaspResults) tb[["alpha"]] <- state[["cronbach"]][["alpha"]] tb[["alpha_lower"]] <- as.numeric(state[["cronbach"]][["ci"]][1]) tb[["alpha_upper"]] <- as.numeric(state[["cronbach"]][["ci"]][2]) } -.irtCTTItemStatisticsTable <- function(dataset, options, jaspResults, ready, position) { +.cttItemStatisticsTable <- function(dataset, options, jaspResults, ready, position) { if (options[["explanatoryText"]] && options[["tableItemStatistics"]]) { text <- createJaspHtml(gettextf("

Explanatory Text: Item Information

In educational testing and assessment, several statistics can evaluate the performance and quality of test items. These statistics help us understand how well each question or item is working and contributing to the overall quality of the test. Let's break down these important concepts in a straightforward manner:\n\n1. Avg. Score: This is the typical score that people get on a specific test item. It gives us an idea of how well test-takers are performing on that particular question.\n2. Std. dev: Standard deviation is a measure of how much individual scores on a test item vary from the average score. It helps us see how consistent or spread out the scores are for that item.\n3. Difficulty (P): Difficulty refers to how hard or easy a test item is for the test-takers. We estimate this by looking at the average score that people achieve on the item, and then we divide it by the range of possible scores. Essentially, it helps us understand if the item is generally difficult or not.\n4. ritem-total, ritem-rest: These correlations indicate how well a specific test item relates to the overall test score and how it relates to the rest of the test items. In simple terms, they show how closely linked the item is to the overall performance and to the other questions in the test.\n5. %1$s if removed: Cronbach's %1$s is a measure of the internal consistency or reliability of a test. The column represents what happens to the reliability of the test when a particular item is removed. It helps us assess how important or unimportant a specific question is for the overall reliability of the test.", "\u03B1")) text$position <- position @@ -238,12 +243,12 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { tb$addColumnInfo(name = "rit", title = gettext("ritem-total"), type = "number") tb$addColumnInfo(name = "rir", title = gettext("ritem-rest"), type = "number") tb$addColumnInfo(name = "alpha", title = gettextf("%1$s if removed", "\u03B1"), type = "number") - tb$dependOn(options = c(.irtCommonDeps(type = "ctt"), "tableItemStatistics")) + tb$dependOn(options = c(.cttDeps(), "tableItemStatistics")) jaspResults[["tableItemStatistics"]] <- tb if (!ready) { return() } - state <- .irtCTTState(dataset, options, jaspResults) + state <- .cttState(dataset, options, jaspResults) tb[["item"]] <- state[["itemInfo"]][["item"]] tb[["score"]] <- state[["itemInfo"]][["score"]] tb[["sd"]] <- state[["itemInfo"]][["sd"]] @@ -253,7 +258,7 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { tb[["alpha"]] <- state[["itemInfo"]][["alpha"]] } -.irtCTTHistogram <- function(dataset, options, jaspResults, ready, position) { +.cttHistogram <- function(dataset, options, jaspResults, ready, position) { if (options[["explanatoryText"]] && options[["plotHistogram"]]) { text <- createJaspHtml(gettext("

Explanatory Text: Histogram of Sum Scores

The figure below displays a histogram of the test (i.e., sum) scores. It shows the frequencies of different total scores or sums of responses, which can help you understand the central tendency and variability of the data. Additionally, you can assess patterns or trends in the distribution, such as skewness or bimodality,")) text$position <- position @@ -265,12 +270,12 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { } fg <- createJaspPlot(title = gettext("Histogram of Sum Scores"), height = 320, width = 480) fg$position <- position + 1 - fg$dependOn(options = c(.irtCommonDeps(type = "ctt"), "plotHistogram")) + fg$dependOn(options = c(.cttDeps(), "plotHistogram")) jaspResults[["plotHistogram"]] <- fg if (!ready) { return() } - state <- .irtCTTState(dataset, options, jaspResults) + state <- .cttState(dataset, options, jaspResults) plotdata <- data.frame(x = seq_len(state[["maxScore"]]), y = rep(NA, state[["maxScore"]])) for (i in seq_len(state[["maxScore"]])) { plotdata$y[i] <- length(which(state[["sumScores"]] < i & state[["sumScores"]] >= (i - 1))) @@ -286,7 +291,7 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { fg$plotObject <- p } -.irtCTTDiscrimination <- function(dataset, options, jaspResults, ready, position) { +.cttDiscrimination <- function(dataset, options, jaspResults, ready, position) { if (options[["explanatoryText"]] && options[["plotItems"]]) { text <- createJaspHtml(gettext("

Explanatory Text: Difficulty and Discrimination Plot

The figure below displays a bar chart of the item difficulty (measured by P) and discrimination (measured by ritem-total or Rit). This figure shows which items were the easiest to answer (left) and which items were the most difficult to answer (right).")) text$position <- position @@ -298,12 +303,12 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { } fg <- createJaspPlot(title = gettext("Item Difficulty and Discrimination Plot"), height = 320, width = 750) fg$position <- position - fg$dependOn(options = c(.irtCommonDeps(type = "ctt"), "plotItems")) + fg$dependOn(options = c(.cttDeps(), "plotItems")) jaspResults[["plotItems"]] <- fg if (!ready) { return() } - state <- .irtCTTState(dataset, options, jaspResults) + state <- .cttState(dataset, options, jaspResults) plotdata <- data.frame( x = factor(rep(options[["items"]], 2)), y = c(state[["itemInfo"]][["p"]], state[["itemInfo"]][["rit"]]), @@ -324,7 +329,7 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { fg$plotObject <- p } -.irtCTTHeatmap <- function(dataset, options, jaspResults, ready, position) { +.cttHeatmap <- function(dataset, options, jaspResults, ready, position) { if (options[["explanatoryText"]] && options[["plotCorrelationHeatmap"]]) { text <- createJaspHtml(gettext("

Explanatory Text: Correlation Heatmap

A correlation heat map displays Pearson correlations between item scores. The Pearson correlation coefficient describes linear correlation between two items. Positive correlations are shown in blue, while negative correlations are shown in red.")) text$position <- position @@ -336,12 +341,12 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { } fg <- createJaspPlot(title = gettext("Item Correlation Heatmap"), height = 40 * length(options[["items"]]), width = 40 * length(options[["items"]]) + 100) fg$position <- position + 1 - fg$dependOn(options = c(.irtCommonDeps(type = "ctt"), "plotCorrelationHeatmap", "plotCorrelationHeatmapShowValues")) + fg$dependOn(options = c(.cttDeps(), "plotCorrelationHeatmap", "plotCorrelationHeatmapShowValues")) jaspResults[["plotCorrelationHeatmap"]] <- fg if (!ready) { return() } - state <- .irtCTTState(dataset, options, jaspResults) + state <- .cttState(dataset, options, jaspResults) plotdata <- as.data.frame(cor(state[["items"]])) plotdata$row <- rownames(plotdata) plotdata <- reshape2::melt(plotdata, id.var = "row") diff --git a/tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-1.svg b/tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-1.svg new file mode 100644 index 00000000..2c0dc749 --- /dev/null +++ b/tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-1.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 +2 +4 +6 +8 +10 + + + + + + + + + + + + + +0 +10 +20 +30 +40 +50 +Sum Score +Counts +histogram-of-sum-scores-1 + + diff --git a/tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-2.svg b/tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-2.svg new file mode 100644 index 00000000..540c337a --- /dev/null +++ b/tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-2.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 +1 +2 +3 +4 +5 +6 +7 + + + + + + + + + + + + + + +0 +5 +10 +15 +20 +Sum Score +Counts +histogram-of-sum-scores-2 + + diff --git a/tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-3.svg b/tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-3.svg new file mode 100644 index 00000000..5a759b4b --- /dev/null +++ b/tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-3.svg @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 +1 +2 +3 +4 +5 +6 +7 + + + + + + + + + + + + + + + +0 +20 +40 +60 +80 +100 +Sum Score +Counts +histogram-of-sum-scores-3 + + diff --git a/tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-4.svg b/tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-4.svg new file mode 100644 index 00000000..9a4fea69 --- /dev/null +++ b/tests/testthat/_snaps/classicaltesttheory/histogram-of-sum-scores-4.svg @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 +1 +2 +3 +4 +5 + + + + + + + + + + + + + +0 +20 +40 +60 +80 +100 +Sum Score +Counts +histogram-of-sum-scores-4 + + diff --git a/tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-1.svg b/tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-1.svg new file mode 100644 index 00000000..be6f5a6a --- /dev/null +++ b/tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-1.svg @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Q1 +Q2 +Q3 +Q4 +Q5 +Q6 +Q7 +Q8 +Q9 +Q10 +Q11 +Q12 +Q13 +Q14 +Q15 +Q16 +Q17 +Q18 +Q19 +Q20 +Q21 +Q22 +Q23 +Q24 +Q25 +Q26 +Q27 +Q28 +Q29 +Q30 +Q31 +Q32 +Q33 +Q34 +Q35 +Q36 +Q37 +Q38 +Q39 +Q40 +Q41 +Q42 +Q43 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Q1 +Q2 +Q3 +Q4 +Q5 +Q6 +Q7 +Q8 +Q9 +Q10 +Q11 +Q12 +Q13 +Q14 +Q15 +Q16 +Q17 +Q18 +Q19 +Q20 +Q21 +Q22 +Q23 +Q24 +Q25 +Q26 +Q27 +Q28 +Q29 +Q30 +Q31 +Q32 +Q33 +Q34 +Q35 +Q36 +Q37 +Q38 +Q39 +Q40 +Q41 +Q42 +Q43 + + + + + + + + + + + + + +-1.0 +-0.5 +0.0 +0.5 +1.0 +item-correlation-heatmap-1 + + diff --git a/tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-2.svg b/tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-2.svg new file mode 100644 index 00000000..1fe93278 --- /dev/null +++ b/tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-2.svg @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Q1 +Q2 +Q3 +Q4 +Q5 +Q6 +Q7 +Q8 +Q9 +Q10 +Q11 +Q12 +Q13 +Q14 +Q15 +Q16 +Q17 +Q18 +Q19 +Q20 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Q1 +Q2 +Q3 +Q4 +Q5 +Q6 +Q7 +Q8 +Q9 +Q10 +Q11 +Q12 +Q13 +Q14 +Q15 +Q16 +Q17 +Q18 +Q19 +Q20 + + + + + + + + + + + + + +-1.0 +-0.5 +0.0 +0.5 +1.0 +item-correlation-heatmap-2 + + diff --git a/tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-3.svg b/tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-3.svg new file mode 100644 index 00000000..9f17241e --- /dev/null +++ b/tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-3.svg @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1a +1b +1c +1d +1e +1f +2a +2b +2c +2d +2e +2f +3a +3b +3c +3d +3e +3f +4a +4b +4c +4d +4e +5a +5b +5c +5d +5e +5f +5g +5h +5i +6a +6b +6c +6d +7a +7b +7c +7d +7e +7f +7g + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1a +1b +1c +1d +1e +1f +2a +2b +2c +2d +2e +2f +3a +3b +3c +3d +3e +3f +4a +4b +4c +4d +4e +5a +5b +5c +5d +5e +5f +5g +5h +5i +6a +6b +6c +6d +7a +7b +7c +7d +7e +7f +7g + + + + + + + + + + + + + +-1.0 +-0.5 +0.0 +0.5 +1.0 +item-correlation-heatmap-3 + + diff --git a/tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-4.svg b/tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-4.svg new file mode 100644 index 00000000..c0cc3a45 --- /dev/null +++ b/tests/testthat/_snaps/classicaltesttheory/item-correlation-heatmap-4.svg @@ -0,0 +1,246 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1a +1b +1c +1d +1e +1f +1g +1h +1i +2a +2b +2c +2d +2e +2f +3a +3b +3c +3d +3e +3f +3g +4a +4b +4c +4d +4e +4f +5a +5b +5c +5d +5e +5f +5g +6a +6b +6c +6d +6e +6f +7a +7b +7c +7d +7e +7f + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1a +1b +1c +1d +1e +1f +1g +1h +1i +2a +2b +2c +2d +2e +2f +3a +3b +3c +3d +3e +3f +3g +4a +4b +4c +4d +4e +4f +5a +5b +5c +5d +5e +5f +5g +6a +6b +6c +6d +6e +6f +7a +7b +7c +7d +7e +7f + + + + + + + + + + + + + +-1.0 +-0.5 +0.0 +0.5 +1.0 +item-correlation-heatmap-4 + + diff --git a/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-1.svg b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-1.svg new file mode 100644 index 00000000..a85274a1 --- /dev/null +++ b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-1.svg @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.0 +0.2 +0.4 +0.6 +0.8 +1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Q40 +Q41 +Q30 +Q5 +Q42 +Q32 +Q24 +Q2 +Q20 +Q31 +Q43 +Q28 +Q29 +Q11 +Q21 +Q17 +Q12 +Q19 +Q23 +Q9 +Q35 +Q6 +Q27 +Q33 +Q22 +Q36 +Q26 +Q18 +Q3 +Q34 +Q8 +Q10 +Q1 +Q7 +Q38 +Q14 +Q37 +Q25 +Q13 +Q16 +Q4 +Q15 +Q39 +Item (ordered by difficulty) + + + + + + +Difficulty (P) +Discrimination (Rit) +item-difficulty-and-discrimination-plot-1 + + diff --git a/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-2.svg b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-2.svg new file mode 100644 index 00000000..c5298833 --- /dev/null +++ b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-2.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.0 +0.2 +0.4 +0.6 +0.8 +1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + +Q8 +Q17 +Q10 +Q13 +Q3 +Q4 +Q12 +Q18 +Q7 +Q2 +Q5 +Q11 +Q19 +Q20 +Q14 +Q16 +Q6 +Q15 +Q1 +Q9 +Item (ordered by difficulty) + + + + + + +Difficulty (P) +Discrimination (Rit) +item-difficulty-and-discrimination-plot-2 + + diff --git a/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-3.svg b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-3.svg new file mode 100644 index 00000000..ebbc5ddd --- /dev/null +++ b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-3.svg @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-0.2 +0.0 +0.2 +0.4 +0.6 +0.8 +1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4e +1e +5g +7e +6a +5f +2b +5h +4d +7d +5a +3d +7f +5b +5d +1a +5e +4c +3b +3f +5i +4a +6d +7g +1d +1f +6b +1c +2a +2c +2d +3a +2f +3e +6c +2e +3c +7a +5c +7c +7b +4b +1b +Item (ordered by difficulty) + + + + + + +Difficulty (P) +Discrimination (Rit) +item-difficulty-and-discrimination-plot-3 + + diff --git a/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-4.svg b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-4.svg new file mode 100644 index 00000000..d809f70f --- /dev/null +++ b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-4.svg @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-0.2 +0.0 +0.2 +0.4 +0.6 +0.8 +1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +6f +5d +3g +4b +3b +6c +5g +7f +7e +3d +6d +2f +7d +6a +4a +6b +3e +6e +7c +1a +4c +5e +2e +4e +4f +3a +5b +5a +2a +1b +2b +7b +4d +1i +3c +2c +1f +2d +3f +1h +5f +1c +1d +1e +1g +5c +7a +Item (ordered by difficulty) + + + + + + +Difficulty (P) +Discrimination (Rit) +item-difficulty-and-discrimination-plot-4 + + diff --git a/tests/testthat/test-classicaltesttheory.R b/tests/testthat/test-classicaltesttheory.R index 7fc7c199..70e0ef8d 100644 --- a/tests/testthat/test-classicaltesttheory.R +++ b/tests/testthat/test-classicaltesttheory.R @@ -1,4 +1,4 @@ -context("[IRT] Classical Test Theory") +context("Classical Test Theory") # Consistency test 1, file: binary.csv ######################################### From 67e0dea60862c81b0b5978e4023a238098380dfa Mon Sep 17 00:00:00 2001 From: Koen Derks Date: Fri, 22 Nov 2024 14:11:55 +0100 Subject: [PATCH 3/6] Update classicalTestTheory.qml --- inst/qml/classicalTestTheory.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/inst/qml/classicalTestTheory.qml b/inst/qml/classicalTestTheory.qml index 4142e07b..5ff6f99c 100755 --- a/inst/qml/classicalTestTheory.qml +++ b/inst/qml/classicalTestTheory.qml @@ -21,8 +21,6 @@ import QtQuick.Layouts import JASP import JASP.Controls -import "./common" as COMMON - Form { info: qsTr("Classical Test Theory (CTT) is a traditional framework for analyzing test scores. It focuses on observed scores as the primary measure of an individual's ability and assumes that these scores consist of a true score and measurement error. CTT provides simple reliability indices, such as Cronbach's alpha, to assess the consistency of test scores but doesn't account for item characteristics or the latent ability of individuals, limiting its ability to address more complex assessments.") From 6ceb12bef313d6fe0c298f059d195f3e6eb90d18 Mon Sep 17 00:00:00 2001 From: Koen Derks Date: Fri, 22 Nov 2024 14:13:09 +0100 Subject: [PATCH 4/6] Update classicalTestTheory.qml --- inst/qml/classicalTestTheory.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/inst/qml/classicalTestTheory.qml b/inst/qml/classicalTestTheory.qml index 5ff6f99c..64c989b7 100755 --- a/inst/qml/classicalTestTheory.qml +++ b/inst/qml/classicalTestTheory.qml @@ -136,6 +136,4 @@ Form } } } - - COMMON.DownloadReport { } } From b8a2dd3466700d25ecb2664ba860e6ecedde3c84 Mon Sep 17 00:00:00 2001 From: Koen Derks Date: Fri, 22 Nov 2024 14:14:25 +0100 Subject: [PATCH 5/6] Update DESCRIPTION --- DESCRIPTION | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DESCRIPTION b/DESCRIPTION index c4db8c65..caa1cbd3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,7 +19,9 @@ Imports: jaspGraphs, LaplacesDemon, lme4, + ltm, MASS, + moments, psych, mirt Remotes: From 9de9c8038ace8e1da751de25aebd1b292e7ef3aa Mon Sep 17 00:00:00 2001 From: Koen Derks Date: Fri, 22 Nov 2024 14:19:22 +0100 Subject: [PATCH 6/6] Update --- R/classicaltesttheory.R | 2 +- ...m-difficulty-and-discrimination-plot-1.svg | 86 ++++++++--------- ...m-difficulty-and-discrimination-plot-2.svg | 40 ++++---- ...m-difficulty-and-discrimination-plot-3.svg | 86 ++++++++--------- ...m-difficulty-and-discrimination-plot-4.svg | 94 +++++++++---------- 5 files changed, 154 insertions(+), 154 deletions(-) diff --git a/R/classicaltesttheory.R b/R/classicaltesttheory.R index 2ed625c3..9298fc18 100755 --- a/R/classicaltesttheory.R +++ b/R/classicaltesttheory.R @@ -325,7 +325,7 @@ classicalTestTheory <- function(jaspResults, dataset, options, ...) { ggplot2::scale_fill_manual(name = NULL, values = c("firebrick", "dodgerblue")) + jaspGraphs::geom_rangeframe() + jaspGraphs::themeJaspRaw(legend.position = "top") + - ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 45, hjust = 1, vjust = 1.2, size = 12)) + ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 45, hjust = 1, vjust = 1, size = 12)) fg$plotObject <- p } diff --git a/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-1.svg b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-1.svg index a85274a1..678d5955 100644 --- a/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-1.svg +++ b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-1.svg @@ -175,49 +175,49 @@ -Q40 -Q41 -Q30 -Q5 -Q42 -Q32 -Q24 -Q2 -Q20 -Q31 -Q43 -Q28 -Q29 -Q11 -Q21 -Q17 -Q12 -Q19 -Q23 -Q9 -Q35 -Q6 -Q27 -Q33 -Q22 -Q36 -Q26 -Q18 -Q3 -Q34 -Q8 -Q10 -Q1 -Q7 -Q38 -Q14 -Q37 -Q25 -Q13 -Q16 -Q4 -Q15 -Q39 +Q40 +Q41 +Q30 +Q5 +Q42 +Q32 +Q24 +Q2 +Q20 +Q31 +Q43 +Q28 +Q29 +Q11 +Q21 +Q17 +Q12 +Q19 +Q23 +Q9 +Q35 +Q6 +Q27 +Q33 +Q22 +Q36 +Q26 +Q18 +Q3 +Q34 +Q8 +Q10 +Q1 +Q7 +Q38 +Q14 +Q37 +Q25 +Q13 +Q16 +Q4 +Q15 +Q39 Item (ordered by difficulty) diff --git a/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-2.svg b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-2.svg index c5298833..224b3619 100644 --- a/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-2.svg +++ b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-2.svg @@ -106,26 +106,26 @@ -Q8 -Q17 -Q10 -Q13 -Q3 -Q4 -Q12 -Q18 -Q7 -Q2 -Q5 -Q11 -Q19 -Q20 -Q14 -Q16 -Q6 -Q15 -Q1 -Q9 +Q8 +Q17 +Q10 +Q13 +Q3 +Q4 +Q12 +Q18 +Q7 +Q2 +Q5 +Q11 +Q19 +Q20 +Q14 +Q16 +Q6 +Q15 +Q1 +Q9 Item (ordered by difficulty) diff --git a/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-3.svg b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-3.svg index ebbc5ddd..85a87c4a 100644 --- a/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-3.svg +++ b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-3.svg @@ -177,49 +177,49 @@ -4e -1e -5g -7e -6a -5f -2b -5h -4d -7d -5a -3d -7f -5b -5d -1a -5e -4c -3b -3f -5i -4a -6d -7g -1d -1f -6b -1c -2a -2c -2d -3a -2f -3e -6c -2e -3c -7a -5c -7c -7b -4b -1b +4e +1e +5g +7e +6a +5f +2b +5h +4d +7d +5a +3d +7f +5b +5d +1a +5e +4c +3b +3f +5i +4a +6d +7g +1d +1f +6b +1c +2a +2c +2d +3a +2f +3e +6c +2e +3c +7a +5c +7c +7b +4b +1b Item (ordered by difficulty) diff --git a/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-4.svg b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-4.svg index d809f70f..04aff7ed 100644 --- a/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-4.svg +++ b/tests/testthat/_snaps/classicaltesttheory/item-difficulty-and-discrimination-plot-4.svg @@ -188,53 +188,53 @@ -6f -5d -3g -4b -3b -6c -5g -7f -7e -3d -6d -2f -7d -6a -4a -6b -3e -6e -7c -1a -4c -5e -2e -4e -4f -3a -5b -5a -2a -1b -2b -7b -4d -1i -3c -2c -1f -2d -3f -1h -5f -1c -1d -1e -1g -5c -7a +6f +5d +3g +4b +3b +6c +5g +7f +7e +3d +6d +2f +7d +6a +4a +6b +3e +6e +7c +1a +4c +5e +2e +4e +4f +3a +5b +5a +2a +1b +2b +7b +4d +1i +3c +2c +1f +2d +3f +1h +5f +1c +1d +1e +1g +5c +7a Item (ordered by difficulty)