Skip to content

Repository files navigation

mcnemarControl

R-CMD-check

The goal of this package is to allow for multiple uses of McNemar test in a single test where a control is compared against one or more treatment conditions.

Installation

You can install the development version of mcnemarControl from GitHub with:

install.packages("remotes")
remotes::install_github("PHUoL/pairwisemcnemar")

Example

## basic example code
library(mcnemarControl)

You need to first create the data frame, as shown in the example below. You can also import a data. Data must be fornatted in long format.

dat <- mcnemar_example_long(seed = 2)
trts <- c("TrtA", "TrtB", "TrtC")

You can pro

#
fit <- mcnemar_control(dat2, id = "id", condition = "condition", outcome = "outcome",
                       control = "Control", method="asymptotic",p_adjust="holm", ci=0.95)
#
fit
# mcnemarControl results
#  Control: Control
#  Method: asymptotic
#  p-adjust: holm
#  CI level: 0.950
#  Comparisons: 3
#
# A tibble: 3 × 13
#  control treatment     n discordant method_label      Z p_value p_adjusted cohens_g ci_low ci_high p_adjust_label ci_label
#  <chr>   <chr>     <int>      <int> <chr>         <dbl>   <dbl>      <dbl>    <dbl>  <dbl>   <dbl> <chr>          <chr>   
#1 Control TrtA         40         16 asymptotic    4      0.0001     0.0002   0.5     0.306   0.5   holm           95%     
#2 Control TrtB         40         17 asymptotic    0.242  0.808      1        0.0294 -0.190   0.238 holm           95%     
#3 Control TrtC         40         19 asymptotic   -0.229  0.818      1        0.0263 -0.183   0.227 holm           95% 
# ℹ 2 more variables: p_adjust_label <chr>, ci_label <chr>
#
summary(fit)

About

An R package for multiple pairwise McNemar tests against a control

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages