Skip to content

Commit

Permalink
Merge branch 'issue-13' into develop (close #13)
Browse files Browse the repository at this point in the history
* issue-13:
  Updated NEWS.md
  Increment version number to 0.2.0.9001
  Removed alternative numeric p-value (#13)
  Removed feature version
  Updated feature version
  Added calculation of mid-P value (#13)
  Updated RoxygenNote version
  Adjusted unit test expectations (#13)
  Added calculation of alternative numeric p-value (#13)
  Increment version number to 0.2.0.9000-1709818294
  • Loading branch information
wleoncio committed Apr 5, 2024
2 parents 3c263d4 + fe17834 commit 2af89f6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: permChacko
Title: Chacko Test for Order-Restriction with Permutation
Version: 0.2.0.9000
Version: 0.2.0.9001
Date: 2023-11-07
Authors@R:
c(
Expand All @@ -25,7 +25,7 @@ Description: Implements an extension of the Chacko chi-square test for
License: GPL (>= 3)
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Suggests:
knitr,
rmarkdown,
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# permChacko (development version)

* Improved printing of hypothesis ([issue #11](https://github.com/ocbe-uio/permChacko/issues/11)).
* Added calculation of mid-P values ([issue #13](https://github.com/ocbe-uio/permChacko/issues/13)).

# permChacko 0.2.0

Expand Down
2 changes: 2 additions & 0 deletions R/permChacko.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ permChacko <- function(x, n_perm = 1000L, verbosity = 0) {
# The p-value is simply the fraction of such permutations that yield a test
# statistic equal to or greater than the one we originally observed.
perm_p_value <- sum(perm_chisq_bar >= chisq_bar) / n_perm
perm_mid_p_value <- (sum(perm_chisq_bar > chisq_bar) + 0.5 * sum(perm_chisq_bar == chisq_bar)) / n_perm

Check warning on line 56 in R/permChacko.R

View workflow job for this annotation

GitHub Actions / lint

file=R/permChacko.R,line=56,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 105 characters.
m <- nrow(x_t)
anal_p_value <- ifelse(
test = m > 1L,
Expand All @@ -70,6 +71,7 @@ permChacko <- function(x, n_perm = 1000L, verbosity = 0) {
p_values <- c(
"analytic" = anal_p_value,
"numeric" = perm_p_value,
"numeric_mid" = perm_mid_p_value,
"tabular" = table_p_value
)
out <- list(
Expand Down
8 changes: 6 additions & 2 deletions R/print.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ print.chacko_test <- function(x, ...) {
"p-values:\n",
" Analytic p-value : %f\n",
" Numeric p-value : %f (%d permutations)\n",
" Numeric mid-p value : %f (%d permutations)\n",
" Tabular p-value : %f\n"
),
printHypothesis("p", seq_along(x$observed_data), "=="),
printHypothesis("p", seq_along(x$observed_data), "<="),
x[["statistic"]], p_values[["analytic"]],
p_values[["numeric"]], x[["n_perm"]], p_values[["tabular"]]
x[["statistic"]],
p_values[["analytic"]],
p_values[["numeric"]], x[["n_perm"]],
p_values[["numeric_mid"]], x[["n_perm"]],
p_values[["tabular"]]
)
)
}
Expand Down
1 change: 0 additions & 1 deletion man/permChacko-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-print-and-summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test_that("print.chacko_test() works as expected", {
y <- permChacko(rpois(3, 5), n_perm = 30L)
expect_output(print(y), "Test statistic \\(chisq_bar\\): 0\\.500000")
expect_output(print(y), "Analytic p-value\\s+: 0\\.778801")
expect_output(print(y), "Numeric p-value\\s+: 0\\.400000 \\(30 permutation")
expect_output(print(y), "Numeric p-value.+: 0\\.400000 \\(30 permutation")
expect_output(print(y), "Tabular p-value\\s+: 0\\.369550")
})
test_that("summary.reduced_vector() works as expected", {
Expand Down

0 comments on commit 2af89f6

Please sign in to comment.