Skip to contents

Test binomial on MiteMap for presence in the half part of the odor

Usage

binom_test_mitemap(
  MiteMap,
  factor = NULL,
  format = "HH",
  verbose = TRUE,
  p.adjust_method = "BH",
  level = "run",
  alternative = "two.sided"
)

Arguments

MiteMap

(required) The result of import_mitemap

factor

(required, default NULL) The column name to separate individuals in the MiteMap data frame (e.g., "Treatment").

format

(default "HH") The format of left area. "HH" for Half-Half, "CH" for Circular-Half.

verbose

(Logical, default = TRUE) If TRUE, the function print additional information.

p.adjust_method

(default "BH") method for p-adjustement. See stats::p.adjust().

level

(default "run") The level of analysis. "run" to consider each run (File_name) as one replicate. "lines" to consider each line (i.e. each temporal point) of MiteMap as one replicate. The level run is more conservative as it considers that each run is one independent replicate. Use level "lines" carefully as it introduce a high pseudoreplication risk.

alternative

(default "two.sided") The alternative hypothesis to test. See stats::binom.test().

Value

A tibble of results for binomial test

Details

The test is run for each factor values with a p-adjustement step. For each run (filename), the proportion of points in the left half is calculated. If the proportion is superior to 0.5, the run is considered as "in left", else "in right". Then a binomial test is run to test if the proportion of runs "in left" is significantly different from 0.5 for each levels of the factor. If format is "CH", the same process is done but for presence in the circular half rather than a half part.

If level is "lines", each line of MiteMap is considered as one replicate (i.e. the proportion of points in left half is calculated for each line of MiteMap). This approach is not recommended as it introduce a high pseudoreplication risk.

Author

Adrien Taudière

Examples



binom_test_mitemap(MM_data, factor = "Treatment")
#> Warning: There were 48 warnings in `summarise()`.
#> The first warning was:
#>  In argument: `across(...)`.
#>  In group 75: `File_name = "MM012022_05_17_15h29m25s"`.
#> Caused by warning in `min()`:
#> ! no non-missing arguments to min; returning Inf
#>  Run `dplyr::last_dplyr_warnings()` to see the 47 remaining warnings.
#> # A tibble: 3 × 8
#>   Treatment     n   yes    no p.value p.value.adj estimate CI           
#>   <chr>     <int> <int> <int>   <dbl>       <dbl>    <dbl> <chr>        
#> 1 DCM          10     5     5   1           1        0.5   0.187 - 0.813
#> 2 Mix          96    54    42   0.261       0.392    0.562 0.457 - 0.664
#> 3 nothing     120    75    45   0.008       0.024    0.625 0.532 - 0.712
binom_test_mitemap(MM_data, factor = "Treatment", format = "CH")
#> Warning: There were 48 warnings in `summarise()`.
#> The first warning was:
#>  In argument: `across(...)`.
#>  In group 75: `File_name = "MM012022_05_17_15h29m25s"`.
#> Caused by warning in `min()`:
#> ! no non-missing arguments to min; returning Inf
#>  Run `dplyr::last_dplyr_warnings()` to see the 47 remaining warnings.
#> # A tibble: 3 × 8
#>   Treatment     n   yes    no p.value p.value.adj estimate CI           
#>   <chr>     <int> <int> <int>   <dbl>       <dbl>    <dbl> <chr>        
#> 1 DCM          10     5     5 1          1            0.5  0.187 - 0.813
#> 2 Mix          96    71    25 0.00001    0.000015     0.74 0.64 - 0.824 
#> 3 nothing     120    90    30 0.00001    0.000015     0.75 0.663 - 0.825
binom_test_mitemap(MM_data, factor = "Treatment", level = "lines")
#> Warning: There were 48 warnings in `summarise()`.
#> The first warning was:
#>  In argument: `across(...)`.
#>  In group 75: `File_name = "MM012022_05_17_15h29m25s"`.
#> Caused by warning in `min()`:
#> ! no non-missing arguments to min; returning Inf
#>  Run `dplyr::last_dplyr_warnings()` to see the 47 remaining warnings.
#> # A tibble: 3 × 8
#>   Treatment     n   yes    no p.value p.value.adj estimate CI           
#>   <chr>     <int> <int> <int>   <dbl>       <dbl>    <dbl> <chr>        
#> 1 DCM          10  6416  7611 0.00001     0.00001    0.457 0.449 - 0.466
#> 2 Mix          96 62156 72749 0.00001     0.00001    0.461 0.458 - 0.463
#> 3 nothing     120 78416 91702 0.00001     0.00001    0.461 0.459 - 0.463

MM_data |>
  filter(Biomol_sp %in% c("DGSS", "DGL1", "D_carpathicus")) |>
  binom_test_mitemap(factor = "Biomol_sp")
#> Warning: There were 6 warnings in `summarise()`.
#> The first warning was:
#>  In argument: `across(...)`.
#>  In group 53: `File_name = "MM012022_05_18_00h25m45s"`.
#> Caused by warning in `min()`:
#> ! no non-missing arguments to min; returning Inf
#>  Run `dplyr::last_dplyr_warnings()` to see the 5 remaining warnings.
#> # A tibble: 3 × 8
#>   Biomol_sp         n   yes    no p.value p.value.adj estimate CI           
#>   <chr>         <int> <int> <int>   <dbl>       <dbl>    <dbl> <chr>        
#> 1 DGL1             18    13     5   0.096       0.288    0.722 0.465 - 0.903
#> 2 DGSS             59    34    25   0.298       0.388    0.576 0.441 - 0.704
#> 3 D_carpathicus    12     8     4   0.388       0.388    0.667 0.349 - 0.901