Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARD for McNemar's Test #40

Closed
Tracked by #5
ddsjoberg opened this issue Feb 6, 2024 · 1 comment · Fixed by #51
Closed
Tracked by #5

ARD for McNemar's Test #40

ddsjoberg opened this issue Feb 6, 2024 · 1 comment · Fixed by #51
Assignees

Comments

@ddsjoberg
Copy link
Collaborator

No description provided.

@Melkiades
Copy link
Contributor

I am using #42 (and not paired) as a reference if no one is already working on this

ddsjoberg added a commit that referenced this issue Feb 21, 2024
**What changes are proposed in this pull request?**
* Added `ard_mcnemartest()` statistical test function.

Closes #40

* I am wondering if we need to have `ccorrect = TRUE` as default,
following the default in stats, and if we should make this option more
apparent in the case we change this default.

* Also, I do not know if it would be relevant but I used an utility
function to find dichotomies in a data-set that could result useful as a
tool if there is not one already doing this:
``` r
# Assuming your data.frame is named df
df <- data.frame(
  A = c(1, 0, 1, 0), # dichotomous
  B = c(1, 2, 3, 4), # not dichotomous
  C = c("Yes", "No", "Yes", "No"), # dichotomous
  D = c(TRUE, FALSE, TRUE, FALSE) # dichotomous
)

# Function to find dichotomous columns
find_dichotomous_columns <- function(df) {
  dichotomous_columns <- c()
  for (col_name in names(df)) {
    if (length(unique(df[[col_name]])) == 2) {
      dichotomous_columns <- c(dichotomous_columns, col_name)
    }
  }
  return(dichotomous_columns)
}

# Find and display dichotomous columns
dichotomous_columns <- find_dichotomous_columns(df)
print(dichotomous_columns)
#> [1] "A" "C" "D"
di_cols <- find_dichotomous_columns(cards::ADSL)
print(di_cols)
#>  [1] "SEX"      "ETHNIC"   "EFFFL"    "COMP8FL"  "COMP16FL" "COMP24FL"
#>  [7] "DISCONFL" "DSRAEFL"  "DTHFL"    "DURDSGR1"
```

<sup>Created on 2024-02-14 with [reprex
v2.1.0](https://reprex.tidyverse.org)</sup>

* `.paired_data_pivot_wider` is in the Wilcoxon test. Should we have it
as a tool in a dedicated file? It looks general to me.

--------------------------------------------------------------------------------

Pre-review Checklist (if item does not apply, mark is as complete)
- [x] **All** GitHub Action workflows pass with a ✅
- [x] PR branch has pulled the most recent updates from master branch:
`usethis::pr_merge_main()`
- [x] If a bug was fixed, a unit test was added.
- [x] Code coverage is suitable for any new functions/features
(generally, 100% coverage for new code): `devtools::test_coverage()`
- [x] Request a reviewer

Reviewer Checklist (if item does not apply, mark is as complete)

- [ ] If a bug was fixed, a unit test was added.
- [ ] Run `pkgdown::build_site()`. Check the R console for errors, and
review the rendered website.
- [ ] Code coverage is suitable for any new functions/features:
`devtools::test_coverage()`

When the branch is ready to be merged:
- [ ] Update `NEWS.md` with the changes from this pull request under the
heading "`# cards (development version)`". If there is an issue
associated with the pull request, reference it in parentheses at the end
update (see `NEWS.md` for examples).
- [ ] **All** GitHub Action workflows pass with a ✅
- [ ] Approve Pull Request
- [ ] Merge the PR. Please use "Squash and merge" or "Rebase and merge".

---------

Signed-off-by: Davide Garolini <[email protected]>
Signed-off-by: Davide Garolini <[email protected]>
Signed-off-by: Daniel Sjoberg <[email protected]>
Co-authored-by: Abinaya Yogasekaram <[email protected]>
Co-authored-by: Daniel Sjoberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants