This R Markdown document is used to compute the factors \(k_1\) and \(k_2\).
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.7 ✔ dplyr 1.0.9
## ✔ tidyr 1.2.0 ✔ stringr 1.4.0
## ✔ readr 2.1.2 ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(furrr)
## Loading required package: future
##
## Attaching package: 'future'
## The following object is masked from 'package:rmarkdown':
##
## run
library(cmstatr)
library(EquivSample)
plan(multisession, workers = 12)
factors <- expand_grid(
alpha = c(0.05, 0.01, 0.005),
n = c(12, 18, 24, 30, 36, 50, 100, 1000, Inf),
m = c(3, 4, 5, 6, 7, 8, 9, 10)
) %>%
future_pmap(
function(alpha, n, m) {
if (is.infinite(n)) {
res <- k_equiv(alpha, m)
} else {
res <- k_equiv_two_sample(n, m, alpha)
}
tibble(alpha = alpha, n = n, m = m,
k1 = res[1],
k2 = res[2]
)
}
) %>%
bind_rows()
factors
## # A tibble: 216 × 5
## alpha n m k1 k2
## <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0.05 12 3 2.76 1.33
## 2 0.05 12 4 2.94 1.20
## 3 0.05 12 5 3.07 1.11
## 4 0.05 12 6 3.18 1.05
## 5 0.05 12 7 3.27 0.998
## 6 0.05 12 8 3.34 0.959
## 7 0.05 12 9 3.41 0.927
## 8 0.05 12 10 3.46 0.901
## 9 0.05 18 3 2.60 1.24
## 10 0.05 18 4 2.75 1.11
## # … with 206 more rows
write_csv(factors, file = "factors.csv")
sessionInfo()
## R version 4.2.0 (2022-04-22)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.4 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
##
## locale:
## [1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_CA.UTF-8 LC_COLLATE=en_CA.UTF-8
## [5] LC_MONETARY=en_CA.UTF-8 LC_MESSAGES=en_CA.UTF-8
## [7] LC_PAPER=en_CA.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] EquivSample_1.0.0 cmstatr_0.9.1 furrr_0.3.0 future_1.25.0
## [5] forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9 purrr_0.3.4
## [9] readr_2.1.2 tidyr_1.2.0 tibble_3.1.7 ggplot2_3.3.6
## [13] tidyverse_1.3.1 rmarkdown_2.14
##
## loaded via a namespace (and not attached):
## [1] Rcpp_1.0.8.3 lubridate_1.8.0 listenv_0.8.0 assertthat_0.2.1
## [5] digest_0.6.29 utf8_1.2.2 parallelly_1.31.1 R6_2.5.1
## [9] cellranger_1.1.0 backports_1.4.1 reprex_2.0.1 evaluate_0.15
## [13] httr_1.4.3 pillar_1.7.0 kSamples_1.2-9 rlang_1.0.2
## [17] readxl_1.4.0 rstudioapi_0.13 jquerylib_0.1.4 bit_4.0.4
## [21] munsell_0.5.0 broom_0.8.0 compiler_4.2.0 modelr_0.1.8
## [25] xfun_0.30 pkgconfig_2.0.3 globals_0.14.0 htmltools_0.5.2
## [29] tidyselect_1.1.2 codetools_0.2-18 fansi_1.0.3 crayon_1.5.1
## [33] tzdb_0.3.0 dbplyr_2.1.1 withr_2.5.0 SuppDists_1.1-9.7
## [37] MASS_7.3-57 grid_4.2.0 jsonlite_1.8.0 gtable_0.3.0
## [41] lifecycle_1.0.1 DBI_1.1.2 magrittr_2.0.3 scales_1.2.0
## [45] vroom_1.5.7 cli_3.3.0 stringi_1.7.6 fs_1.5.2
## [49] xml2_1.3.3 bslib_0.3.1 ellipsis_0.3.2 generics_0.1.2
## [53] vctrs_0.4.1 tools_4.2.0 bit64_4.0.5 glue_1.6.2
## [57] hms_1.1.1 parallel_4.2.0 fastmap_1.1.0 yaml_2.3.5
## [61] colorspace_2.0-3 rvest_1.0.2 knitr_1.39 haven_2.5.0
## [65] sass_0.4.1