Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions R/unidimensionalReliabilityBayesian.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ unidimensionalReliabilityBayesian <- function(jaspResults, dataset, options) {
itemDroppedSelectedItem = unlist(options[c("itemDeletedOmega", "itemDeletedAlpha", "itemDeletedLambda2", "itemDeletedSplithalf")]),

namesEstimators = list(
tables = c("Coefficient \u03C9", "Coefficient \u03B1", "Guttman's \u03BB2", "Split-half coefficient",
tables = c("McDonald's \u03C9", "Cronbach's \u03B1", "Guttman's \u03BB2", "Split-half coefficient",
"Average interitem correlation", "Mean", "Variance", "SD"),
tables_item = c("Coefficient \u03C9", "Coefficient \u03B1", "Guttman's \u03BB2", gettext("Split-half coefficient"),
tables_item = c("McDonald's \u03C9", "Cronbach's \u03B1", "Guttman's \u03BB2", gettext("Split-half coefficient"),
gettext("Item-rest correlation"), gettext("Mean"), gettext("Variance"), gettext("SD")),
coefficients = c("Coefficient \u03C9", "Coefficient \u03B1", "Guttman's \u03BB2", gettext("Split-half coefficient"),
coefficients = c("McDonald's \u03C9", "Cronbach's \u03B1", "Guttman's \u03BB2", gettext("Split-half coefficient"),
gettext("Item-rest correlation")),
plots = list(expression("Coefficient"~omega), expression("Cronbach\'s"~alpha), expression("Guttman's"~lambda[2]),
plots = list(expression("McDonald\'s"~omega), expression("Cronbach\'s"~alpha), expression("Guttman\'s"~lambda[2]),
gettext("Split-half coefficient")),
plotsNoGreek = c("omega", "alpha", "lambda2", "splithalf")
)
Expand Down
53 changes: 28 additions & 25 deletions R/unidimensionalReliabilityFrequentist.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#' @export
unidimensionalReliabilityFrequentist <- function(jaspResults, dataset, options) {


Comment on lines 4 to +5
Copy link

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The added blank line at line 5 appears unnecessary and doesn't improve code readability.

Suggested change

Copilot uses AI. Check for mistakes.
# check for listwise deletion
datasetOld <- dataset
dataset <- .handleData(datasetOld, options)
Expand Down Expand Up @@ -54,11 +55,11 @@ unidimensionalReliabilityFrequentist <- function(jaspResults, dataset, options)
itemDroppedSelected = unlist(options[c("itemDeletedOmega", "itemDeletedAlpha", "itemDeletedLambda2", "itemDeletedSplithalf",
"itemRestCorrelation", "itemMean", "itemVar", "itemSd")]),
namesEstimators = list(
tables = c("Coefficient \u03C9", "Coefficient \u03B1", "Guttman's \u03BB2", gettext("Split-half coefficient"),
tables = c("McDonald's \u03C9", "Cronbach's \u03B1", "Guttman's \u03BB2", gettext("Split-half coefficient"),
gettext("Average interitem correlation"), gettext("Mean"), gettext("Variance"), gettext("SD")),
tables_item = c("Coefficient \u03C9", "Coefficient \u03B1", "Guttman's \u03BB2", gettext("Split-half coefficient"),
tables_item = c("McDonald's \u03C9", "Cronbach's \u03B1", "Guttman's \u03BB2", gettext("Split-half coefficient"),
gettext("Item-rest correlation"), gettext("Mean"), gettext("Variance"), gettext("SD")),
coefficientsDeleted = c("Coefficient \u03C9", "Coefficient \u03B1", "Guttman's \u03BB2", gettext("Split-half coefficient")))
coefficientsDeleted = c("McDonald's \u03C9", "Cronbach's \u03B1", "Guttman's \u03BB2", gettext("Split-half coefficient")))
)

return(derivedOptions)
Expand Down Expand Up @@ -952,8 +953,8 @@ unidimensionalReliabilityFrequentist <- function(jaspResults, dataset, options)
out[["conf"]][["scaleSplithalf"]] <- quantile(samp, probs = c((1 - ciValue) / 2, 1 - (1 - ciValue) / 2), na.rm = TRUE)
out[["se"]][["scaleSplithalf"]] <- sd(samp, na.rm = TRUE)
} else { # interval analytic
partSums1 <- rowSums(dtUse[, splits[[1]]])
partSums2 <- rowSums(dtUse[, splits[[2]]])
partSums1 <- rowSums(dtUse[, splits[[1]], drop = FALSE])
partSums2 <- rowSums(dtUse[, splits[[2]], drop = FALSE])

out[["se"]][["scaleSplithalf"]] <- .seSplithalf(partSums1, partSums2, model[["use.cases"]])
out[["conf"]][["scaleSplithalf"]] <- out[["est"]][["scaleSplithalf"]] + c(-1, 1) * out[["se"]][["scaleSplithalf"]] * qnorm(1 - (1 - ciValue) / 2)
Expand Down Expand Up @@ -1168,31 +1169,33 @@ unidimensionalReliabilityFrequentist <- function(jaspResults, dataset, options)
out[["est"]][["itemDeletedSplithalf"]] <- c(NA, NA)
out[["lower"]][["itemDeletedSplithalf"]] <- c(NA, NA)
out[["upper"]][["itemDeletedSplithalf"]] <- c(NA, NA)
}

for (i in seq_len(ncol(dtUse))) {
dtCut <- dtUse[, -i, drop = FALSE]
nit <- ncol(dtCut)
splits <- split(seq_len(nit), 1:2)
est <- .splithalfData(dtCut, splits = splits, useCase = model[["use.cases"]])
out[["est"]][["itemDeletedSplithalf"]][i] <- est
} else {
for (i in seq_len(ncol(dtUse))) {
dtCut <- dtUse[, -i, drop = FALSE]
nit <- ncol(dtCut)
splits <- split(seq_len(nit), 1:2)
est <- .splithalfData(dtCut, splits = splits, useCase = model[["use.cases"]])
out[["est"]][["itemDeletedSplithalf"]][i] <- est

if (options[["intervalMethod"]] == "analytic") {
if (options[["intervalMethod"]] == "analytic") {

partSums1 <- rowSums(dtCut[, splits[[1]]])
partSums2 <- rowSums(dtCut[, splits[[2]]])
partSums1 <- rowSums(dtCut[, splits[[1]]])
partSums2 <- rowSums(dtCut[, splits[[2]]])

se <- .seSplithalf(partSums1, partSums2, model[["use.cases"]])
conf <- est + c(-1, 1) * se * qnorm(1 - (1 - ciValue) / 2)
out[["lower"]][["itemDeletedSplithalf"]][i] <- conf[1]
out[["upper"]][["itemDeletedSplithalf"]][i] <- conf[2]
} else {
itemSamp <- model[["itemDeletedSplithalf"]][["itemSamp"]]
conf <- quantile(itemSamp[, i], probs = c((1 - ciValue) / 2, 1 - (1 - ciValue) / 2), na.rm = TRUE)
out[["lower"]][["itemDeletedSplithalf"]][i] <- conf[1]
out[["upper"]][["itemDeletedSplithalf"]][i] <- conf[2]
se <- .seSplithalf(partSums1, partSums2, model[["use.cases"]])
conf <- est + c(-1, 1) * se * qnorm(1 - (1 - ciValue) / 2)
out[["lower"]][["itemDeletedSplithalf"]][i] <- conf[1]
out[["upper"]][["itemDeletedSplithalf"]][i] <- conf[2]
} else {
itemSamp <- model[["itemDeletedSplithalf"]][["itemSamp"]]
conf <- quantile(itemSamp[, i], probs = c((1 - ciValue) / 2, 1 - (1 - ciValue) / 2), na.rm = TRUE)
out[["lower"]][["itemDeletedSplithalf"]][i] <- conf[1]
out[["upper"]][["itemDeletedSplithalf"]][i] <- conf[2]
}
}
}


}

Comment on lines +1197 to 1200
Copy link

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The added blank lines around the closing brace appear unnecessary and don't improve code readability.

Suggested change
}
}

Copilot uses AI. Check for mistakes.
# item-rest correlation
Expand Down
6 changes: 3 additions & 3 deletions inst/Description.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Description

Analysis
{
title: qsTr("Unidimensional Reliability")
title: qsTr("Reliability")
qml: "UnidimensionalReliabilityFrequentist.qml"
func: "unidimensionalReliabilityFrequentist"
}
Expand Down Expand Up @@ -64,8 +64,8 @@ Description
}
Analysis
{
menu: qsTr("Unidimensional Reliability")
title: qsTr("Bayesian Unidimensional Reliability")
menu: qsTr("Reliability")
title: qsTr("Bayesian Reliability")
qml: "UnidimensionalReliabilityBayesian.qml"
func: "unidimensionalReliabilityBayesian"
}
Expand Down
4 changes: 2 additions & 2 deletions inst/help/unidimensionalReliabilityBayesian.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ The Bayesian unidimensional reliability analysis allows the user to test the sca
### Scale Statistics
- The CTT-coefficients alpha, lambda 2, and the split-half coefficient are computed from the data covariance matrix. Coefficient omega is computed from the centered data matrix.
- Credible interval: default is 95%
- Coefficient omega: The same as McDonald's omega (for unidimensional data, based on the single-factor model). Note the total test variance in the denominator of the reliability equation is the model implied total variance, that is, the summed model implied covariance matrix.
- Coefficient alpha: The same as Cronbach's alpha (for binary items the coefficient equals KR20)
- McDonald's omega (for unidimensional data, based on the single-factor model). Note the total test variance in the denominator of the reliability equation is the model implied total variance, that is, the summed model implied covariance matrix.
- Cronbach's alpha (for binary items the coefficient equals KR20)
- Guttman's lambda 2
- Split-half coefficient: Correlates the sum scores of two test-halves. By default the variables are split into odd and even numbered items in order or appearance in the variables window. If another split is desired the variables just need to be reordered.
- Average interitem correlation
Expand Down
4 changes: 2 additions & 2 deletions inst/help/unidimensionalReliabilityFrequentist.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ The frequentist unidimensional reliability analysis allows the user to test the

### Scale Statistics
- Confidence interval: default is 95%
- Coefficient omega: The same as McDonald's omega (for unidimensional data, based on the single-factor model). Note the total test variance in the denominator of the reliability equation is the model implied total variance, that is, the summed model implied covariance matrix.
- Coefficient alpha: The same as Cronbach's alpha (for binary items the coefficient equals KR20)
- McDonald's omega (for unidimensional data, based on the single-factor model). Note the total test variance in the denominator of the reliability equation is the model implied total variance, that is, the summed model implied covariance matrix.
- Cronbach's alpha (for binary items the coefficient equals KR20)
- Guttman's lambda 2
- Split-half coefficient: Correlates the sum scores of two test-halves. By default the variables are split into odd and even numbered items in order or appearance in the variables window. If another split is desired the variables just need to be reordered.
- Average interitem correlation
Expand Down
12 changes: 6 additions & 6 deletions inst/qml/UnidimensionalReliabilityBayesian.qml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ Form
{
id: omega
name: "scaleOmega"
label: qsTr("Coefficient ω")
label: qsTr("McDonald's ω")
checked: true
}

CheckBox
{
id: alpha
name: "scaleAlpha";
label: qsTr("Coefficient α");
label: qsTr("Cronbach's α");
}

CheckBox
Expand Down Expand Up @@ -113,15 +113,15 @@ Form
{
id: omegaItem
name: "itemDeletedOmega";
label: qsTr("Coefficient ω (if item dropped)");
label: qsTr("McDonald's ω (if item dropped)");
enabled: omega.checked
}

CheckBox
{
id: alphaItem
name: "itemDeletedAlpha";
label: qsTr("Coefficient α (if item dropped)");
label: qsTr("Cronbach's α (if item dropped)");
enabled: alpha.checked
}

Expand Down Expand Up @@ -391,7 +391,7 @@ Form
}
Group
{
title: qsTr("Coefficient ω")
title: qsTr("McDonald's ω")

RowLayout
{
Expand Down Expand Up @@ -456,7 +456,7 @@ Form

Group
{
title: qsTr("Coefficient ω Estimation")
title: qsTr("McDonald's ω Estimation")
enabled: omega.checked
CheckBox
{
Expand Down
10 changes: 5 additions & 5 deletions inst/qml/UnidimensionalReliabilityFrequentist.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ Form
{
id: omega
name: "scaleOmega"
label: qsTr("Coefficient ω")
label: qsTr("McDonald's ω")
checked: true
}

CheckBox
{
id: alpha
name: "scaleAlpha";
label: qsTr("Coefficient α");
label: qsTr("Cronbach's α");
}

CheckBox
Expand Down Expand Up @@ -116,14 +116,14 @@ Form
CheckBox
{
name: "itemDeletedOmega";
label: qsTr("Coefficient ω (if item dropped)");
label: qsTr("McDonald's ω (if item dropped)");
enabled: omega.checked
}

CheckBox
{
name: "itemDeletedAlpha";
label: qsTr("Coefficient α (if item dropped)");
label: qsTr("Cronbach's α (if item dropped)");
enabled: alpha.checked
}

Expand Down Expand Up @@ -232,7 +232,7 @@ Form

RadioButtonGroup
{
title: qsTr("Coefficient ω Estimation")
title: qsTr("McDonald's ω Estimation")
name: "omegaEstimationMethod"
enabled: omega.checked
id: omegaEst
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading