Skip to content

Commit

Permalink
Merge branch 'release/2.8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
psychelzh committed Oct 18, 2024
2 parents f4138c1 + 30e96c6 commit 8f87914
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 37 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
^pkgdown$
^README\.Rmd$
^.lintr$
^LICENSE\.md$
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: preproc.iquizoo
Title: Utility Functions for Data Processing of Iquizoo Games
Version: 2.8.1
Version: 2.8.2
Authors@R:
person("Liang", "Zhang", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-9041-1150"))
Expand All @@ -26,7 +26,6 @@ Imports:
Suggests:
covr,
data.table,
mockery,
readr,
roxygen2,
testthat (>= 3.0.0),
Expand All @@ -35,4 +34,4 @@ Config/testthat/edition: 3
Config/testthat/parallel: true
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
MIT License

Copyright (c) 2020 Liang Zhang

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2024
COPYRIGHT HOLDER: preproc.iquizoo authors
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2024 preproc.iquizoo authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# preproc.iquizoo 2.8.2

* Enhance internal function of `calc_sdt()`. This function could be exported in future.

# preproc.iquizoo 2.8.1

## Bug Fixes
Expand Down
22 changes: 15 additions & 7 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ calc_spd_acc <- function(data, ...,
#' stimuli types. Based on `type_signal`, the other types of stimuli will be
#' treated as non-signal stimuli.
#' @return A [tibble][tibble::tibble-package] contains sensitivity index and
#' bias (and other counts measures)
#' bias (and other temporary measures).
#' @keywords internal
calc_sdt <- function(data, type_signal, ...,
by = NULL, name_acc = "acc", name_type = "type") {
Expand Down Expand Up @@ -114,18 +114,26 @@ calc_sdt <- function(data, type_signal, ...,
mutate(
across(
all_of(c("c", "e")),
# log-linear rule of correction extreme proportion
~ stats::qnorm((.x + 0.5) / (.data$c + .data$e + 1)),
.names = "z{.col}"
list(
p = ~ .x / (.data$c + .data$e),
# log-linear rule of correction extreme proportion
z = ~ stats::qnorm((.x + 0.5) / (.data$c + .data$e + 1))
)
)
) |>
pivot_wider(
names_from = "type_fac",
values_from = c("c", "e", "zc", "ze")
values_from = c("c", "e", "c_p", "e_p", "c_z", "e_z")
) |>
rename(
hit = .data$c_p_s,
fa = .data$e_p_n,
miss = .data$e_p_s,
cr = .data$c_p_n
) |>
mutate(
dprime = .data$zc_s - .data$ze_n,
c = -(.data$zc_s + .data$ze_n) / 2,
dprime = .data$c_z_s - .data$e_z_n,
c = -(.data$c_z_s + .data$e_z_n) / 2,
commissions = .data$e_n,
omissions = .data$e_s
)
Expand Down
2 changes: 1 addition & 1 deletion man/calc_sdt.Rd

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

7 changes: 2 additions & 5 deletions tests/testthat/test-nsymncmp.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@ test_that("Works with grouping variable", {
})

test_that("Warning if not converged", {
mockery::stub(
nsymncmp,
"fit_numerosity",
function(...) list(par = c(w = 1), convergence = -1),
depth = 2
local_mocked_bindings(
fit_numerosity = function(...) list(par = c(w = 1), convergence = -1)
)
nsymncmp(data) |>
expect_warning(class = "fit_not_converge")
Expand Down

0 comments on commit 8f87914

Please sign in to comment.