Skip to content

Commit fe668b9

Browse files
authored
Fix post hoc issue (#384)
* update footnote table and naming * handle multiple post hoc tests when conditioning * indicate missing p-values with dot
1 parent 7cf0037 commit fe668b9

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

R/ancova.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -885,18 +885,18 @@ AncovaInternal <- function(jaspResults, dataset = NULL, options) {
885885
}
886886

887887
if (options$postHocTypeStandard)
888-
.anovaPostHocTable(postHocContainer, dataset, options, anovaContainer[["model"]]$object, anovaContainer[["afexModel"]]$object)
888+
.anovaStandardPostHocTable(postHocContainer, dataset, options, anovaContainer[["model"]]$object, anovaContainer[["afexModel"]]$object)
889889

890890
if (options$postHocTypeGames)
891-
.anovaGamesTable(postHocContainer, dataset, options, anovaContainer[["model"]]$object)
891+
.anovaGamesPostHocTable(postHocContainer, dataset, options, anovaContainer[["model"]]$object)
892892

893893
if (options$postHocTypeDunnet)
894-
.anovaDunnettTable(postHocContainer, dataset, options, anovaContainer[["model"]]$object)
894+
.anovaDunnettPostHocTable(postHocContainer, dataset, options, anovaContainer[["model"]]$object)
895895

896896
return()
897897
}
898898

899-
.anovaPostHocTable <- function(postHocContainer, dataset, options, model, afexModel = NULL) {
899+
.anovaStandardPostHocTable <- function(postHocContainer, dataset, options, model, afexModel = NULL) {
900900
if (!is.null(postHocContainer[["postHocStandardContainer"]]))
901901
return()
902902

@@ -958,8 +958,8 @@ AncovaInternal <- function(jaspResults, dataset = NULL, options) {
958958
isBetween = TRUE))
959959
avFootnote <- attr(resultPostHoc[[1]], "mesg")[grep(attr(resultPostHoc[[1]], "mesg"), pattern = "Results are averaged")]
960960
if (length(avFootnote) != 0) {
961-
avTerms <- .unv(strsplit(gsub(avFootnote, pattern = "Results are averaged over the levels of: ", replacement = ""),
962-
", ")[[1]])
961+
avTerms <- strsplit(gsub(avFootnote, pattern = "Results are averaged over the levels of: ", replacement = ""),
962+
", ")[[1]]
963963
postHocStandardContainer[[thisVarNameRef]]$addFootnote(gettextf("Results are averaged over the levels of: %s", paste(avTerms, collapse = ", ")))
964964
}
965965
allPvalues <- do.call(cbind, lapply(resultPostHoc, function(x) x$p.value))
@@ -1098,7 +1098,7 @@ AncovaInternal <- function(jaspResults, dataset = NULL, options) {
10981098
}
10991099

11001100

1101-
.anovaGamesTable <- function(postHocContainer, dataset, options, model) {
1101+
.anovaGamesPostHocTable <- function(postHocContainer, dataset, options, model) {
11021102
if (!is.null(postHocContainer[["postHocGamesContainer"]]))
11031103
return()
11041104

@@ -1197,7 +1197,7 @@ AncovaInternal <- function(jaspResults, dataset = NULL, options) {
11971197
return()
11981198
}
11991199

1200-
.anovaDunnettTable <- function(postHocContainer, dataset, options, model) {
1200+
.anovaDunnettPostHocTable <- function(postHocContainer, dataset, options, model) {
12011201
if (!is.null(postHocContainer[["postHocDunnettContainer"]]))
12021202
return()
12031203

R/anovarepeatedmeasures.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,8 +1000,8 @@ AnovaRepeatedMeasuresInternal <- function(jaspResults, dataset = NULL, options)
10001000

10011001
if (any(postHocVariables[[postHocVarIndex]] %in% allNames)) { ## If the variable is a repeated measures factor
10021002

1003-
resultPostHoc[["scheffe"]] <- ""
1004-
resultPostHoc[["tukey"]] <- ""
1003+
resultPostHoc[["scheffe"]] <- "."
1004+
resultPostHoc[["tukey"]] <- "."
10051005
if (options$postHocCorrectionScheffe || options$postHocCorrectionTukey) {
10061006
cors <- paste(c("Tukey", "Scheffe")[c(options$postHocCorrectionTukey, options$postHocCorrectionScheffe)], collapse = " and ")
10071007

@@ -1024,7 +1024,7 @@ AnovaRepeatedMeasuresInternal <- function(jaspResults, dataset = NULL, options)
10241024
postHocContainer[[thisVarNameRef]]$addFootnote(gettextf("Results are averaged over the levels of: %s", paste(avTerms, collapse = ", ")))
10251025
}
10261026

1027-
if (options[["postHocConditionalTable"]]) {
1027+
if (options[["postHocConditionalTable"]] & isFALSE(is.null(byVariable))) {
10281028
resultPostHoc[[".isNewGroup"]] <- !duplicated(resultPostHoc[[byVariable[termIndex]]])
10291029
} else {
10301030
resultPostHoc[[".isNewGroup"]] <- !duplicated(resultPostHoc[["contrast_A"]])

R/commonAnovaFreq.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
confAdjust <- strsplit(confAdjust, " ")[[1]][1]
143143

144144
if (!includeCI) {
145-
correctionFootnote <- gettextf("P-value adjusted for comparing a family of %s", as.character(nEstimates))
145+
correctionFootnote <- gettextf("P-value adjusted for comparing a family of %s estimates.", as.character(nEstimates))
146146
} else if (isFALSE(includeEffectSize) || isFALSE(isBetween)) {
147147
correctionFootnote <- gettextf("P-value and confidence intervals adjusted for comparing a family of %1$s estimates (confidence intervals corrected using the %2$s method).", nEstimates, confAdjust)
148148
} else {

0 commit comments

Comments
 (0)