├── .Rbuildignore ├── .gitignore ├── DESCRIPTION ├── InteractionPoweR.Rproj ├── LICENSE.md ├── NAMESPACE ├── NEWS.Rmd ├── NEWS.md ├── R ├── generate_interaction.R ├── name_key.R ├── plot_interaction.R ├── plot_power_curve.R ├── plot_simple_slope.R ├── plots.3way.R ├── power_estimate.R ├── power_interaction.R ├── power_interaction_3way_r2.R ├── power_interaction_r2.R ├── power_interaction_r2_covs.R ├── run_pos_power_search.R ├── test_interaction.R └── transformation_functions.R ├── README.Rmd ├── README.md ├── _pkgdown.yml ├── cran-comments.Rmd ├── cran-comments.md ├── data └── name_key.rda ├── docs ├── 404.html ├── LICENSE.html ├── apple-touch-icon-120x120.png ├── apple-touch-icon-152x152.png ├── apple-touch-icon-180x180.png ├── apple-touch-icon-60x60.png ├── apple-touch-icon-76x76.png ├── apple-touch-icon.png ├── articles │ ├── CommonQuestions.html │ ├── InteractionPoweR3wayvignette.html │ ├── InteractionPoweR3wayvignette_files │ │ └── figure-html │ │ │ ├── unnamed-chunk-4-1.png │ │ │ ├── unnamed-chunk-6-1.png │ │ │ └── unnamed-chunk-8-1.png │ ├── InteractionPoweR_Stability.html │ ├── InteractionPoweRvignette.html │ ├── InteractionPoweRvignette_files │ │ └── figure-html │ │ │ ├── fig1-1.png │ │ │ ├── fig2-1.png │ │ │ ├── fig3-1.png │ │ │ ├── fig4-1.png │ │ │ ├── fig4b-1.png │ │ │ ├── fig5-1.png │ │ │ ├── fig6-1.png │ │ │ ├── fig7-1.png │ │ │ ├── fig8-1.png │ │ │ └── fig9-1.png │ ├── InteractionPower2waycovsvignette.html │ ├── InteractionPower2waycovsvignette_files │ │ └── figure-html │ │ │ └── unnamed-chunk-4-1.png │ ├── articles │ │ ├── CommonQuestions.html │ │ ├── CommonQuestions_files │ │ │ └── header-attrs-2.6 │ │ │ │ └── header-attrs.js │ │ ├── InteractionPoweR3wayvignette.html │ │ ├── InteractionPoweR_Stability.html │ │ ├── InteractionPoweRvignette.html │ │ ├── InteractionPoweRvignette_files │ │ │ ├── figure-html │ │ │ │ ├── fig1-1.png │ │ │ │ ├── fig2-1.png │ │ │ │ ├── fig3-1.png │ │ │ │ ├── fig4-1.png │ │ │ │ ├── fig5-1.png │ │ │ │ ├── fig6-1.png │ │ │ │ ├── fig7-1.png │ │ │ │ └── fig8-1.png │ │ │ └── header-attrs-2.6 │ │ │ │ └── header-attrs.js │ │ └── InteractionPower2waycovsvignette.html │ └── index.html ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── deps │ ├── bootstrap-5.1.0 │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ └── bootstrap.min.css │ ├── bootstrap-5.2.2 │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ └── bootstrap.min.css │ ├── bootstrap-5.3.1 │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ ├── bootstrap.min.css │ │ ├── font.css │ │ └── fonts │ │ │ ├── 1Ptxg8zYS_SKggPN4iEgvnHyvveLxVs9pbCIPrc.woff │ │ │ ├── 1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCIPrc.woff │ │ │ ├── 1adeadb2fe618c5ed46221f15e12b9c8.woff │ │ │ ├── 4iCs6KVjbNBYlgo6ew.woff │ │ │ ├── 4iCs6KVjbNBYlgoKfw7w.woff │ │ │ ├── 4iCv6KVjbNBYlgoCxCvTtA.woff │ │ │ ├── 4iCv6KVjbNBYlgoCxCvjsGyL.woff │ │ │ ├── 6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7nsDQ.woff │ │ │ ├── 6xK1dSBYKcSV-LCoeQqfX1RYOo3qPa7j.woff │ │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3aPA.woff │ │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7j.woff │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rAkw.woff │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vAkw.woff │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlxdo.woff │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zAkw.woff │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdo.woff │ │ │ ├── CSR54z1Qlv-GDxkbKVQ_dFsvWNRevw.woff │ │ │ ├── CSR54z1Qlv-GDxkbKVQ_dFsvaNA.woff │ │ │ ├── CSR64z1Qlv-GDxkbKVQ_TOQ.woff │ │ │ ├── CSR64z1Qlv-GDxkbKVQ_fOAKSw.woff │ │ │ ├── HI_diYsKILxRpg3hIP6sJ7fM7PqPMcMnZFqUwX28DBKXhM0.woff │ │ │ ├── HI_diYsKILxRpg3hIP6sJ7fM7PqPMcMnZFqUwX28DMyQhM0.woff │ │ │ ├── HI_jiYsKILxRpg3hIP6sJ7fM7PqlOPHYvDP_W9O7GQTTbI1rSg.woff │ │ │ ├── HI_jiYsKILxRpg3hIP6sJ7fM7PqlOPHYvDP_W9O7GQTTsoprSg.woff │ │ │ ├── JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtZ6Ew9.woff │ │ │ ├── JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew9.woff │ │ │ ├── JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCuM70w9.woff │ │ │ ├── KFOlCnqEu92Fr1MmEU9fBBc-.woff │ │ │ ├── KFOlCnqEu92Fr1MmEU9vAA.woff │ │ │ ├── KFOlCnqEu92Fr1MmSU5fBBc-.woff │ │ │ ├── KFOlCnqEu92Fr1MmSU5vAA.woff │ │ │ ├── KFOlCnqEu92Fr1MmWUlfBBc-.woff │ │ │ ├── KFOlCnqEu92Fr1MmWUlvAA.woff │ │ │ ├── KFOmCnqEu92Fr1Me5g.woff │ │ │ ├── KFOmCnqEu92Fr1Mu4mxM.woff │ │ │ ├── QGYpz_kZZAGCONcK2A4bGOj8mNhL.woff │ │ │ ├── S6u8w4BMUTPHjxsAXC-s.woff │ │ │ ├── S6u8w4BMUTPHjxswWA.woff │ │ │ ├── S6u9w4BMUTPHh6UVSwiPHw.woff │ │ │ ├── S6u9w4BMUTPHh6UVeww.woff │ │ │ ├── S6u9w4BMUTPHh7USSwiPHw.woff │ │ │ ├── S6u9w4BMUTPHh7USeww.woff │ │ │ ├── S6uyw4BMUTPHjx4wWA.woff │ │ │ ├── S6uyw4BMUTPHvxo.woff │ │ │ ├── UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuFuYMZs.woff │ │ │ ├── UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuI6fMZs.woff │ │ │ ├── UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfMZs.woff │ │ │ ├── XRXI3I6Li01BKofiOc5wtlZ2di8HDFwmRTA.woff │ │ │ ├── XRXI3I6Li01BKofiOc5wtlZ2di8HDGUmRTA.woff │ │ │ ├── XRXI3I6Li01BKofiOc5wtlZ2di8HDLshRTA.woff │ │ │ ├── a98f7a7574819ba83bec6279a2cecd95.woff │ │ │ ├── memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk0ZjaVQ.woff │ │ │ ├── memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk5hkWVAexg.woff │ │ │ ├── memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk5hkaVQ.woff │ │ │ ├── memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk8ZkWVAexg.woff │ │ │ ├── memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk8ZkaVQ.woff │ │ │ ├── memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk_RkaVQ.woff │ │ │ ├── memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0RkxhjaVQ.woff │ │ │ ├── memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0RkyFjWVAexg.woff │ │ │ ├── memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0RkyFjaVQ.woff │ │ │ ├── memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsg-1x4gaVQ.woff │ │ │ ├── memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsg-1y4k.woff │ │ │ ├── memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsgH1y4k.woff │ │ │ ├── memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgshZ1y4k.woff │ │ │ ├── memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsiH0B4gaVQ.woff │ │ │ ├── memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsiH0C4k.woff │ │ │ ├── memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4gaVQ.woff │ │ │ ├── memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0C4k.woff │ │ │ ├── memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjr0C4k.woff │ │ │ └── q5uGsou0JOdh94bfvQlr.woff │ ├── data-deps.txt │ └── jquery-3.6.0 │ │ ├── jquery-3.6.0.js │ │ ├── jquery-3.6.0.min.js │ │ └── jquery-3.6.0.min.map ├── docsearch.css ├── docsearch.js ├── docsearch.json ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon.ico ├── index.html ├── link.svg ├── logo.png ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml ├── reference │ ├── Rplot001.png │ ├── binary.p2skew.html │ ├── compute_adjustment.html │ ├── cor.mat.3way.html │ ├── figures │ │ ├── README-example10-1.png │ │ ├── README-example11-1.png │ │ ├── README-example12-1.png │ │ ├── README-example2-1.png │ │ ├── README-example4-1.png │ │ ├── README-example7-1.png │ │ ├── README-example9-1.png │ │ ├── hex.png │ │ ├── hex.svg │ │ └── logo.png │ ├── generate.interaction.cov.input.html │ ├── generate_interaction.html │ ├── index.html │ ├── name_key.html │ ├── norm2binary.html │ ├── norm2gamma.html │ ├── norm2likert.html │ ├── norm2ordinal.html │ ├── plot_interaction-1.png │ ├── plot_interaction.html │ ├── plot_power_curve-1.png │ ├── plot_power_curve.html │ ├── plot_simple_slope-1.png │ ├── plot_simple_slope.html │ ├── power_estimate.html │ ├── power_interaction.html │ ├── power_interaction_3way_r2.html │ ├── power_interaction_r2.html │ ├── power_interaction_r2_covs.html │ ├── run_pos_power_search.html │ ├── simple.slopes.3way.html │ └── test_interaction.html ├── search.json └── sitemap.xml ├── inst └── CITATION ├── man ├── compute_adjustment.Rd ├── cor.mat.3way.Rd ├── figures │ ├── README-example10-1.png │ ├── README-example11-1.png │ ├── README-example12-1.png │ ├── README-example2-1.png │ ├── README-example4-1.png │ ├── README-example7-1.png │ ├── README-example9-1.png │ ├── hex.png │ ├── hex.svg │ └── logo.png ├── generate.interaction.cov.input.Rd ├── generate_interaction.Rd ├── name_key.Rd ├── norm2ordinal.Rd ├── plot_interaction.Rd ├── plot_power_curve.Rd ├── plot_simple_slope.Rd ├── power_estimate.Rd ├── power_interaction.Rd ├── power_interaction_3way_r2.Rd ├── power_interaction_r2.Rd ├── power_interaction_r2_covs.Rd ├── run_pos_power_search.Rd ├── simple.slopes.3way.Rd └── test_interaction.Rd ├── pkgdown └── favicon │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-152x152.png │ ├── apple-touch-icon-180x180.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ └── favicon.ico ├── revdep ├── .gitignore ├── README.md ├── cran.md ├── email.yml ├── failures.md └── problems.md └── vignettes ├── .gitignore └── articles ├── CommonQuestions.Rmd ├── InteractionPoweR3wayvignette.Rmd ├── InteractionPoweR_Stability.Rmd ├── InteractionPoweRvignette.Rmd └── InteractionPower2waycovsvignette.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^InteractionPoweR\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^README\.Rmd$ 4 | ^LICENSE\.md$ 5 | ^doc$ 6 | ^Meta$ 7 | ^vignettes$ 8 | ^_pkgdown\.yml$ 9 | ^docs$ 10 | ^pkgdown$ 11 | ^~/InteractionPoweR/_pkgdown\.yml$ 12 | ^~/InteractionPoweR/docs$ 13 | cran-comments.md 14 | cran-comments.Rmd 15 | NEWS.Rmd 16 | ^CRAN-SUBMISSION$ 17 | ^revdep$ 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | Meta 3 | ~/InteractionPoweR/docs 4 | CRAN-SUBMISSION 5 | .Rhistory 6 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: InteractionPoweR 2 | Title: Power Analyses for Interaction Effects in Cross-Sectional Regressions 3 | Version: 0.2.3 4 | Authors@R: 5 | c(person(given = "David", 6 | family = "Baranger", 7 | role = c("aut", "cre"), 8 | email = "dbaranger@gmail.com", 9 | comment = c(ORCID = "0000-0002-6659-357X",website="davidbaranger.com")), 10 | person(given = "Andrew", 11 | family = "Castillo", 12 | role = c("aut"), 13 | email = "casti179@purdue.edu"), 14 | person(given = "Brandon", 15 | family = "Goldstein", 16 | role = "ctb", 17 | email = "brandonlgoldstein@gmail.com") , 18 | person(given = "Megan", 19 | family = "Finsaas", 20 | role = "ctb", 21 | email = "megan.finsaas@gmail.com") , 22 | person(given = "Thomas", 23 | family = "Olino", 24 | role = "ctb", 25 | email = "thomas.olino@gmail.com") , 26 | person(given = "Colin", 27 | family = "Vize", 28 | role = "ctb", 29 | email = "vizece@upmc.edu") , 30 | person(given = "Don", 31 | family = "Lynam", 32 | role = "ctb", 33 | email = "dlynam@purdue.edu") 34 | ) 35 | Description: Power analysis for regression models which test the interaction of 36 | two or three independent variables on a single dependent variable. Includes options 37 | for correlated interacting variables and specifying variable reliability. 38 | Two-way interactions can include continuous, binary, or ordinal variables. 39 | Power analyses can be done either analytically or via simulation. Includes 40 | tools for simulating single data sets and visualizing power analysis results. 41 | The primary functions are power_interaction_r2() and power_interaction() for two-way 42 | interactions, and power_interaction_3way_r2() for three-way interactions. The function 43 | run_pos_power_search() provides a stability analysis for two-way interactions. 44 | Please cite as: Baranger DAA, Finsaas MC, Goldstein BL, Vize CE, Lynam DR, 45 | Olino TM (2023). "Tutorial: Power analyses for interaction effects in 46 | cross-sectional regressions." . 47 | Maintainer: David Baranger 48 | URL: https://dbaranger.github.io/InteractionPoweR/, https://doi.org/10.1177/25152459231187531 49 | BugReports: https://github.com/dbaranger/InteractionPoweR/issues 50 | License: GPL (>= 3) 51 | Encoding: UTF-8 52 | LazyData: true 53 | Roxygen: list(markdown = TRUE) 54 | RoxygenNote: 7.3.1 55 | Depends: R (>= 3.5.0) 56 | Imports: 57 | dplyr, 58 | parallel, 59 | doParallel, 60 | foreach, 61 | ggplot2, 62 | polynom, 63 | chngpt, 64 | rlang, 65 | tidyr, 66 | stats, 67 | ggbeeswarm, 68 | Matrix 69 | -------------------------------------------------------------------------------- /InteractionPoweR.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageBuildArgs: --no-build-vignettes 22 | PackageCheckArgs: --no-build-vignettes 23 | PackageRoxygenize: rd,collate,namespace 24 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(compute_adjustment) 4 | export(cor.mat.3way) 5 | export(generate.interaction.cov.input) 6 | export(generate_interaction) 7 | export(norm2ordinal) 8 | export(plot_interaction) 9 | export(plot_power_curve) 10 | export(plot_simple_slope) 11 | export(power_estimate) 12 | export(power_interaction) 13 | export(power_interaction_3way_r2) 14 | export(power_interaction_r2) 15 | export(power_interaction_r2_covs) 16 | export(run_pos_power_search) 17 | export(simple.slopes.3way) 18 | export(test_interaction) 19 | importFrom(dplyr,"%>%") 20 | importFrom(foreach,"%do%") 21 | importFrom(foreach,"%dopar%") 22 | importFrom(rlang,".data") 23 | importFrom(rlang,".env") 24 | importFrom(stats,"lm") 25 | -------------------------------------------------------------------------------- /NEWS.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "NEWS" 3 | author: "David AA Baranger" 4 | date: "05/06/2025" 5 | output: md_document 6 | --- 7 | 8 | # InteractionPoweR 0.2.3 9 | 10 | * Adds two-way interaction stability function - `run_pos_power_search()`. 11 | 12 | # InteractionPoweR 0.2.2 13 | 14 | * Adds power analysis function for 3-way interactions - `power_interaction_3way_r2()`. 15 | * Adds convenience function for visualizing the correlation matrix from a 3-way interaction - `cor.mat.3way()`. 16 | * Adds convenience function for visualizing the simple slopes from a 3-way interaction - `simple.slopes.3way()`. 17 | * Adds power analysis function for 2-way interactions with covariates - `generate.interaction.cov.input()` and `power_interaction_r2_covs()`. 18 | * Minor bug fixes. 19 | * Removes dependency on the {MASS} package. 20 | 21 | # InteractionPoweR 0.2.1 22 | 23 | * Fix bug in `power_interaction_r2()` which effected analyses with a high 'r.x1.x2' correlation. 24 | * Fix warning in `plot_interaction()`. 25 | * Adds additional descriptive error messages. 26 | 27 | # InteractionPoweR 0.2.0 28 | 29 | * Removes options for specifying skew, which contained a bug. 30 | * Also a speed-up for the simulations. 31 | 32 | # InteractionPoweR 0.1.1 33 | 34 | * First CRAN release. 35 | 36 | # InteractionPoweR 0.1.0.6 37 | 38 | * Added `power_interaction_r2()` function for analytic power. 39 | 40 | # InteractionPoweR 0.1.0.5 41 | 42 | * Adds options to simulate ordinal variables (e.g., a likert scale) in `power_interaction()` using the 'k.x1', 'k.x2', and 'k.y' options. 43 | * Also a speed-up and minor bug-fixes. 44 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # InteractionPoweR 0.2.3 2 | 3 | - Adds two-way interaction stability function - 4 | `run_pos_power_search()`. 5 | 6 | # InteractionPoweR 0.2.2 7 | 8 | - Adds power analysis function for 3-way interactions - 9 | `power_interaction_3way_r2()`. 10 | - Adds convenience function for visualizing the correlation matrix 11 | from a 3-way interaction - `cor.mat.3way()`. 12 | - Adds convenience function for visualizing the simple slopes from a 13 | 3-way interaction - `simple.slopes.3way()`. 14 | - Adds power analysis function for 2-way interactions with 15 | covariates - `generate.interaction.cov.input()` and 16 | `power_interaction_r2_covs()`. 17 | - Minor bug fixes. 18 | - Removes dependency on the {MASS} package. 19 | 20 | # InteractionPoweR 0.2.1 21 | 22 | - Fix bug in `power_interaction_r2()` which effected analyses with a 23 | high ‘r.x1.x2’ correlation. 24 | - Fix warning in `plot_interaction()`. 25 | - Adds additional descriptive error messages. 26 | 27 | # InteractionPoweR 0.2.0 28 | 29 | - Removes options for specifying skew, which contained a bug. 30 | - Also a speed-up for the simulations. 31 | 32 | # InteractionPoweR 0.1.1 33 | 34 | - First CRAN release. 35 | 36 | # InteractionPoweR 0.1.0.6 37 | 38 | - Added `power_interaction_r2()` function for analytic power. 39 | 40 | # InteractionPoweR 0.1.0.5 41 | 42 | - Adds options to simulate ordinal variables (e.g., a likert scale) in 43 | `power_interaction()` using the ‘k.x1’, ‘k.x2’, and ‘k.y’ options. 44 | - Also a speed-up and minor bug-fixes. 45 | -------------------------------------------------------------------------------- /R/name_key.R: -------------------------------------------------------------------------------- 1 | #' Name key for plotting 2 | #' 3 | #' Expanded variable names so that plots look nicer. 4 | #' 5 | #' 6 | #' @docType data 7 | #' @name name_key 8 | #' @usage data(name_key) 9 | #' @format A data frame with 25 rows and 2 variables 10 | NULL 11 | -------------------------------------------------------------------------------- /R/plot_power_curve.R: -------------------------------------------------------------------------------- 1 | #' Plot power curve 2 | #' 3 | #' Plot the output of power_interaction(). 4 | #' 5 | #' @param power_data Data frame of results from power_interaction(). Can accept the raw results if up to 3 parameters were varied during simulation. Any more and data should be filtered first. 6 | #' @param x Optional, the x-axis of the plot. Default is the first variable after 'pwr'. 7 | #' @param group Optional, grouping variable for the line color. Default is the second variable after 'pwr', if present. 8 | #' @param facets Optional, grouping variable for plot facets. Default is the third variable after 'pwr' if present. 9 | #' @param power_target The target power. Default is 80%. 10 | #' 11 | #' @return A ggplot2 object 12 | #' @export 13 | #' 14 | #' @examples 15 | #' power_analysis <- power_interaction(n.iter = 10,N = seq(100,300,by=100), 16 | #' r.x1.y = 0,r.x2.y = .1,r.x1x2.y = -.2,r.x1.x2 = .3,detailed_results = TRUE) 17 | #' plot_power_curve(power_analysis) 18 | plot_power_curve<-function(power_data,x=NULL,group=NULL,facets=NULL,power_target=.8){ 19 | 20 | y = "pwr" 21 | 22 | # Default behavior is to use columns in the order they are present in the power analysis output 23 | if(is.null(x) && is.null(group) && is.null(facets)){ 24 | power_data2<-power_data[,c(1: which(colnames(power_data) == "pwr"))] 25 | x = colnames(power_data2)[1] 26 | 27 | if(dim(power_data2)[2]>2){ group = colnames(power_data2)[2] } 28 | if(dim(power_data2)[2]>3){ facets = colnames(power_data2)[3] } 29 | if(dim(power_data2)[2]>4){ 30 | stop("Too many variable combinations in input data. Please select a subset of data to plot") 31 | 32 | } 33 | } 34 | 35 | y_col<-which(colnames(power_data) == y) 36 | x_col<-which(colnames(power_data) == x) 37 | group_col<-which(colnames(power_data) == group) 38 | facets_col<-which(colnames(power_data) == facets) 39 | col_keep<- c(unname(cbind(x_col,y_col,group_col,facets_col))) 40 | power_data<-as.data.frame(power_data[,col_keep]) 41 | 42 | 43 | 44 | if(dim(power_data)[2] == 2){ 45 | 46 | x_name<-InteractionPoweR::name_key[match(colnames(power_data)[1],InteractionPoweR::name_key[,1] ),2] 47 | y_name<-InteractionPoweR::name_key[match(colnames(power_data)[2],InteractionPoweR::name_key[,1] ),2] 48 | # group_name<-InteractionPoweR::name_key[match(colnames(power_data)[3],InteractionPoweR::name_key[,1] ),2] 49 | 50 | if(is.na(x_name)){x_name = colnames(power_data)[1]} 51 | if(is.na(y_name)){x_name = colnames(power_data)[2]} 52 | 53 | power_plot<-ggplot2::ggplot(data = power_data,ggplot2::aes(x = power_data[,1],y = power_data[,2] ))+ 54 | #scale_color_viridis_d(option = c("C"),end = .95)+ 55 | #scale_fill_viridis_d(option = c("C"),end = .95)+ 56 | ggplot2::geom_hline(yintercept = power_target,color="black")+ 57 | ggplot2::geom_hline(yintercept = 0.05,color="darkgrey")+ 58 | ggplot2::geom_hline(yintercept = 1,color="darkgrey")+ 59 | ggplot2::geom_line(linetype="solid",size=.5,color = "darkblue")+ 60 | ggplot2::geom_smooth(formula = y ~ x,method = 'loess',se=TRUE,alpha=0,size=1, 61 | color = "darkblue")+ 62 | ggplot2::xlab(label = x_name)+ 63 | ggplot2::ylab(label = y_name)+ 64 | ggplot2::geom_point(shape=21,color="black",show.legend = F,size=2,fill="white")+ 65 | ggplot2::theme_minimal()+ 66 | ggplot2::theme(legend.key=ggplot2::element_rect(size=1,color="black"))+ 67 | ggplot2::guides(fill = ggplot2::guide_legend(override.aes = list(alpha = 1))) 68 | 69 | return(power_plot) 70 | 71 | } 72 | 73 | 74 | if(dim(power_data)[2] == 3){ 75 | 76 | x_name<-InteractionPoweR::name_key[match(colnames(power_data)[1],InteractionPoweR::name_key[,1] ),2] 77 | y_name<-InteractionPoweR::name_key[match(colnames(power_data)[2],InteractionPoweR::name_key[,1] ),2] 78 | group_name<-InteractionPoweR::name_key[match(colnames(power_data)[3],InteractionPoweR::name_key[,1] ),2] 79 | 80 | 81 | if(is.na(x_name)){x_name = colnames(power_data)[1]} 82 | if(is.na(y_name)){x_name = colnames(power_data)[2]} 83 | if(is.na(group_name)){x_name = colnames(power_data)[3]} 84 | 85 | power_plot<-ggplot2::ggplot(data = power_data,ggplot2::aes(x = power_data[,1], 86 | y = power_data[,2], 87 | color=as.factor(power_data[,3]), 88 | fill=as.factor(power_data[,3]) ))+ 89 | ggplot2::scale_color_viridis_d(option = c("C"),end = .95)+ 90 | ggplot2::scale_fill_viridis_d(option = c("C"),end = .95)+ 91 | ggplot2::geom_hline(yintercept = power_target,color="black")+ 92 | ggplot2::geom_hline(yintercept = 0.05,color="darkgrey")+ 93 | ggplot2::geom_hline(yintercept = 1,color="darkgrey")+ 94 | ggplot2::geom_line(linetype="solid",size=.5,show.legend = F)+ 95 | ggplot2::geom_smooth(formula = y ~ x,method = 'loess',se=TRUE,alpha=0,size=1)+ 96 | ggplot2::xlab(label = x_name)+ 97 | ggplot2::ylab(label = y_name)+ 98 | ggplot2::geom_point(shape=21,color="black",show.legend = F)+ 99 | ggplot2::theme_minimal()+ 100 | ggplot2::theme(legend.key=ggplot2::element_rect(size=1,color="black"))+ 101 | ggplot2::guides(fill = ggplot2::guide_legend(override.aes = list(alpha = 1)))+ 102 | ggplot2::labs(color = group_name,fill=group_name ) 103 | 104 | return(power_plot) 105 | 106 | } 107 | 108 | 109 | if(dim(power_data)[2] == 4){ 110 | 111 | x_name<-InteractionPoweR::name_key[match(colnames(power_data)[1],InteractionPoweR::name_key[,1] ),2] 112 | y_name<-InteractionPoweR::name_key[match(colnames(power_data)[2],InteractionPoweR::name_key[,1] ),2] 113 | group_name<-InteractionPoweR::name_key[match(colnames(power_data)[3],InteractionPoweR::name_key[,1] ),2] 114 | facets_name<-InteractionPoweR::name_key[match(colnames(power_data)[4],InteractionPoweR::name_key[,1] ),2] 115 | 116 | 117 | 118 | if(is.na(x_name)){x_name = colnames(power_data)[1]} 119 | if(is.na(y_name)){x_name = colnames(power_data)[2]} 120 | if(is.na(group_name)){x_name = colnames(power_data)[3]} 121 | if(is.na(facets_name)){x_name = colnames(power_data)[4]} 122 | 123 | power_data[,4]<-paste(facets_name,"=", power_data[,4]) 124 | 125 | power_plot<-ggplot2::ggplot(data = power_data,ggplot2::aes(x = power_data[,1],y = power_data[,2], 126 | color=as.factor(power_data[,3]), 127 | fill=as.factor(power_data[,3]) ))+ 128 | ggplot2::scale_color_viridis_d(option = c("C"),end = .95)+ 129 | ggplot2::scale_fill_viridis_d(option = c("C"),end = .95)+ 130 | ggplot2::geom_hline(yintercept = power_target,color="black")+ 131 | ggplot2::geom_hline(yintercept = 0.05,color="darkgrey")+ 132 | ggplot2::geom_hline(yintercept = 1,color="darkgrey")+ 133 | ggplot2::geom_line(linetype="solid",size=.5,show.legend = F)+ 134 | ggplot2::geom_smooth(formula = y ~ x,method = 'loess',se=TRUE,alpha=0,size=1)+ 135 | ggplot2::xlab(label = x_name)+ 136 | ggplot2::ylab(label = y_name)+ 137 | ggplot2::geom_point(shape=21,color="black",show.legend = F)+ 138 | ggplot2::theme_minimal()+ 139 | ggplot2::theme(legend.key=ggplot2::element_rect(size=1,color="black"))+ 140 | ggplot2::guides(fill = ggplot2::guide_legend(override.aes = list(alpha = 1)))+ 141 | ggplot2::labs(color = group_name,fill=group_name )+ 142 | ggplot2::facet_wrap(facets = colnames(power_data)[4], scales = "free_y", strip.position = "top") + 143 | ggplot2::theme(strip.background = ggplot2::element_blank(), strip.placement = "outside") 144 | 145 | return(power_plot) 146 | 147 | } 148 | 149 | } 150 | -------------------------------------------------------------------------------- /R/plot_simple_slope.R: -------------------------------------------------------------------------------- 1 | 2 | #' Simple slope plot 3 | #' 4 | #' Plots the simple slope min and max estimates from power_interaction(). 5 | #' 6 | #' @param power_data Data frame of results from power_interaction(). Can accept the raw results if up to 2 parameters were varied during simulation. Any more and data should be filtered first. 7 | #' @param x Optional, the x-axis of the plot. Default is the first variable after 'pwr'. 8 | #' @param facets Optional, grouping variable for plot facets. Default is the second variable after 'pwr' if present. 9 | #' @importFrom dplyr "%>%" 10 | 11 | #' @return A ggplot2 object 12 | #' @export 13 | #' 14 | #' @examples 15 | #' power_analysis <- power_interaction(n.iter = 10,N = seq(100,300,by=100), 16 | #' r.x1.y = 0,r.x2.y = .1,r.x1x2.y = -.2,r.x1.x2 = .3,detailed_results = TRUE) 17 | #' plot_simple_slope(power_analysis) 18 | plot_simple_slope<-function(power_data,x=NULL,facets=NULL){ 19 | 20 | 21 | y = "pwr" 22 | 23 | # Default behavior is to use columns in the order they are present in the power analysis output 24 | if(is.null(x) && is.null(facets)){ 25 | power_data2<-power_data[,c(1: which(colnames(power_data) == "pwr"))] 26 | x = colnames(power_data2)[1] 27 | 28 | if(dim(power_data2)[2]>2){ facets = colnames(power_data2)[2] } 29 | #if(dim(power_data2)[2]>3){ facets = colnames(power_data2)[3] } 30 | if(dim(power_data2)[2]>3){ 31 | stop("Too many variable combinations in input data. Please select a subset of data to plot") 32 | 33 | } 34 | } 35 | 36 | x_col<-which(colnames(power_data) == x) 37 | #group_col<-which(colnames(power_data) == group) 38 | facets_col<-which(colnames(power_data) == facets) 39 | 40 | col_keep<- c(unname(cbind(x_col,facets_col))) 41 | power_data2<-as.data.frame(power_data[,col_keep]) 42 | 43 | #bounds<-power_data[,c((dim(power_data)[2]-3): (dim(power_data)[2]) )] 44 | 45 | col_names = c("min.lwr", "min.upr","max.lwr","max.upr" ) 46 | 47 | bounds <- power_data[ , base::match(col_names,colnames(power_data))] 48 | power_data2<-cbind(power_data2,bounds) 49 | 50 | if(dim(power_data2)[2] == 5){ 51 | 52 | x_name<-InteractionPoweR::name_key[match(colnames(power_data)[1],InteractionPoweR::name_key[,1] ),2] 53 | 54 | 55 | power_data2<-power_data2 %>% tidyr::pivot_longer( 56 | cols = c("min.lwr","min.upr","max.lwr","max.upr"), 57 | names_to = "bound", 58 | #names_sep = "[.]", 59 | values_to = "slopes") 60 | power_data2$bound2<- matrix(unlist(strsplit(power_data2$bound,split = "[.]")),nrow = 2)[1,] 61 | #power_data2$bound2<-stringr::str_split(power_data2$bound,pattern = "[.]",simplify = T)[,1] # need to redo this 62 | power_data2$bound3<-paste(as.matrix(power_data2[,1]),power_data2$bound2,sep="_") 63 | 64 | slope_plot<-ggplot2::ggplot(data = power_data2,ggplot2::aes(x =as.matrix(power_data2[,1]), 65 | y = .data$slopes, 66 | fill= .data$bound2, 67 | group=.data$bound3))+ 68 | ggplot2::scale_fill_viridis_d()+ 69 | ggplot2::geom_hline(yintercept = 0,color="darkgrey")+ 70 | ggplot2::geom_line(linetype="solid",size=.5,color = "black")+ 71 | ggplot2::geom_point(shape=21,color="black",show.legend = F,size=2)+ 72 | 73 | ggplot2::ylab(label = "Simple slope extrema IQR")+ 74 | ggplot2::xlab(label = x_name)+ 75 | #scale_color_viridis_d(option = c("C"),end = .5)+ 76 | ggplot2::theme_minimal() 77 | 78 | 79 | 80 | 81 | return(slope_plot) 82 | 83 | } 84 | 85 | 86 | if(dim(power_data2)[2] == 6){ 87 | 88 | x_name<-InteractionPoweR::name_key[match(colnames(power_data)[1],InteractionPoweR::name_key[,1] ),2] 89 | #y_name<-InteractionPoweR::name_key[match(colnames(power_data)[2],InteractionPoweR::name_key[,1] ),2] 90 | facet_name<-InteractionPoweR::name_key[match(colnames(power_data)[2],InteractionPoweR::name_key[,1] ),2] 91 | 92 | 93 | power_data2<-power_data2 %>% tidyr::pivot_longer( 94 | cols = c("min.lwr","min.upr","max.lwr","max.upr"), 95 | names_to = "bound", 96 | #names_sep = "[.]", 97 | values_to = "slopes") 98 | 99 | power_data2$bound2<- matrix(unlist(strsplit(power_data2$bound,split = "[.]")),nrow = 2)[1,] 100 | power_data2$bound3<-paste(as.matrix(power_data2[,1]),power_data2$bound2,sep="_") 101 | 102 | 103 | slope_plot<- 104 | 105 | ggplot2::ggplot(data = power_data2,ggplot2::aes(x =as.matrix(power_data2[,1]), 106 | 107 | color=as.factor(as.matrix(power_data2[,2])), 108 | fill=as.factor(as.matrix(power_data2[,2])), 109 | 110 | y = .data$slopes, 111 | group=.data$bound3))+ 112 | ggplot2::geom_hline(yintercept = 0,color="black")+ 113 | ggplot2::scale_color_viridis_d(option = c("C"),end = .95)+ 114 | ggplot2::scale_fill_viridis_d(option = c("C"),end = .95)+ 115 | ggplot2::geom_line(linetype="solid",size=.5)+ 116 | ggplot2::geom_point(shape=21,color="black",show.legend = T,size=2)+ 117 | 118 | ggplot2::ylab(label = "Simple slope extrema IQR")+ 119 | ggplot2::xlab(label = x_name)+ 120 | #scale_color_viridis_d(option = c("C"),end = .5)+ 121 | ggplot2::theme_minimal()+ 122 | ggplot2::facet_wrap(facets = colnames(power_data)[2], scales = "free_y", 123 | strip.position = "top",labeller = ggplot2::label_both ) + 124 | ggplot2::theme(strip.background = ggplot2::element_blank(), strip.placement = "outside")+ 125 | ggplot2::labs(color = facet_name,fill=facet_name ) 126 | 127 | return(slope_plot) 128 | 129 | 130 | 131 | } 132 | 133 | 134 | 135 | } 136 | -------------------------------------------------------------------------------- /R/plots.3way.R: -------------------------------------------------------------------------------- 1 | #' See the correlation matrix for a 3-way interaction 2 | #' 3 | #' Prints or plots the correlation matrix for a 3-way interaction 4 | #' 5 | #' @param power.results Data frame of results from power_interaction_3way_r2(). 6 | #' @param row.num Which row to show? Can only be a single number. Default is 1. 7 | #' @param return.plot Return a matrix (FALSE, default), or a plot (TRUE)? 8 | #' @importFrom dplyr "%>%" 9 | 10 | #' @return A matrix or a ggplot2 object 11 | #' @export 12 | #' 13 | #' @examples 14 | #' power_analysis = power_interaction_3way_r2(detailed_results = TRUE,N = c(1000), 15 | #'r.x1.y = .2,r.x2.y = .3,r.x3.y = .1,r.x1x2.y = .01,r.x1x3.y = .05,r.x2x3.y = .1, 16 | #'b.x1x2x3 = 0.1,r.x1.x2 = .1,r.x1.x3 = .1,r.x2.x3 = .1, 17 | #'rel.x1 = 1,rel.x2 = 1,rel.x3 = 1,rel.y = 1 ) 18 | #'cor.mat.3way(power_analysis) 19 | 20 | cor.mat.3way = function(power.results,row.num = 1,return.plot = FALSE){ 21 | if(length(row.num)!=1){stop("row.num must be a single value")} 22 | cors = power.results[row.num,dplyr::starts_with(vars = colnames(power.results),match = "obs.r.")] 23 | 24 | 25 | cor.mat = base::matrix(data = 0,nrow = 8,ncol = 8) %>% base::as.data.frame() 26 | base::diag(cor.mat) = 1 27 | var.names = c("y","x1","x2","x3","x1x2","x1x3","x2x3","x1x2x3") 28 | base::colnames(cor.mat) = var.names 29 | base::rownames(cor.mat) = var.names 30 | ind <- base::which( base::lower.tri(cor.mat,diag=F) , arr.ind = TRUE ) 31 | 32 | cor.mat[ind]=cors %>% c() %>% unlist() 33 | ind2=ind 34 | ind2[,1]=ind[,2] 35 | ind2[,2]=ind[,1] 36 | cor.mat[ind2]=cors%>% c() %>% unlist() 37 | 38 | if(return.plot == FALSE){out = cor.mat 39 | }else{ 40 | 41 | ind = expand.grid(row=c(1:8),col=c(1:8)) %>% as.matrix() 42 | 43 | cor.mat2 = base::data.frame( col = dimnames(cor.mat)[[2]][ind[,2]] , 44 | row = dimnames(cor.mat)[[1]][ind[,1]] , 45 | val = cor.mat[ ind ] ) %>% as.data.frame() 46 | 47 | cor.mat2$col = factor(cor.mat2$col,levels = rev(var.names)) 48 | cor.mat2$row = factor(cor.mat2$row,levels = (var.names)) 49 | 50 | segment1 = data.frame(x = seq(0.5,8.5,1),xend = seq(0.5,8.5,1), y = .5, yend = 8.5) 51 | segment2 = data.frame(y = seq(0.5,8.5,1),yend = seq(0.5,8.5,1), x = .5, xend = 8.5) 52 | 53 | segment3=rbind(segment1,segment2) 54 | 55 | out = ggplot2::ggplot(cor.mat2,ggplot2::aes(x = .data$row, y = .data$col, fill = .data$val,label = round(.data$val,3)))+ 56 | ggplot2::geom_raster()+ 57 | ggplot2::geom_segment(data = segment3,inherit.aes = F,ggplot2::aes(x = .data$x,xend = .data$xend, y = .data$y, yend = .data$yend),color="black")+ 58 | ggplot2::scale_fill_gradient2(limits = c(-1,1), 59 | high = "#C42503FF", 60 | low = "#455BCDFF", 61 | mid = "white", 62 | midpoint = 0)+ 63 | ggplot2::geom_text()+ 64 | ggplot2::theme_classic()+ 65 | ggplot2::coord_equal()+ 66 | ggplot2::scale_x_discrete(position = "top") + 67 | ggplot2::labs(fill = "Correlation (r)")+ 68 | ggplot2::theme(legend.position = "top", 69 | axis.title = ggplot2::element_blank(), 70 | axis.line = ggplot2::element_blank(), 71 | axis.ticks = ggplot2::element_blank(), 72 | axis.text = ggplot2::element_text(color = "black"))+ 73 | 74 | ggplot2::guides(fill = ggplot2::guide_colorbar(title.position = "top",ticks.colour = "black")) 75 | } 76 | return(out) 77 | } 78 | 79 | 80 | #' See the simple slopes for a 3-way interaction 81 | #' 82 | #' Prints or plots the simple slopes for a 3-way interaction 83 | #' 84 | #' @param power.results Data frame of results from power_interaction_3way_r2(). 85 | #' @param row.num Which row to show? Can only be a single number. Default is 1. 86 | #' @param return.plot Return a matrix (FALSE, default), or a plot (TRUE)? 87 | #' @importFrom dplyr "%>%" 88 | 89 | #' @return A matrix or a ggplot2 object 90 | #' @export 91 | #' 92 | #' @examples 93 | #' power_analysis = power_interaction_3way_r2(detailed_results = TRUE,N = c(1000), 94 | #'r.x1.y = .2,r.x2.y = .3,r.x3.y = .1,r.x1x2.y = .01,r.x1x3.y = .05,r.x2x3.y = .1, 95 | #'b.x1x2x3 = 0.1,r.x1.x2 = .1,r.x1.x3 = .1,r.x2.x3 = .1, 96 | #'rel.x1 = 1,rel.x2 = 1,rel.x3 = 1,rel.y = 1 ) 97 | #'simple.slopes.3way(power_analysis) 98 | 99 | simple.slopes.3way = function(power.results,row.num = 1,return.plot = FALSE){ 100 | 101 | 102 | if(length(row.num)!=1){stop("row.num must be a single value")} 103 | betas = power.results[row.num,dplyr::starts_with(vars = colnames(power.results),match = "obs.b.")] 104 | 105 | row.names(betas)=NULL 106 | 107 | slopes = expand.grid(M = c(-1,0,1),Z = c(-1,0,1),intercept1=NA,slope1=NA) 108 | 109 | slopes = cbind(slopes,betas) 110 | 111 | slopes$intercept1 = apply(slopes,1,function(X){ 112 | X=as.data.frame(t(X)) 113 | colnames(X) = colnames(slopes) 114 | (X$obs.b.x2*X$M) + (X$obs.b.x3*X$Z) + (X$obs.b.x2x3*X$M*X$Z) 115 | }) 116 | 117 | slopes$slope1 = apply(slopes,1,function(X){ 118 | X=as.data.frame(t(X)) 119 | colnames(X) = colnames(slopes) 120 | X$obs.b.x1 + (X$obs.b.x1x2*X$M) + (X$obs.b.x1x3 * X$Z) + (X$obs.b.x1x2x3*X$M*X$Z) 121 | }) 122 | 123 | 124 | if(return.plot == FALSE){ 125 | 126 | slopes$X2 = paste(slopes$M,"SD") 127 | slopes$X3 = paste(slopes$Z,"SD") 128 | # slopes$X2 = stringr::str_replace(string = slopes$X2,pattern = "0 SD",replacement = "Mean") 129 | # slopes$X3 = stringr::str_replace(string = slopes$X3,pattern = "0 SD",replacement = "Mean") 130 | slopes$X2 = sub(x = slopes$X2,pattern = "0 SD",replacement = "Mean") 131 | slopes$X3 = sub(x = slopes$X3,pattern = "0 SD",replacement = "Mean") 132 | 133 | out = data.frame(X2 = slopes$X2,X3 = slopes$X3,intercept = slopes$intercept1,slope = slopes$slope1) 134 | 135 | } 136 | 137 | if(return.plot == TRUE){ 138 | 139 | 140 | 141 | slopes$X2 = paste(slopes$M,"SD") 142 | slopes$X3 = paste("X3 =",slopes$Z,"SD") 143 | 144 | #slopes$X2 = stringr::str_replace(string = slopes$X2,pattern = "0 SD",replacement = "Mean") 145 | slopes$X2 = sub(x = slopes$X2,pattern = "0 SD",replacement = "Mean") 146 | #slopes$X3 = stringr::str_replace(string = slopes$X3,pattern = "0 SD",replacement = "Mean") 147 | slopes$X3 = sub(x = slopes$X3,pattern = "0 SD",replacement = "Mean") 148 | 149 | slopes$X2 = factor(slopes$X2,levels = c("-1 SD","Mean", "1 SD")) 150 | slopes$X3 = factor(slopes$X3,levels = c("X3 = -1 SD","X3 = Mean", "X3 = 1 SD")) 151 | 152 | 153 | out = ggplot2::ggplot(data = slopes)+ 154 | 155 | ggplot2::geom_hline(yintercept = 0,color="grey",size=1,linetype="solid")+ 156 | ggplot2::geom_vline(xintercept = 0,color="grey",size=1,linetype="solid")+ 157 | 158 | ggplot2::geom_abline(ggplot2::aes(intercept = .data$intercept1,slope=.data$slope1,color = .data$X2),size=1.5,show.legend = F)+ 159 | ggplot2::geom_ribbon(ggplot2::aes(ymin=0,ymax=0,x=0,fill = .data$X2))+ 160 | 161 | 162 | ggplot2::xlab(label = "X1 (SDs)")+ 163 | ggplot2::ylab(label = "Y (SDs)")+ 164 | ggplot2::scale_y_continuous(limits = c(-3,3),breaks = seq(-3,3,1))+ 165 | ggplot2::scale_x_continuous(breaks = seq(-3,3,1))+ 166 | ggplot2::coord_cartesian(xlim = c(-3,3),clip = 'off')+ 167 | ggplot2::ggtitle(label = "Simple slopes plot")+ 168 | 169 | ggplot2::theme_minimal()+ 170 | ggplot2::theme( 171 | # plot.title = ggplot2::element_text(size = 18), 172 | # axis.title = ggplot2::element_text(size = 12), 173 | # axis.text = ggplot2::element_text(size = 10), 174 | axis.ticks = ggplot2::element_line(size=1,color="black"), 175 | axis.ticks.length=ggplot2::unit(0.2,"cm"), 176 | axis.line.x = ggplot2::element_line(color = "black",size=1), 177 | axis.line.y = ggplot2::element_line(color = "black",size=1), 178 | legend.position='top', 179 | # strip.text = ggplot2::element_text(size = 12), 180 | plot.margin = ggplot2::unit(c(1,4,1,1), "lines"), 181 | legend.key=ggplot2::element_rect(size=1), 182 | legend.key.size = ggplot2::unit(1, "lines"))+ 183 | 184 | ggplot2::scale_color_viridis_d(option = "D",direction = -1)+ 185 | ggplot2::scale_fill_viridis_d(option = "D",direction = -1)+ 186 | 187 | ggplot2::guides(color=ggplot2::guide_legend(title.position = "top" ))+ 188 | 189 | ggplot2::facet_wrap(ncol = 3, ~ X3) 190 | } 191 | 192 | 193 | return(out) 194 | } 195 | -------------------------------------------------------------------------------- /R/power_estimate.R: -------------------------------------------------------------------------------- 1 | 2 | #' Power estimate 3 | #' 4 | #' Uses regression to estimate the value needed to attain the target power, given a set of simulation results. 5 | #' 6 | #' @param power_data Output of power_interaction(). 7 | #' @param x The name of the target variable as a character string. 8 | #' @param power_target The desired power level. Must be between 0 and 1 (e.g., 0.8 for 80% power). 9 | #' 10 | #' @return A data frame containing the value of x that achieves the target power for each combination of settings. Will return NA if target power is outside the simulation data. 11 | #' @export 12 | #' 13 | #' @examples 14 | #' simulation_results = power_interaction_r2(N=seq(100,300,by=10), 15 | #' r.x1.y=0.2, r.x2.y=.2,r.x1x2.y=0.2,r.x1.x2=.2) 16 | #' power_estimate(power_data = simulation_results, x = "N", power_target = .8) 17 | power_estimate<-function(power_data,x,power_target){ 18 | 19 | power_data2a = power_data[, which(colnames(power_data) == "pwr" | colnames(power_data) == x)] 20 | power_data2b = power_data[, -which(colnames(power_data) == "pwr" | colnames(power_data) == x)] %>% as.data.frame() 21 | 22 | colnames(power_data2b) = colnames(power_data)[-which(colnames(power_data) == "pwr" | colnames(power_data) == x)] 23 | 24 | data_dim2b = dim(power_data2b)[2] 25 | data_dim = data_dim2b 26 | if(data_dim2b > 0){ 27 | 28 | if(!identical( which(colnames(power_data) == "alpha") ,integer(0))){ 29 | power_data2b = power_data2b[, c(1 : which(colnames(power_data2b) == "alpha") )] 30 | } 31 | cols.to.use = apply(power_data2b,2,function(X){dim(table(X)) > 1 },simplify = TRUE) 32 | power_data2c = power_data2b[,cols.to.use] %>% as.data.frame() 33 | colnames(power_data2c)= colnames(power_data2b)[cols.to.use] 34 | data_dim<-dim(power_data2c)[2] 35 | other_cols<-colnames(power_data2c) 36 | 37 | } 38 | 39 | 40 | x_col<-which(colnames(power_data2a) == x) 41 | pwr_col<-which(colnames(power_data2a) == "pwr") 42 | #power_data$x<-power_data[,x_col] 43 | 44 | if(data_dim==0){power_data2a$temp = 1}else{power_data2a = cbind(power_data2a,power_data2c) } 45 | 46 | power_levels<- unique(expand.grid( power_data2a[,-c(which(colnames(power_data2a) == "pwr"),x_col)] 47 | )) 48 | 49 | rownames(power_levels)<-NULL 50 | 51 | if(data_dim==0){colnames(power_levels)<-"temp" 52 | } else{ 53 | colnames(power_levels) <- other_cols 54 | } 55 | power_out_final<-as.data.frame(power_levels) 56 | 57 | power_out<-power_out_final 58 | 59 | power_out_final$estimate<-0 60 | 61 | for(p in 1: dim(power_out)[1]){ 62 | #print(p) 63 | #filters=paste( colnames(power_out),"==",power_out[p,]) 64 | filters=paste( "dplyr::near(",colnames(power_levels),",",power_levels[p,],",tol=10^-10)") 65 | power_test<-dplyr::filter(power_data2a, !!!rlang::parse_exprs(paste(filters, collapse = ";"))) 66 | power_test<-as.data.frame(power_test) 67 | 68 | if(dim(power_test)[1] > 0){ 69 | power_test$x<-power_test[,x_col] 70 | power_test$x2<-power_test$x ^2 71 | power_test$x3<-power_test$x ^3 72 | power_test$lnx<-log(power_test$x) 73 | 74 | power_test[power_test=="-Inf"]<-NA 75 | power_test<-stats::na.omit(power_test) 76 | 77 | fit1=chngpt::chngptm (formula.1=pwr~1, formula.2=~x+x2, data = power_test, type="M20", ncpus = 1, 78 | family="gaussian",ci.bootstrap.size = 0) 79 | # can we compare model fits? 80 | fit1c=chngpt::chngptm (formula.1=pwr~1, formula.2=~x+x2+x3, data = power_test, type="M20", ncpus = 1, 81 | family="gaussian",ci.bootstrap.size = 0) 82 | 83 | fit1b=chngpt::chngptm (formula.1=pwr~1, formula.2=~lnx, data = power_test, type="M10", ncpus = 1, 84 | family="gaussian",ci.bootstrap.size = 0) 85 | 86 | changepoint<-max(c(fit1$chngpt,fit1c$chngpt,exp(fit1b$chngpt))) 87 | 88 | 89 | power_test2<-dplyr::filter(power_test, x<= changepoint) 90 | 91 | fit2<-stats::lm(pwr~x + x2,data = power_test2) 92 | fit3<-stats::lm(pwr~x + x2 + x3,data = power_test2) 93 | fit4<-stats::lm(pwr~lnx,data = power_test2) 94 | 95 | compare<-stats::anova(fit4,fit2,fit3) 96 | #compare<-stats::anova(fit4,fit2,fit3) 97 | 98 | if(!is.na(compare$`Pr(>F)`[2]) && compare$`Pr(>F)`[2]<0.05){ 99 | j<-polynom::polynomial(stats::coefficients(fit2)) 100 | pwr_line<-(solve(j,b = power_target)) 101 | 102 | if(compare$`Pr(>F)`[3]<0.05){ 103 | j<-polynom::polynomial(stats::coefficients(fit3)) 104 | pwr_line<-(solve(j,b = power_target)) 105 | 106 | if(is.complex(pwr_line)){ 107 | j<-polynom::polynomial(stats::coefficients(fit2)) 108 | pwr_line<-(solve(j,b = power_target)) 109 | } 110 | 111 | } 112 | 113 | 114 | 115 | if(is.complex(pwr_line)){ 116 | j<-polynom::polynomial(stats::coefficients(fit4)) 117 | pwr_line<-exp(solve(j,b = power_target))} 118 | 119 | } else { 120 | j<-polynom::polynomial(stats::coefficients(fit4)) 121 | pwr_line<-exp(solve(j,b = power_target)) 122 | } 123 | 124 | 125 | 126 | 127 | if(!is.complex(pwr_line)){ 128 | pwr_line<-pwr_line[which(pwr_line < max(power_test2$x) & pwr_line> min(power_test2$x))] 129 | if(length(pwr_line)>1){ pwr_line<-pwr_line[1]} 130 | if(length(pwr_line) == 0){ 131 | warning("Parameter value is out of data range") 132 | pwr_line<-NA} 133 | } else{pwr_line<-NA} 134 | 135 | power_out_final$estimate[p]<-pwr_line 136 | 137 | 138 | } 139 | } 140 | 141 | if(dim(power_out_final)[1] == 1){power_out_final<-unname(power_out_final$estimate)} 142 | return(power_out_final) 143 | 144 | } 145 | -------------------------------------------------------------------------------- /R/test_interaction.R: -------------------------------------------------------------------------------- 1 | 2 | #' Test interaction 3 | #' 4 | #' Test the interaction from a single simulated data set. 5 | #' 6 | #' @param data Simulated data set. Output of 'generate_interaction()'. 7 | #' @param alpha The alpha. At what p-value is the interaction deemed significant? Default is 0.05. 8 | #' @param detailed_results Should results beyond the linear model (change in R2, simple slopes, correlations, and confidence intervals) be returned? Default is FALSE. 9 | #' @param q Simple slopes. How many quantiles should x2 be split into for simple slope testing? Default is 2. 10 | #' Simple slope testing returns the effect-size (slope) of y~x1 for the two most extreme quantiles of x2. 11 | #' If q=3 then the two slopes are y~x1 for the bottom 33% of x2, and the top 33% of x2. 12 | #' @param simple For internal use. Default is FALSE. 13 | #' @return Either a named list or a data frame containing the results of the regression y~x1+x2+x1*x2, the pearson's correlation between y, x1,x2, and x1x2, and the slopes of the simple slopes. 14 | #' @export 15 | #' 16 | #' @examples 17 | #' dataset <- generate_interaction(N = 250,r.x1.y = 0,r.x2.y = .1,r.x1x2.y = -.2,r.x1.x2 = .3) 18 | #' test_interaction(data = dataset, alpha=0.05, q=2) 19 | test_interaction<-function(data,alpha=0.05,detailed_results=FALSE,q=2,simple=FALSE){ 20 | 21 | #out = list() 22 | 23 | if(length(table(data$y))>2){ 24 | mod<-stats::lm(y ~ x1 + x2 + x1x2, data = data) 25 | }else{ 26 | mod<-stats::glm(as.factor(y) ~ x1 + x2 + x1x2, data = data,family = "binomial") 27 | } 28 | 29 | results_out<-stats::coefficients(base::summary(mod))[-1,] 30 | results<-stats::coefficients(base::summary(mod))[-1,] 31 | 32 | if(dim(results_out)[1] != 3){stop("Multicollinearity in data, regressions cannot be run. The sample size is probbaly too small.")} 33 | 34 | 35 | 36 | #rownames(results)[3]<-c("x1_x2") 37 | if(length(table(data$y))>2){colnames(results)<-c("est","se","t","p")}else{colnames(results)<-c("est","se","z","p")} 38 | results2<-base::as.data.frame(t(c(results[1,],results[2,],results[3,]))) 39 | colnames(results2)<-c(paste(rownames(results)[1], colnames(results),sep="_"), 40 | paste(rownames(results)[2], colnames(results),sep="_"), 41 | paste(rownames(results)[3], colnames(results),sep="_")) 42 | rownames(results2)<-NULL 43 | results2$sig_int <- (results2$x1x2_p < alpha)*1 44 | # data.correlation<-stats::cor(data)[lower.tri(stats::cor(data))] 45 | 46 | if(detailed_results == TRUE){ 47 | 48 | if(length(table(data$y))>2){ 49 | mod_simple<-stats::lm(y ~ x1 + x2 , data = data) 50 | x1x2_r2 = summary(mod)$adj.r.squared - summary(mod_simple)$adj.r.squared 51 | 52 | }else{ 53 | mod_simple<-stats::glm(as.factor(y) ~ x1 + x2, data = data,family = "binomial") 54 | x1x2_r2 = 1 - mod$deviance/mod_simple$deviance #pseudo r2 55 | } 56 | c.int = suppressMessages(t(unname(stats::confint(mod)[4,]))) 57 | x1x2_95confint_25 = c.int[1] 58 | x1x2_95confint_975 = c.int[2] 59 | 60 | c.int = data.frame(x1x2_95confint_2.5 = x1x2_95confint_25, 61 | x1x2_95confint_97.5 = x1x2_95confint_975 62 | ) 63 | 64 | dd = data.frame(cor = as.vector(stats::cor(data)), 65 | v1=colnames(data), 66 | v2=rep(colnames(data), each=ncol(data))) 67 | dd = dd[as.vector(upper.tri(stats::cor(data))),] 68 | 69 | dd_out = dd 70 | 71 | cols_dd<-paste("r_",dd$v1,"_",dd$v2,sep="") 72 | dd<-t(dd[,-c(2,3)]) 73 | dd<-as.data.frame(dd) 74 | colnames(dd)<-cols_dd 75 | 76 | ## simple slopes 77 | if(length(table(data$x2)) == 2){ 78 | 79 | data$groups<-as.numeric(as.factor(data$x2)) 80 | }else{ 81 | 82 | data$groups<-as.numeric(cut(data$x2, 83 | include.lowest = T, 84 | breaks = stats::quantile(data$x2,probs = seq(0,1,by = 1/q)))) 85 | } 86 | 87 | if(length(table(data$y))>2){ 88 | g1<-dplyr::filter(data,data$groups == min(data$groups)) %>% as.matrix() 89 | g2<-dplyr::filter(data,data$groups == max(data$groups)) %>% as.matrix() 90 | 91 | mod1<-stats::lm.fit(y = g1[,3],x = cbind(1,g1[,1]) ) 92 | mod2<-stats::lm.fit(y = g2[,3],x = cbind(1,g2[,1]) ) 93 | 94 | slopes = data.frame(lower.slope = mod1$coefficients[2], 95 | upper.slope = mod2$coefficients[2] 96 | ) 97 | 98 | }else{ 99 | 100 | g1<-dplyr::filter(data,data$groups == min(data$groups)) 101 | g2<-dplyr::filter(data,data$groups == max(data$groups)) 102 | 103 | mod1<-stats::glm(as.factor(y)~x1,data = g1,family = "binomial") 104 | mod2<-stats::glm(as.factor(y)~x1,data = g2,family = "binomial") 105 | 106 | slopes = data.frame(lower.slope = stats::coefficients(mod1)[2], 107 | upper.slope = stats::coefficients(mod2)[2] 108 | ) 109 | } 110 | 111 | 112 | 113 | int.shape = data.frame(crossover.point = c(results[2,1]/results[3,1]*-1), 114 | shape = c(results[3,1]/results[1,1])) 115 | crossover = int.shape$crossover.point 116 | shape = int.shape$shape 117 | 118 | results2$est_min<-stats::coefficients(mod1)[2] 119 | results2$est_max<-stats::coefficients(mod2)[2] 120 | 121 | 122 | results2<-cbind(results2, 123 | dd, 124 | x1x2_r2, 125 | x1x2_95confint_25, 126 | x1x2_95confint_975,crossover,shape) 127 | results2<-as.data.frame(results2) 128 | #results4<-cbind(results2,results3) 129 | 130 | out=list(linear.model = results_out, 131 | x1x2.adjusted.r2 =x1x2_r2, 132 | x1x2.confint = c.int, 133 | interaction.shape=int.shape, 134 | simple.slopes =slopes, 135 | correlation = dd_out 136 | ) 137 | 138 | } # end detailed results 139 | 140 | #### 141 | if(detailed_results == FALSE){ 142 | 143 | results2<-as.data.frame(results2) 144 | 145 | out=list(linear.model = results_out ) 146 | } 147 | 148 | if(simple == TRUE){return(results2)}else{return(out)} 149 | 150 | } 151 | -------------------------------------------------------------------------------- /R/transformation_functions.R: -------------------------------------------------------------------------------- 1 | #' norm2ordinal 2 | #' 3 | #' Transforms a vector with a normal distribution to a binomial distribution with two values. 4 | #' 5 | #' @param x Input vector 6 | #' @param k Number of discrete values (e.g., 2=binary, 5=likert scale) 7 | 8 | #' 9 | #' @return A ordinal or binary variable 10 | #' @export 11 | #' 12 | #' @examples 13 | #' norm2ordinal(x = rnorm(n = 100,mean = 0,sd = 1),k=2) 14 | norm2ordinal = function(x,k){ 15 | skew=0 16 | k=k-1 17 | 18 | fnToFindRoot = function(s,n,p) {return(((1-2*p)/sqrt(n*p*(1-p)))-s)} 19 | binomial_p <- stats::uniroot(f = fnToFindRoot, interval = c(0, 1), tol = 0.0001, s=skew,n=k)$root 20 | p <- stats::pnorm(x, 0, 1) 21 | p2<-stats::qbinom(p, k, binomial_p ) 22 | x.new<-base::scale(p2,center = T,scale = T) 23 | return(x.new) 24 | 25 | } 26 | 27 | 28 | #' compute_adjustment 29 | #' 30 | #' Computes how much variable correlations need to be adjusted so that they have the desired correlation structure after transformation. Intended for internal use only. 31 | #' 32 | #' @param r.x1.y Internal use only 33 | #' @param r.x2.y Internal use only 34 | #' @param r.x1x2.y Internal use only 35 | #' @param r.x1.x2 Internal use only 36 | #' @param N.adjustment Internal use only 37 | #' @param tol Internal use only 38 | #' @param iter Internal use only 39 | #' @param k.x1 Internal use only 40 | #' @param k.x2 Internal use only 41 | #' @param k.y Internal use only 42 | #' 43 | #' @return Correlation adjustments. 44 | #' @export 45 | #' 46 | #' @examples 47 | #' \donttest{ 48 | #' compute_adjustment(r.x1.y = .2,r.x2.y = .2,r.x1x2.y = .1,r.x1.x2 = .2, 49 | #'k.x1 = 0,k.x2=0,k.y=2) 50 | #'} 51 | compute_adjustment<-function(r.x1.y,r.x2.y,r.x1x2.y,r.x1.x2, 52 | N.adjustment=1000000,tol=0.005,iter=10, 53 | k.x1, 54 | k.x2, 55 | k.y 56 | ){ 57 | 58 | target_matrix<-c(r.x1.x2, 59 | r.x1.y, 60 | 0, 61 | r.x2.y, 62 | 0, 63 | r.x1x2.y) 64 | 65 | adjustments<-c(0,0,0,0,0,0) 66 | sim_error<-1 67 | i=1 68 | 69 | while(sim_error>tol & i % base::as.data.frame() 109 | base::diag(cor.mat) = 1 110 | ind <- base::which( base::lower.tri(cor.mat,diag=F) , arr.ind = TRUE ) 111 | cor.mat[ind]=adjust 112 | ind2=ind 113 | ind2[,1]=ind[,2] 114 | ind2[,2]=ind[,1] 115 | cor.mat[ind2]=adjust 116 | 117 | while(min(eigen(cor.mat,only.values = T)$values)<0){ 118 | cor.pd = Matrix::nearPD(x = as.matrix(cor.mat),keepDiag = T,corr = T,do2eigen = T)$mat 119 | cor.pd = cor.pd[base::lower.tri(cor.pd,diag=F)] 120 | 121 | max.diff = which(abs(cor.pd - adjust)[-c(3,5)] == max(abs(cor.pd - adjust)[-c(3,5)])) 122 | 123 | adjust[-c(3,5)] [max.diff] = cor.pd[-c(3,5)] [max.diff] 124 | 125 | cor.mat = base::matrix(data = 0,nrow = 4,ncol = 4) %>% base::as.data.frame() 126 | base::diag(cor.mat) = 1 127 | ind <- base::which( base::lower.tri(cor.mat,diag=F) , arr.ind = TRUE ) 128 | cor.mat[ind]=adjust 129 | ind2=ind 130 | ind2[,1]=ind[,2] 131 | ind2[,2]=ind[,1] 132 | cor.mat[ind2]=adjust 133 | } 134 | 135 | adjustments<-(adjust - b[,1]) 136 | 137 | 138 | if(max(adjustments+target_matrix)>1){ 139 | 140 | stop("Data cannot be transformed to desired distribution") 141 | } 142 | 143 | i=i+1 144 | 145 | } 146 | 147 | if(sim_error>tol ){ 148 | stop(paste("Data cannot be transformed to desired distribution. Error (",round(sim_error,4),") is greater than tol (",tol,") Try reducing correlations, increasing tolerance, or increasing the number of iterations.",sep="")) 149 | 150 | } 151 | 152 | return(adjustments) 153 | } 154 | 155 | 156 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | 6 | 7 | ```{r, include = FALSE} 8 | knitr::opts_chunk$set( 9 | collapse = TRUE, 10 | comment = "#>", 11 | fig.path = "man/figures/README-", 12 | out.width = "100%" 13 | ) 14 | ``` 15 | 16 | # InteractionPoweR 17 | 18 | 19 | [![CRAN status](https://www.r-pkg.org/badges/version/InteractionPoweR)](https://CRAN.R-project.org/package=InteractionPoweR) 20 | [![metacran downloads](https://cranlogs.r-pkg.org/badges/grand-total/InteractionPoweR)](https://cran.r-project.org/package=InteractionPoweR) 21 | 22 | 23 | 24 | The `{InteractionPoweR}` package conducts power analyses for regression models in cross-sectional data sets where the term of interest is an interaction between two or three variables, also known as 'moderation' analyses. The package includes functions for simulating data sets, conducting power analyses, conducting stability analyses, and plotting and interpreting results. Notable package features include (1) the ability to compute power for interactions between two continuous variables, (2) effect sizes are all specified as the cross-sectional Pearson's correlation, (3) simulations do not assume that the interacting variables are independent, (4) any variable in the model, including the outcome, can have anywhere from 2 (i.e., binary) to 20 discrete values, and (5) analyses can incorporate the effects of reliability, both of the interacting variables, as well as of the outcome variable. 25 | 26 | Stability analyses for two-way interactions between continuous variables have been recently added. These include a new search function which returns the sample size or interaction effect size at which results stabilize. 27 | 28 | **For more information see our [tutorial paper](https://doi.org/10.1177/25152459231187531), the package [vignette](https://dbaranger.github.io/InteractionPoweR/articles/articles/InteractionPoweRvignette.html), and the [FAQ](https://dbaranger.github.io/InteractionPoweR/articles/articles/CommonQuestions.html).** 29 | 30 | **Web apps:** 31 | 32 | - Simulation-based power 2-way: We have a [**Shiny app**](https://mfinsaas.shinyapps.io/InteractionPoweR/) which implements the major functions for simulation-based power analyses in a user-friendly point-and-click interface. 33 | - Analytic power 2-way: We also have a [**simpler Shiny app**](https://david-baranger.shinyapps.io/InteractionPoweR_analytic/) for computing analytic power. We recommend this app particularly for beginners and users who are new to power analyses. 34 | - Analytic power 3-way: We have also recently added [**a new shiny app for three-way interactions**](https://david-baranger.shinyapps.io/InteractionPoweR_3way_analytic/). 35 | 36 | Please report bugs, issues, or questions as an [Issue on Github](https://github.com/dbaranger/InteractionPoweR/issues/). 37 | 38 | ## Installation 39 | 40 | You can install InteractionPoweR from CRAN with: 41 | 42 | ``` r 43 | install.packages("InteractionPoweR") 44 | ``` 45 | 46 | You can also install the development version of InteractionPoweR from github with: 47 | 48 | ``` r 49 | install.packages("devtools") 50 | devtools::install_github("dbaranger/InteractionPoweR") 51 | ``` 52 | 53 | If you get an error about a corrupt .rdb file, try restarting your R session. 54 | 55 | ## Basic Usage 56 | 57 | The simplest use-case is when all the input parameters are known. We know the population-level correlation between our predictors (x1 and x2) and our outcome, we have a smallest effect size of interest in mind for our interaction effect size, and our sample size is already set (maybe we are conducting secondary data analysis). Power can be determined with a single command. 58 | 59 | First - analytic power, using variable correlations (and reliability, if provided) to estimate how much additional variance is explained by the interaction term. 60 | 61 | ```{r example1, message=F,warning=F} 62 | library(InteractionPoweR) 63 | 64 | test_power<-power_interaction_r2( 65 | alpha = 0.05, # alpha, for the power analysis 66 | N = 350, # sample size 67 | r.x1x2.y = .15, # interaction effect to test (correlation between x1*x2 and y) 68 | r.x1.y = .2, # correlation between x1 and y 69 | r.x2.y = .1, # correlation between x2 and y 70 | r.x1.x2 = .2 # correlation between x1 and x2 71 | ) 72 | 73 | test_power 74 | ``` 75 | 76 | We see that we have 81% power. 77 | 78 | We can also use simulations to estimate power. Simulations are particularly useful because they can account for non-normal data, including binary and likert variables. 79 | 80 | **NB** In all these examples we use 1000 simulations for speed (`n.iter = 1000`), but for robust results we recommend 10,000 simulations (`n.iter = 10000`). 81 | 82 | ```{r example2, message=F,warning=F} 83 | set.seed(2022) 84 | test_power<-power_interaction( 85 | n.iter = 10000, # number of simulations per unique combination of input parameters 86 | alpha = 0.05, # alpha, for the power analysis 87 | N = 350, # sample size 88 | r.x1x2.y = .15, # interaction effect to test (correlation between x1*x2 and y) 89 | r.x1.y = .2, # correlation between x1 and y 90 | r.x2.y = .1, # correlation between x2 and y 91 | r.x1.x2 = .2, # correlation between x1 and x2 92 | k.y = 5, # y is likert 93 | k.x1 = 2 # x1 is binary 94 | ) 95 | 96 | test_power 97 | ``` 98 | 99 | The simulation's accuracy will increase with more iterations. 100 | 101 | ## Citation 102 | 103 | If you use `{InteractionPoweR}` in a publication, please cite our [tutorial paper](https://doi.org/10.1177/25152459231187531): 104 | 105 | Baranger DAA, Finsaas MC, Goldstein BL, Vize CE, Lynam DR, Olino TM (2023). "Tutorial: Power analyses for interaction effects in cross-sectional regressions." *Advances in Methods and Practices in Psychological Science*. 6(3). doi: [10.1177/25152459231187531](https://doi.org/10.1177/25152459231187531) 106 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # InteractionPoweR 5 | 6 | 7 | 8 | [![CRAN 9 | status](https://www.r-pkg.org/badges/version/InteractionPoweR)](https://CRAN.R-project.org/package=InteractionPoweR) 10 | [![metacran 11 | downloads](https://cranlogs.r-pkg.org/badges/grand-total/InteractionPoweR)](https://cran.r-project.org/package=InteractionPoweR) 12 | 13 | 14 | 15 | The `{InteractionPoweR}` package conducts power analyses for regression 16 | models in cross-sectional data sets where the term of interest is an 17 | interaction between two or three variables, also known as ‘moderation’ 18 | analyses. The package includes functions for simulating data sets, 19 | conducting power analyses, conducting stability analyses, and plotting 20 | and interpreting results. Notable package features include (1) the 21 | ability to compute power for interactions between two continuous 22 | variables, (2) effect sizes are all specified as the cross-sectional 23 | Pearson’s correlation, (3) simulations do not assume that the 24 | interacting variables are independent, (4) any variable in the model, 25 | including the outcome, can have anywhere from 2 (i.e., binary) to 20 26 | discrete values, and (5) analyses can incorporate the effects of 27 | reliability, both of the interacting variables, as well as of the 28 | outcome variable. 29 | 30 | Stability analyses for two-way interactions between continuous variables 31 | have been recently added. These include a new search function which 32 | returns the sample size or interaction effect size at which results 33 | stabilize. 34 | 35 | **For more information see our [tutorial 36 | paper](https://doi.org/10.1177/25152459231187531), the package 37 | [vignette](https://dbaranger.github.io/InteractionPoweR/articles/articles/InteractionPoweRvignette.html), 38 | and the 39 | [FAQ](https://dbaranger.github.io/InteractionPoweR/articles/articles/CommonQuestions.html).** 40 | 41 | **Web apps:** 42 | 43 | - Simulation-based power 2-way: We have a [**Shiny 44 | app**](https://mfinsaas.shinyapps.io/InteractionPoweR/) which 45 | implements the major functions for simulation-based power analyses in 46 | a user-friendly point-and-click interface. 47 | - Analytic power 2-way: We also have a [**simpler Shiny 48 | app**](https://david-baranger.shinyapps.io/InteractionPoweR_analytic/) 49 | for computing analytic power. We recommend this app particularly for 50 | beginners and users who are new to power analyses. 51 | - Analytic power 3-way: We have also recently added [**a new shiny app 52 | for three-way 53 | interactions**](https://david-baranger.shinyapps.io/InteractionPoweR_3way_analytic/). 54 | 55 | Please report bugs, issues, or questions as an [Issue on 56 | Github](https://github.com/dbaranger/InteractionPoweR/issues/). 57 | 58 | ## Installation 59 | 60 | You can install InteractionPoweR from CRAN with: 61 | 62 | ``` r 63 | install.packages("InteractionPoweR") 64 | ``` 65 | 66 | You can also install the development version of InteractionPoweR from 67 | github with: 68 | 69 | ``` r 70 | install.packages("devtools") 71 | devtools::install_github("dbaranger/InteractionPoweR") 72 | ``` 73 | 74 | If you get an error about a corrupt .rdb file, try restarting your R 75 | session. 76 | 77 | ## Basic Usage 78 | 79 | The simplest use-case is when all the input parameters are known. We 80 | know the population-level correlation between our predictors (x1 and x2) 81 | and our outcome, we have a smallest effect size of interest in mind for 82 | our interaction effect size, and our sample size is already set (maybe 83 | we are conducting secondary data analysis). Power can be determined with 84 | a single command. 85 | 86 | First - analytic power, using variable correlations (and reliability, if 87 | provided) to estimate how much additional variance is explained by the 88 | interaction term. 89 | 90 | ``` r 91 | library(InteractionPoweR) 92 | 93 | test_power<-power_interaction_r2( 94 | alpha = 0.05, # alpha, for the power analysis 95 | N = 350, # sample size 96 | r.x1x2.y = .15, # interaction effect to test (correlation between x1*x2 and y) 97 | r.x1.y = .2, # correlation between x1 and y 98 | r.x2.y = .1, # correlation between x2 and y 99 | r.x1.x2 = .2 # correlation between x1 and x2 100 | ) 101 | 102 | test_power 103 | #> pwr 104 | #> 1 0.8131373 105 | ``` 106 | 107 | We see that we have 81% power. 108 | 109 | We can also use simulations to estimate power. Simulations are 110 | particularly useful because they can account for non-normal data, 111 | including binary and likert variables. 112 | 113 | **NB** In all these examples we use 1000 simulations for speed 114 | (`n.iter = 1000`), but for robust results we recommend 10,000 115 | simulations (`n.iter = 10000`). 116 | 117 | ``` r 118 | set.seed(2022) 119 | test_power<-power_interaction( 120 | n.iter = 10000, # number of simulations per unique combination of input parameters 121 | alpha = 0.05, # alpha, for the power analysis 122 | N = 350, # sample size 123 | r.x1x2.y = .15, # interaction effect to test (correlation between x1*x2 and y) 124 | r.x1.y = .2, # correlation between x1 and y 125 | r.x2.y = .1, # correlation between x2 and y 126 | r.x1.x2 = .2, # correlation between x1 and x2 127 | k.y = 5, # y is likert 128 | k.x1 = 2 # x1 is binary 129 | ) 130 | 131 | test_power 132 | #> N pwr 133 | #> 1 350 0.8086 134 | ``` 135 | 136 | The simulation’s accuracy will increase with more iterations. 137 | 138 | ## Citation 139 | 140 | If you use `{InteractionPoweR}` in a publication, please cite our 141 | [tutorial paper](https://doi.org/10.1177/25152459231187531): 142 | 143 | Baranger DAA, Finsaas MC, Goldstein BL, Vize CE, Lynam DR, Olino TM 144 | (2023). “Tutorial: Power analyses for interaction effects in 145 | cross-sectional regressions.” *Advances in Methods and Practices in 146 | Psychological Science*. 6(3). doi: 147 | [10.1177/25152459231187531](https://doi.org/10.1177/25152459231187531) 148 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: https://dbaranger.github.io/InteractionPoweR 2 | 3 | home: 4 | title: Power Analyses for Interaction Effects in Cross-Sectional Regressions 5 | description: Conducts power analyses for regression models with interacting correlated variables. 6 | 7 | template: 8 | bootstrap: 5 9 | params: 10 | ganalytics: G-36JVDTC1K0 11 | docsearch: 12 | api_key: d9b5db6cf281b0bbf8f497a463b0d116 13 | index_name: interactionpower 14 | opengraph: 15 | twitter: 16 | creator: "@David_Baranger" 17 | card: summary 18 | 19 | articles: 20 | - title: InteractionPoweR 21 | navbar: ~ 22 | contents: 23 | - articles/InteractionPoweRvignette 24 | - articles/InteractionPower2waycovsvignette 25 | - articles/InteractionPoweR3wayvignette 26 | - articles/InteractionPoweR_Stability 27 | - articles/CommonQuestions 28 | 29 | reference: 30 | - title: "2-way power analysis" 31 | desc: > 32 | Functions to run a 2-way power analysis 33 | - contents: 34 | - power_interaction 35 | - power_interaction_r2 36 | - generate.interaction.cov.input 37 | - power_interaction_r2_covs 38 | - title: "3-way power analysis" 39 | desc: > 40 | Functions to run a 3-way power analysis 41 | - contents: 42 | - power_interaction_3way_r2 43 | - title: "Next steps" 44 | desc: > 45 | Interpret and visualize power analysis results 46 | - contents: 47 | - power_estimate 48 | - plot_power_curve 49 | - plot_simple_slope 50 | - cor.mat.3way 51 | - simple.slopes.3way 52 | - title: "2-way stability analysis" 53 | desc: > 54 | Run a stability analysis for a 2-way interaction 55 | - contents: 56 | - run_pos_power_search 57 | - title: "A single data set" 58 | desc: > 59 | Simulate and plot a single data set 60 | - contents: 61 | - generate_interaction 62 | - plot_interaction 63 | - test_interaction 64 | - title: "Internal functions" 65 | desc: > 66 | Internal functions that support the package 67 | - contents: 68 | - compute_adjustment 69 | - name_key 70 | - norm2ordinal 71 | -------------------------------------------------------------------------------- /cran-comments.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "cran-comments" 3 | author: "David AA Baranger" 4 | date: "11/9/2023" 5 | output: md_document 6 | --- 7 | 8 | ```{r setup, include=FALSE} 9 | knitr::opts_chunk$set(echo = TRUE) 10 | ``` 11 | 12 | ## Notes 13 | 14 | Updates package to 0.2.2 15 | 16 | ## R CMD check results 17 | 18 | 0 errors | 0 warnings | 0 notes 19 | 20 | ## Downstream dependencies 21 | 22 | There are no downstream dependencies. 23 | 24 | ## Test environments 25 | 26 | Passes R CMD check with no ERRORs, WARNINGs, or other NOTEs on: 27 | 28 | 1. x86_64-w64-mingw32 (Windows 64-bit), R 4.4.1 29 | 2. x86_64-w64-mingw32 (Windows 64-bit), R-devel 30 | 3. r-devel-macosx-arm64 (macOS 13.3.1 64-bit), R 4.4.0 31 | 32 | 33 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## Notes 2 | 3 | Updates package to 0.2.2 4 | 5 | ## R CMD check results 6 | 7 | 0 errors | 0 warnings | 0 notes 8 | 9 | ## Downstream dependencies 10 | 11 | There are no downstream dependencies. 12 | 13 | ## Test environments 14 | 15 | Passes R CMD check with no ERRORs, WARNINGs, or other NOTEs on: 16 | 17 | 1. x86\_64-w64-mingw32 (Windows 64-bit), R 4.4.1 18 | 2. x86\_64-w64-mingw32 (Windows 64-bit), R-devel 19 | 3. r-devel-macosx-arm64 (macOS 13.3.1 64-bit), R 4.4.0 20 | -------------------------------------------------------------------------------- /data/name_key.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/data/name_key.rda -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Page not found (404) • InteractionPoweR 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 34 | 35 | 36 | Skip to contents 37 | 38 | 39 |
86 |
87 |
91 | 92 | Content not found. Please use links in the navbar. 93 | 94 |
95 |
96 | 97 | 98 |
102 | 103 | 107 | 108 |
109 |
110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /docs/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /docs/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweR3wayvignette_files/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweR3wayvignette_files/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweR3wayvignette_files/figure-html/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweR3wayvignette_files/figure-html/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweR3wayvignette_files/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweR3wayvignette_files/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweRvignette_files/figure-html/fig1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweRvignette_files/figure-html/fig1-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweRvignette_files/figure-html/fig2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweRvignette_files/figure-html/fig2-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweRvignette_files/figure-html/fig3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweRvignette_files/figure-html/fig3-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweRvignette_files/figure-html/fig4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweRvignette_files/figure-html/fig4-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweRvignette_files/figure-html/fig4b-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweRvignette_files/figure-html/fig4b-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweRvignette_files/figure-html/fig5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweRvignette_files/figure-html/fig5-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweRvignette_files/figure-html/fig6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweRvignette_files/figure-html/fig6-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweRvignette_files/figure-html/fig7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweRvignette_files/figure-html/fig7-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweRvignette_files/figure-html/fig8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweRvignette_files/figure-html/fig8-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPoweRvignette_files/figure-html/fig9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPoweRvignette_files/figure-html/fig9-1.png -------------------------------------------------------------------------------- /docs/articles/InteractionPower2waycovsvignette_files/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/InteractionPower2waycovsvignette_files/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /docs/articles/articles/CommonQuestions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/articles/articles/CommonQuestions_files/header-attrs-2.6/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPoweR3wayvignette.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPoweR_Stability.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPoweRvignette.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig1-1.png -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig2-1.png -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig3-1.png -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig4-1.png -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig5-1.png -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig6-1.png -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig7-1.png -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/articles/articles/InteractionPoweRvignette_files/figure-html/fig8-1.png -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPoweRvignette_files/header-attrs-2.6/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/articles/InteractionPower2waycovsvignette.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | Articles • InteractionPoweR 12 | Skip to contents 13 | 14 | 15 |
57 |
58 |
61 | 62 |
63 |

InteractionPoweR

64 |

65 | 66 |
The InteractionPoweR Package
67 |

This article describes how to use InteractionPoweR and also explains how the functions underlying this package work.

68 |
Interaction Power: Power analyses for 2-way interactions with covariates
69 |

This article describes how to use InteractionPoweR to run power analyses for 2-way interactions that also include covariates

70 |
Interaction Power: Power analyses for 3-way interactions
71 |

This article describes how to use InteractionPoweR to run power analyses for 3-way interactions.

72 |
InteractionPoweR Stability Update
73 |

This article describes how to use the run_pos_power_search() function in InteractionPoweR

74 |
Questions & Errors
75 |
76 |
77 |
78 | 79 | 80 |
83 | 84 | 87 | 88 |
89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | (function() { 6 | 'use strict'; 7 | 8 | window.Toc = { 9 | helpers: { 10 | // return all matching elements in the set, or their descendants 11 | findOrFilter: function($el, selector) { 12 | // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ 13 | // http://stackoverflow.com/a/12731439/358804 14 | var $descendants = $el.find(selector); 15 | return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); 16 | }, 17 | 18 | generateUniqueIdBase: function(el) { 19 | var text = $(el).text(); 20 | var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); 21 | return anchor || el.tagName.toLowerCase(); 22 | }, 23 | 24 | generateUniqueId: function(el) { 25 | var anchorBase = this.generateUniqueIdBase(el); 26 | for (var i = 0; ; i++) { 27 | var anchor = anchorBase; 28 | if (i > 0) { 29 | // add suffix 30 | anchor += '-' + i; 31 | } 32 | // check if ID already exists 33 | if (!document.getElementById(anchor)) { 34 | return anchor; 35 | } 36 | } 37 | }, 38 | 39 | generateAnchor: function(el) { 40 | if (el.id) { 41 | return el.id; 42 | } else { 43 | var anchor = this.generateUniqueId(el); 44 | el.id = anchor; 45 | return anchor; 46 | } 47 | }, 48 | 49 | createNavList: function() { 50 | return $(''); 51 | }, 52 | 53 | createChildNavList: function($parent) { 54 | var $childList = this.createNavList(); 55 | $parent.append($childList); 56 | return $childList; 57 | }, 58 | 59 | generateNavEl: function(anchor, text) { 60 | var $a = $(''); 61 | $a.attr('href', '#' + anchor); 62 | $a.text(text); 63 | var $li = $('
  • '); 64 | $li.append($a); 65 | return $li; 66 | }, 67 | 68 | generateNavItem: function(headingEl) { 69 | var anchor = this.generateAnchor(headingEl); 70 | var $heading = $(headingEl); 71 | var text = $heading.data('toc-text') || $heading.text(); 72 | return this.generateNavEl(anchor, text); 73 | }, 74 | 75 | // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). 76 | getTopLevel: function($scope) { 77 | for (var i = 1; i <= 6; i++) { 78 | var $headings = this.findOrFilter($scope, 'h' + i); 79 | if ($headings.length > 1) { 80 | return i; 81 | } 82 | } 83 | 84 | return 1; 85 | }, 86 | 87 | // returns the elements for the top level, and the next below it 88 | getHeadings: function($scope, topLevel) { 89 | var topSelector = 'h' + topLevel; 90 | 91 | var secondaryLevel = topLevel + 1; 92 | var secondarySelector = 'h' + secondaryLevel; 93 | 94 | return this.findOrFilter($scope, topSelector + ',' + secondarySelector); 95 | }, 96 | 97 | getNavLevel: function(el) { 98 | return parseInt(el.tagName.charAt(1), 10); 99 | }, 100 | 101 | populateNav: function($topContext, topLevel, $headings) { 102 | var $context = $topContext; 103 | var $prevNav; 104 | 105 | var helpers = this; 106 | $headings.each(function(i, el) { 107 | var $newNav = helpers.generateNavItem(el); 108 | var navLevel = helpers.getNavLevel(el); 109 | 110 | // determine the proper $context 111 | if (navLevel === topLevel) { 112 | // use top level 113 | $context = $topContext; 114 | } else if ($prevNav && $context === $topContext) { 115 | // create a new level of the tree and switch to it 116 | $context = helpers.createChildNavList($prevNav); 117 | } // else use the current $context 118 | 119 | $context.append($newNav); 120 | 121 | $prevNav = $newNav; 122 | }); 123 | }, 124 | 125 | parseOps: function(arg) { 126 | var opts; 127 | if (arg.jquery) { 128 | opts = { 129 | $nav: arg 130 | }; 131 | } else { 132 | opts = arg; 133 | } 134 | opts.$scope = opts.$scope || $(document.body); 135 | return opts; 136 | } 137 | }, 138 | 139 | // accepts a jQuery object, or an options object 140 | init: function(opts) { 141 | opts = this.helpers.parseOps(opts); 142 | 143 | // ensure that the data attribute is in place for styling 144 | opts.$nav.attr('data-toggle', 'toc'); 145 | 146 | var $topContext = this.helpers.createChildNavList(opts.$nav); 147 | var topLevel = this.helpers.getTopLevel(opts.$scope); 148 | var $headings = this.helpers.getHeadings(opts.$scope, topLevel); 149 | this.helpers.populateNav($topContext, topLevel, $headings); 150 | } 151 | }; 152 | 153 | $(function() { 154 | $('nav[data-toggle="toc"]').each(function(i, el) { 155 | var $nav = $(el); 156 | Toc.init($nav); 157 | }); 158 | }); 159 | })(); 160 | -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/font.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Open Sans'; 3 | font-style: italic; 4 | font-weight: 300; 5 | font-stretch: normal; 6 | font-display: swap; 7 | src: url(fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk5hkaVQ.woff) format('woff'); 8 | } 9 | @font-face { 10 | font-family: 'Open Sans'; 11 | font-style: italic; 12 | font-weight: 400; 13 | font-stretch: normal; 14 | font-display: swap; 15 | src: url(fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk8ZkaVQ.woff) format('woff'); 16 | } 17 | @font-face { 18 | font-family: 'Open Sans'; 19 | font-style: italic; 20 | font-weight: 500; 21 | font-stretch: normal; 22 | font-display: swap; 23 | src: url(fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk_RkaVQ.woff) format('woff'); 24 | } 25 | @font-face { 26 | font-family: 'Open Sans'; 27 | font-style: italic; 28 | font-weight: 600; 29 | font-stretch: normal; 30 | font-display: swap; 31 | src: url(fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0RkxhjaVQ.woff) format('woff'); 32 | } 33 | @font-face { 34 | font-family: 'Open Sans'; 35 | font-style: italic; 36 | font-weight: 700; 37 | font-stretch: normal; 38 | font-display: swap; 39 | src: url(fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0RkyFjaVQ.woff) format('woff'); 40 | } 41 | @font-face { 42 | font-family: 'Open Sans'; 43 | font-style: italic; 44 | font-weight: 800; 45 | font-stretch: normal; 46 | font-display: swap; 47 | src: url(fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk0ZjaVQ.woff) format('woff'); 48 | } 49 | @font-face { 50 | font-family: 'Open Sans'; 51 | font-style: normal; 52 | font-weight: 300; 53 | font-stretch: normal; 54 | font-display: swap; 55 | src: url(fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsiH0C4k.woff) format('woff'); 56 | } 57 | @font-face { 58 | font-family: 'Open Sans'; 59 | font-style: normal; 60 | font-weight: 400; 61 | font-stretch: normal; 62 | font-display: swap; 63 | src: url(fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0C4k.woff) format('woff'); 64 | } 65 | @font-face { 66 | font-family: 'Open Sans'; 67 | font-style: normal; 68 | font-weight: 500; 69 | font-stretch: normal; 70 | font-display: swap; 71 | src: url(fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjr0C4k.woff) format('woff'); 72 | } 73 | @font-face { 74 | font-family: 'Open Sans'; 75 | font-style: normal; 76 | font-weight: 600; 77 | font-stretch: normal; 78 | font-display: swap; 79 | src: url(fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsgH1y4k.woff) format('woff'); 80 | } 81 | @font-face { 82 | font-family: 'Open Sans'; 83 | font-style: normal; 84 | font-weight: 700; 85 | font-stretch: normal; 86 | font-display: swap; 87 | src: url(fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsg-1y4k.woff) format('woff'); 88 | } 89 | @font-face { 90 | font-family: 'Open Sans'; 91 | font-style: normal; 92 | font-weight: 800; 93 | font-stretch: normal; 94 | font-display: swap; 95 | src: url(fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgshZ1y4k.woff) format('woff'); 96 | } 97 | @font-face { 98 | font-family: 'Source Code Pro'; 99 | font-style: italic; 100 | font-weight: 400; 101 | font-display: swap; 102 | src: url(fonts/HI_jiYsKILxRpg3hIP6sJ7fM7PqlOPHYvDP_W9O7GQTTbI1rSg.woff) format('woff'); 103 | } 104 | @font-face { 105 | font-family: 'Source Code Pro'; 106 | font-style: italic; 107 | font-weight: 600; 108 | font-display: swap; 109 | src: url(fonts/HI_jiYsKILxRpg3hIP6sJ7fM7PqlOPHYvDP_W9O7GQTTsoprSg.woff) format('woff'); 110 | } 111 | @font-face { 112 | font-family: 'Source Code Pro'; 113 | font-style: normal; 114 | font-weight: 400; 115 | font-display: swap; 116 | src: url(fonts/HI_diYsKILxRpg3hIP6sJ7fM7PqPMcMnZFqUwX28DMyQhM0.woff) format('woff'); 117 | } 118 | @font-face { 119 | font-family: 'Source Code Pro'; 120 | font-style: normal; 121 | font-weight: 600; 122 | font-display: swap; 123 | src: url(fonts/HI_diYsKILxRpg3hIP6sJ7fM7PqPMcMnZFqUwX28DBKXhM0.woff) format('woff'); 124 | } 125 | -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVs9pbCIPrc.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVs9pbCIPrc.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCIPrc.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCIPrc.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/1adeadb2fe618c5ed46221f15e12b9c8.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/1adeadb2fe618c5ed46221f15e12b9c8.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/4iCs6KVjbNBYlgo6ew.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/4iCs6KVjbNBYlgo6ew.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/4iCs6KVjbNBYlgoKfw7w.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/4iCs6KVjbNBYlgoKfw7w.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/4iCv6KVjbNBYlgoCxCvTtA.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/4iCv6KVjbNBYlgoCxCvTtA.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/4iCv6KVjbNBYlgoCxCvjsGyL.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/4iCv6KVjbNBYlgoCxCvjsGyL.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7nsDQ.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7nsDQ.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPa7j.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPa7j.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3aPA.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3aPA.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7j.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7j.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rAkw.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rAkw.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vAkw.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vAkw.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlxdo.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlxdo.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zAkw.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zAkw.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdo.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdo.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/CSR54z1Qlv-GDxkbKVQ_dFsvWNRevw.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/CSR54z1Qlv-GDxkbKVQ_dFsvWNRevw.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/CSR54z1Qlv-GDxkbKVQ_dFsvaNA.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/CSR54z1Qlv-GDxkbKVQ_dFsvaNA.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/CSR64z1Qlv-GDxkbKVQ_TOQ.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/CSR64z1Qlv-GDxkbKVQ_TOQ.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/CSR64z1Qlv-GDxkbKVQ_fOAKSw.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/CSR64z1Qlv-GDxkbKVQ_fOAKSw.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/HI_diYsKILxRpg3hIP6sJ7fM7PqPMcMnZFqUwX28DBKXhM0.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/HI_diYsKILxRpg3hIP6sJ7fM7PqPMcMnZFqUwX28DBKXhM0.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/HI_diYsKILxRpg3hIP6sJ7fM7PqPMcMnZFqUwX28DMyQhM0.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/HI_diYsKILxRpg3hIP6sJ7fM7PqPMcMnZFqUwX28DMyQhM0.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/HI_jiYsKILxRpg3hIP6sJ7fM7PqlOPHYvDP_W9O7GQTTbI1rSg.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/HI_jiYsKILxRpg3hIP6sJ7fM7PqlOPHYvDP_W9O7GQTTbI1rSg.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/HI_jiYsKILxRpg3hIP6sJ7fM7PqlOPHYvDP_W9O7GQTTsoprSg.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/HI_jiYsKILxRpg3hIP6sJ7fM7PqlOPHYvDP_W9O7GQTTsoprSg.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtZ6Ew9.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtZ6Ew9.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew9.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew9.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCuM70w9.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCuM70w9.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmEU9fBBc-.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmEU9fBBc-.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmEU9vAA.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmEU9vAA.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmSU5fBBc-.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmSU5fBBc-.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmSU5vAA.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmSU5vAA.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmWUlfBBc-.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmWUlfBBc-.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmWUlvAA.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmWUlvAA.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/KFOmCnqEu92Fr1Me5g.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/KFOmCnqEu92Fr1Me5g.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/KFOmCnqEu92Fr1Mu4mxM.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/KFOmCnqEu92Fr1Mu4mxM.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/QGYpz_kZZAGCONcK2A4bGOj8mNhL.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/QGYpz_kZZAGCONcK2A4bGOj8mNhL.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/S6u8w4BMUTPHjxsAXC-s.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/S6u8w4BMUTPHjxsAXC-s.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/S6u8w4BMUTPHjxswWA.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/S6u8w4BMUTPHjxswWA.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/S6u9w4BMUTPHh6UVSwiPHw.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/S6u9w4BMUTPHh6UVSwiPHw.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/S6u9w4BMUTPHh6UVeww.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/S6u9w4BMUTPHh6UVeww.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/S6u9w4BMUTPHh7USSwiPHw.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/S6u9w4BMUTPHh7USSwiPHw.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/S6u9w4BMUTPHh7USeww.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/S6u9w4BMUTPHh7USeww.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/S6uyw4BMUTPHjx4wWA.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/S6uyw4BMUTPHjx4wWA.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/S6uyw4BMUTPHvxo.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/S6uyw4BMUTPHvxo.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuFuYMZs.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuFuYMZs.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuI6fMZs.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuI6fMZs.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfMZs.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfMZs.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/XRXI3I6Li01BKofiOc5wtlZ2di8HDFwmRTA.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/XRXI3I6Li01BKofiOc5wtlZ2di8HDFwmRTA.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/XRXI3I6Li01BKofiOc5wtlZ2di8HDGUmRTA.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/XRXI3I6Li01BKofiOc5wtlZ2di8HDGUmRTA.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/XRXI3I6Li01BKofiOc5wtlZ2di8HDLshRTA.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/XRXI3I6Li01BKofiOc5wtlZ2di8HDLshRTA.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/a98f7a7574819ba83bec6279a2cecd95.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/a98f7a7574819ba83bec6279a2cecd95.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk0ZjaVQ.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk0ZjaVQ.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk5hkWVAexg.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk5hkWVAexg.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk5hkaVQ.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk5hkaVQ.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk8ZkWVAexg.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk8ZkWVAexg.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk8ZkaVQ.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk8ZkaVQ.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk_RkaVQ.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0Rk_RkaVQ.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0RkxhjaVQ.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0RkxhjaVQ.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0RkyFjWVAexg.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0RkyFjWVAexg.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0RkyFjaVQ.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memQYaGs126MiZpBA-UFUIcVXSCEkx2cmqvXlWq8tWZ0Pw86hd0RkyFjaVQ.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsg-1x4gaVQ.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsg-1x4gaVQ.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsg-1y4k.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsg-1y4k.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsgH1y4k.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsgH1y4k.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgshZ1y4k.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgshZ1y4k.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsiH0B4gaVQ.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsiH0B4gaVQ.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsiH0C4k.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsiH0C4k.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4gaVQ.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4gaVQ.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0C4k.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0C4k.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjr0C4k.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjr0C4k.woff -------------------------------------------------------------------------------- /docs/deps/bootstrap-5.3.1/fonts/q5uGsou0JOdh94bfvQlr.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/deps/bootstrap-5.3.1/fonts/q5uGsou0JOdh94bfvQlr.woff -------------------------------------------------------------------------------- /docs/deps/data-deps.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/docsearch.json: -------------------------------------------------------------------------------- 1 | { 2 | "index_name": "interactionpower", 3 | "start_urls": [ 4 | { 5 | "url": "https://dbaranger.github.io/InteractionPoweR/index.html", 6 | "selectors_key": "homepage", 7 | "tags": [ 8 | "homepage" 9 | ] 10 | }, 11 | { 12 | "url": "https://dbaranger.github.io/InteractionPoweR/reference", 13 | "selectors_key": "reference", 14 | "tags": [ 15 | "reference" 16 | ] 17 | }, 18 | { 19 | "url": "https://dbaranger.github.io/InteractionPoweR/articles", 20 | "selectors_key": "articles", 21 | "tags": [ 22 | "articles" 23 | ] 24 | } 25 | ], 26 | "stop_urls": [ 27 | "/reference/$", 28 | "/reference/index.html", 29 | "/articles/$", 30 | "/articles/index.html" 31 | ], 32 | "sitemap_urls": [ 33 | "https://dbaranger.github.io/InteractionPoweR/sitemap.xml" 34 | ], 35 | "selectors": { 36 | "homepage": { 37 | "lvl0": { 38 | "selector": ".contents h1", 39 | "default_value": "InteractionPoweR Home page" 40 | }, 41 | "lvl1": { 42 | "selector": ".contents h2" 43 | }, 44 | "lvl2": { 45 | "selector": ".contents h3", 46 | "default_value": "Context" 47 | }, 48 | "lvl3": ".ref-arguments td, .ref-description", 49 | "text": ".contents p, .contents li, .contents .pre" 50 | }, 51 | "reference": { 52 | "lvl0": { 53 | "selector": ".contents h1" 54 | }, 55 | "lvl1": { 56 | "selector": ".contents .name", 57 | "default_value": "Argument" 58 | }, 59 | "lvl2": { 60 | "selector": ".ref-arguments th", 61 | "default_value": "Description" 62 | }, 63 | "lvl3": ".ref-arguments td, .ref-description", 64 | "text": ".contents p, .contents li" 65 | }, 66 | "articles": { 67 | "lvl0": { 68 | "selector": ".contents h1" 69 | }, 70 | "lvl1": { 71 | "selector": ".contents .name" 72 | }, 73 | "lvl2": { 74 | "selector": ".contents h2, .contents h3", 75 | "default_value": "Context" 76 | }, 77 | "text": ".contents p, .contents li" 78 | } 79 | }, 80 | "selectors_exclude": [ 81 | ".dont-index" 82 | ], 83 | "min_indexed_level": 2, 84 | "custom_settings": { 85 | "separatorsToIndex": "_", 86 | "attributesToRetrieve": [ 87 | "hierarchy", 88 | "content", 89 | "anchor", 90 | "url", 91 | "url_without_anchor" 92 | ] 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /docs/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/favicon-16x16.png -------------------------------------------------------------------------------- /docs/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/favicon-32x32.png -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/favicon.ico -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/logo.png -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('nav.navbar').headroom(); 6 | 7 | Toc.init({ 8 | $nav: $("#toc"), 9 | $scope: $("main h2, main h3, main h4, main h5, main h6") 10 | }); 11 | 12 | if ($('#toc').length) { 13 | $('body').scrollspy({ 14 | target: '#toc', 15 | offset: $("nav.navbar").outerHeight() + 1 16 | }); 17 | } 18 | 19 | // Activate popovers 20 | $('[data-bs-toggle="popover"]').popover({ 21 | container: 'body', 22 | html: true, 23 | trigger: 'focus', 24 | placement: "top", 25 | sanitize: false, 26 | }); 27 | 28 | $('[data-bs-toggle="tooltip"]').tooltip(); 29 | 30 | /* Clipboard --------------------------*/ 31 | 32 | function changeTooltipMessage(element, msg) { 33 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 34 | element.setAttribute('data-original-title', msg); 35 | $(element).tooltip('show'); 36 | element.setAttribute('data-original-title', tooltipOriginalTitle); 37 | } 38 | 39 | if(ClipboardJS.isSupported()) { 40 | $(document).ready(function() { 41 | var copyButton = ""; 42 | 43 | $("div.sourceCode").addClass("hasCopyButton"); 44 | 45 | // Insert copy buttons: 46 | $(copyButton).prependTo(".hasCopyButton"); 47 | 48 | // Initialize tooltips: 49 | $('.btn-copy-ex').tooltip({container: 'body'}); 50 | 51 | // Initialize clipboard: 52 | var clipboard = new ClipboardJS('[data-clipboard-copy]', { 53 | text: function(trigger) { 54 | return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); 55 | } 56 | }); 57 | 58 | clipboard.on('success', function(e) { 59 | changeTooltipMessage(e.trigger, 'Copied!'); 60 | e.clearSelection(); 61 | }); 62 | 63 | clipboard.on('error', function() { 64 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 65 | }); 66 | 67 | }); 68 | } 69 | 70 | /* Search marking --------------------------*/ 71 | var url = new URL(window.location.href); 72 | var toMark = url.searchParams.get("q"); 73 | var mark = new Mark("main#main"); 74 | if (toMark) { 75 | mark.mark(toMark, { 76 | accuracy: { 77 | value: "complementary", 78 | limiters: [",", ".", ":", "/"], 79 | } 80 | }); 81 | } 82 | 83 | /* Search --------------------------*/ 84 | /* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */ 85 | // Initialise search index on focus 86 | var fuse; 87 | $("#search-input").focus(async function(e) { 88 | if (fuse) { 89 | return; 90 | } 91 | 92 | $(e.target).addClass("loading"); 93 | var response = await fetch($("#search-input").data("search-index")); 94 | var data = await response.json(); 95 | 96 | var options = { 97 | keys: ["what", "text", "code"], 98 | ignoreLocation: true, 99 | threshold: 0.1, 100 | includeMatches: true, 101 | includeScore: true, 102 | }; 103 | fuse = new Fuse(data, options); 104 | 105 | $(e.target).removeClass("loading"); 106 | }); 107 | 108 | // Use algolia autocomplete 109 | var options = { 110 | autoselect: true, 111 | debug: true, 112 | hint: false, 113 | minLength: 2, 114 | }; 115 | var q; 116 | async function searchFuse(query, callback) { 117 | await fuse; 118 | 119 | var items; 120 | if (!fuse) { 121 | items = []; 122 | } else { 123 | q = query; 124 | var results = fuse.search(query, { limit: 20 }); 125 | items = results 126 | .filter((x) => x.score <= 0.75) 127 | .map((x) => x.item); 128 | if (items.length === 0) { 129 | items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}]; 130 | } 131 | } 132 | callback(items); 133 | } 134 | $("#search-input").autocomplete(options, [ 135 | { 136 | name: "content", 137 | source: searchFuse, 138 | templates: { 139 | suggestion: (s) => { 140 | if (s.title == s.what) { 141 | return `${s.dir} >
    ${s.title}
    `; 142 | } else if (s.previous_headings == "") { 143 | return `${s.dir} >
    ${s.title}
    > ${s.what}`; 144 | } else { 145 | return `${s.dir} >
    ${s.title}
    > ${s.previous_headings} > ${s.what}`; 146 | } 147 | }, 148 | }, 149 | }, 150 | ]).on('autocomplete:selected', function(event, s) { 151 | window.location.href = s.path + "?q=" + q + "#" + s.id; 152 | }); 153 | }); 154 | })(window.jQuery || window.$) 155 | 156 | 157 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 3.1.1 2 | pkgdown: 2.0.7 3 | pkgdown_sha: ~ 4 | articles: 5 | CommonQuestions: CommonQuestions.html 6 | InteractionPower2waycovsvignette: InteractionPower2waycovsvignette.html 7 | InteractionPoweR3wayvignette: InteractionPoweR3wayvignette.html 8 | InteractionPoweRvignette: InteractionPoweRvignette.html 9 | InteractionPoweR_Stability: InteractionPoweR_Stability.html 10 | last_built: 2025-05-06T17:46Z 11 | urls: 12 | reference: https://dbaranger.github.io/InteractionPoweR/reference 13 | article: https://dbaranger.github.io/InteractionPoweR/articles 14 | 15 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/figures/README-example10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/figures/README-example10-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-example11-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/figures/README-example11-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-example12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/figures/README-example12-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-example2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/figures/README-example2-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-example4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/figures/README-example4-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-example7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/figures/README-example7-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-example9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/figures/README-example9-1.png -------------------------------------------------------------------------------- /docs/reference/figures/hex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/figures/hex.png -------------------------------------------------------------------------------- /docs/reference/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/figures/logo.png -------------------------------------------------------------------------------- /docs/reference/name_key.html: -------------------------------------------------------------------------------- 1 | 2 | Name key for plotting — name_key • InteractionPoweR 12 | Skip to contents 13 | 14 | 15 |
    57 |
    58 |
    63 | 64 |
    65 |

    Expanded variable names so that plots look nicer.

    66 |
    67 | 68 |
    69 |

    Usage

    70 |
    data(name_key)
    71 |
    72 | 73 |
    74 |

    Format

    75 |

    A data frame with 25 rows and 2 variables

    76 |
    77 | 78 |
    80 | 81 | 82 |
    85 | 86 | 89 | 90 |
    91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /docs/reference/plot_interaction-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/plot_interaction-1.png -------------------------------------------------------------------------------- /docs/reference/plot_power_curve-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/plot_power_curve-1.png -------------------------------------------------------------------------------- /docs/reference/plot_simple_slope-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/docs/reference/plot_simple_slope-1.png -------------------------------------------------------------------------------- /docs/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | https://dbaranger.github.io/InteractionPoweR/404.html 5 | 6 | 7 | https://dbaranger.github.io/InteractionPoweR/articles/articles/CommonQuestions.html 8 | 9 | 10 | https://dbaranger.github.io/InteractionPoweR/articles/articles/InteractionPower2waycovsvignette.html 11 | 12 | 13 | https://dbaranger.github.io/InteractionPoweR/articles/articles/InteractionPoweR3wayvignette.html 14 | 15 | 16 | https://dbaranger.github.io/InteractionPoweR/articles/articles/InteractionPoweRvignette.html 17 | 18 | 19 | https://dbaranger.github.io/InteractionPoweR/articles/CommonQuestions.html 20 | 21 | 22 | https://dbaranger.github.io/InteractionPoweR/articles/index.html 23 | 24 | 25 | https://dbaranger.github.io/InteractionPoweR/articles/InteractionPower2waycovsvignette.html 26 | 27 | 28 | https://dbaranger.github.io/InteractionPoweR/articles/InteractionPoweR3wayvignette.html 29 | 30 | 31 | https://dbaranger.github.io/InteractionPoweR/articles/InteractionPoweRvignette.html 32 | 33 | 34 | https://dbaranger.github.io/InteractionPoweR/articles/InteractionPoweR_Stability.html 35 | 36 | 37 | https://dbaranger.github.io/InteractionPoweR/authors.html 38 | 39 | 40 | https://dbaranger.github.io/InteractionPoweR/index.html 41 | 42 | 43 | https://dbaranger.github.io/InteractionPoweR/LICENSE.html 44 | 45 | 46 | https://dbaranger.github.io/InteractionPoweR/news/index.html 47 | 48 | 49 | https://dbaranger.github.io/InteractionPoweR/reference/binary.p2skew.html 50 | 51 | 52 | https://dbaranger.github.io/InteractionPoweR/reference/compute_adjustment.html 53 | 54 | 55 | https://dbaranger.github.io/InteractionPoweR/reference/cor.mat.3way.html 56 | 57 | 58 | https://dbaranger.github.io/InteractionPoweR/reference/generate.interaction.cov.input.html 59 | 60 | 61 | https://dbaranger.github.io/InteractionPoweR/reference/generate_interaction.html 62 | 63 | 64 | https://dbaranger.github.io/InteractionPoweR/reference/index.html 65 | 66 | 67 | https://dbaranger.github.io/InteractionPoweR/reference/name_key.html 68 | 69 | 70 | https://dbaranger.github.io/InteractionPoweR/reference/norm2binary.html 71 | 72 | 73 | https://dbaranger.github.io/InteractionPoweR/reference/norm2gamma.html 74 | 75 | 76 | https://dbaranger.github.io/InteractionPoweR/reference/norm2likert.html 77 | 78 | 79 | https://dbaranger.github.io/InteractionPoweR/reference/norm2ordinal.html 80 | 81 | 82 | https://dbaranger.github.io/InteractionPoweR/reference/plot_interaction.html 83 | 84 | 85 | https://dbaranger.github.io/InteractionPoweR/reference/plot_power_curve.html 86 | 87 | 88 | https://dbaranger.github.io/InteractionPoweR/reference/plot_simple_slope.html 89 | 90 | 91 | https://dbaranger.github.io/InteractionPoweR/reference/power_estimate.html 92 | 93 | 94 | https://dbaranger.github.io/InteractionPoweR/reference/power_interaction.html 95 | 96 | 97 | https://dbaranger.github.io/InteractionPoweR/reference/power_interaction_3way_r2.html 98 | 99 | 100 | https://dbaranger.github.io/InteractionPoweR/reference/power_interaction_r2.html 101 | 102 | 103 | https://dbaranger.github.io/InteractionPoweR/reference/power_interaction_r2_covs.html 104 | 105 | 106 | https://dbaranger.github.io/InteractionPoweR/reference/run_pos_power_search.html 107 | 108 | 109 | https://dbaranger.github.io/InteractionPoweR/reference/simple.slopes.3way.html 110 | 111 | 112 | https://dbaranger.github.io/InteractionPoweR/reference/test_interaction.html 113 | 114 | 115 | -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | bibentry(header = "To cite InteractionPoweR in publications use:", 2 | bibtype = "Article", 3 | author="David A. A. Baranger and Megan C. Finsaas and Brandon L. Goldstein and Colin E. Vize and Donald R. Lynam and Thomas M. Olino", 4 | doi = "10.1177/25152459231187531", 5 | journal = "Advances in Methods and Practices in Psychological Science", 6 | title = "Tutorial: Power analyses for interaction effects in cross-sectional regressions", 7 | volume = "6", 8 | number = "3", 9 | year = "2023" 10 | ) 11 | -------------------------------------------------------------------------------- /man/compute_adjustment.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/transformation_functions.R 3 | \name{compute_adjustment} 4 | \alias{compute_adjustment} 5 | \title{compute_adjustment} 6 | \usage{ 7 | compute_adjustment( 8 | r.x1.y, 9 | r.x2.y, 10 | r.x1x2.y, 11 | r.x1.x2, 12 | N.adjustment = 1e+06, 13 | tol = 0.005, 14 | iter = 10, 15 | k.x1, 16 | k.x2, 17 | k.y 18 | ) 19 | } 20 | \arguments{ 21 | \item{r.x1.y}{Internal use only} 22 | 23 | \item{r.x2.y}{Internal use only} 24 | 25 | \item{r.x1x2.y}{Internal use only} 26 | 27 | \item{r.x1.x2}{Internal use only} 28 | 29 | \item{N.adjustment}{Internal use only} 30 | 31 | \item{tol}{Internal use only} 32 | 33 | \item{iter}{Internal use only} 34 | 35 | \item{k.x1}{Internal use only} 36 | 37 | \item{k.x2}{Internal use only} 38 | 39 | \item{k.y}{Internal use only} 40 | } 41 | \value{ 42 | Correlation adjustments. 43 | } 44 | \description{ 45 | Computes how much variable correlations need to be adjusted so that they have the desired correlation structure after transformation. Intended for internal use only. 46 | } 47 | \examples{ 48 | \donttest{ 49 | compute_adjustment(r.x1.y = .2,r.x2.y = .2,r.x1x2.y = .1,r.x1.x2 = .2, 50 | k.x1 = 0,k.x2=0,k.y=2) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /man/cor.mat.3way.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plots.3way.R 3 | \name{cor.mat.3way} 4 | \alias{cor.mat.3way} 5 | \title{See the correlation matrix for a 3-way interaction} 6 | \usage{ 7 | cor.mat.3way(power.results, row.num = 1, return.plot = FALSE) 8 | } 9 | \arguments{ 10 | \item{power.results}{Data frame of results from power_interaction_3way_r2().} 11 | 12 | \item{row.num}{Which row to show? Can only be a single number. Default is 1.} 13 | 14 | \item{return.plot}{Return a matrix (FALSE, default), or a plot (TRUE)?} 15 | } 16 | \value{ 17 | A matrix or a ggplot2 object 18 | } 19 | \description{ 20 | Prints or plots the correlation matrix for a 3-way interaction 21 | } 22 | \examples{ 23 | power_analysis = power_interaction_3way_r2(detailed_results = TRUE,N = c(1000), 24 | r.x1.y = .2,r.x2.y = .3,r.x3.y = .1,r.x1x2.y = .01,r.x1x3.y = .05,r.x2x3.y = .1, 25 | b.x1x2x3 = 0.1,r.x1.x2 = .1,r.x1.x3 = .1,r.x2.x3 = .1, 26 | rel.x1 = 1,rel.x2 = 1,rel.x3 = 1,rel.y = 1 ) 27 | cor.mat.3way(power_analysis) 28 | } 29 | -------------------------------------------------------------------------------- /man/figures/README-example10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/man/figures/README-example10-1.png -------------------------------------------------------------------------------- /man/figures/README-example11-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/man/figures/README-example11-1.png -------------------------------------------------------------------------------- /man/figures/README-example12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/man/figures/README-example12-1.png -------------------------------------------------------------------------------- /man/figures/README-example2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/man/figures/README-example2-1.png -------------------------------------------------------------------------------- /man/figures/README-example4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/man/figures/README-example4-1.png -------------------------------------------------------------------------------- /man/figures/README-example7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/man/figures/README-example7-1.png -------------------------------------------------------------------------------- /man/figures/README-example9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/man/figures/README-example9-1.png -------------------------------------------------------------------------------- /man/figures/hex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/man/figures/hex.png -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/man/figures/logo.png -------------------------------------------------------------------------------- /man/generate.interaction.cov.input.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/power_interaction_r2_covs.R 3 | \name{generate.interaction.cov.input} 4 | \alias{generate.interaction.cov.input} 5 | \title{Creates the input to \code{power_interaction_r2_covs()}} 6 | \usage{ 7 | generate.interaction.cov.input(c.num) 8 | } 9 | \arguments{ 10 | \item{c.num}{Number of covariates in the model.} 11 | } 12 | \value{ 13 | A list to be used with the 'power_interaction_r2_covs()' function. 14 | } 15 | \description{ 16 | Companion function to 'power_interaction_r2_covs()'. Generates a formatted list for users to specify the analysis parameters. 17 | } 18 | \examples{ 19 | ex1 = generate.interaction.cov.input(c.num=2) 20 | ex1$correlations$r.y.x1x2 = c(0.1,0.2,0.3) 21 | } 22 | -------------------------------------------------------------------------------- /man/generate_interaction.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/generate_interaction.R 3 | \name{generate_interaction} 4 | \alias{generate_interaction} 5 | \title{Generate interaction data set} 6 | \usage{ 7 | generate_interaction( 8 | N, 9 | r.x1.y, 10 | r.x2.y, 11 | r.x1x2.y, 12 | r.x1.x2, 13 | rel.x1 = 1, 14 | rel.x2 = 1, 15 | rel.y = 1, 16 | k.x1 = 0, 17 | k.x2 = 0, 18 | k.y = 0, 19 | adjust.correlations = TRUE, 20 | tol = 0.005, 21 | iter = 10, 22 | N.adjustment = 1e+06, 23 | r.x1.y.adjust = NULL, 24 | r.x2.y.adjust = NULL, 25 | r.x1.x2.adjust = NULL, 26 | r.x1x2.y.adjust = NULL, 27 | internal.adjust = FALSE, 28 | skew.x1 = NA, 29 | skew.x2 = NA, 30 | skew.y = NA 31 | ) 32 | } 33 | \arguments{ 34 | \item{N}{Sample size. Must be a positive integer. Has no default value.} 35 | 36 | \item{r.x1.y}{Pearson's correlation between x1 and y. Must be between -1 and 1. Has no default value.} 37 | 38 | \item{r.x2.y}{Pearson's correlation between x2 and y. Must be between -1 and 1. Assumed to be the 'moderator' in some functions. Has no default value.} 39 | 40 | \item{r.x1x2.y}{Pearson's correlation between the interaction term x1x2 (x1 * x2) and y. Must be between -1 and 1. Has no default value.} 41 | 42 | \item{r.x1.x2}{Pearson's correlation between x1 and x2. Must be between -1 and 1. Has no default value.} 43 | 44 | \item{rel.x1}{Reliability of x1 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 45 | 46 | \item{rel.x2}{Reliability of x2 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 47 | 48 | \item{rel.y}{Reliability of xy (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 49 | 50 | \item{k.x1}{Number of discrete values for x1. Can be used to make a variable binary or ordinal.} 51 | 52 | \item{k.x2}{Number of discrete values for x2. Can be used to make a variable binary or ordinal.} 53 | 54 | \item{k.y}{Number of discrete values for y.Can be used to make a variable binary or ordinal.} 55 | 56 | \item{adjust.correlations}{If variables are ordinal or binary, should correlations be adjusted so that output data has the specified correlation structure? Default is TRUE.} 57 | 58 | \item{tol}{Correlation adjustment tolerance. When adjust.correlations = TRUE, correlations are adjusted so that the population correlation is within r='tol' of the target. Default = 0.005.} 59 | 60 | \item{iter}{Max number of iterations to run the correlation adjustment for. Typically only a couple are needed. Default = 10.} 61 | 62 | \item{N.adjustment}{Sample size to use when adjusting correlations. Default = 1000000.} 63 | 64 | \item{r.x1.y.adjust}{Internal use only.} 65 | 66 | \item{r.x2.y.adjust}{Internal use only.} 67 | 68 | \item{r.x1.x2.adjust}{Internal use only.} 69 | 70 | \item{r.x1x2.y.adjust}{Internal use only.} 71 | 72 | \item{internal.adjust}{Internal use only.} 73 | 74 | \item{skew.x1}{No longer supported.} 75 | 76 | \item{skew.x2}{No longer supported.} 77 | 78 | \item{skew.y}{No longer supported.} 79 | } 80 | \value{ 81 | A data frame containing variables 'x1', 'x2', 'y', and 'x1x2'. 'x1x2' is x1*x2. The correlations between these variables are drawn from the defined population-level values. Output variables are all z-scored (mean=0, sd=1). 82 | } 83 | \description{ 84 | Simulate a single data set with an interaction (y ~ x1 + x2 + x1*x2). All values other than 'N' are population-level effects - the values within any single simulated data set will vary around the defined values. 85 | } 86 | \examples{ 87 | dataset <- generate_interaction(N = 10,r.x1.y = 0,r.x2.y = .1,r.x1x2.y = -.2,r.x1.x2 = .3) 88 | } 89 | -------------------------------------------------------------------------------- /man/name_key.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/name_key.R 3 | \docType{data} 4 | \name{name_key} 5 | \alias{name_key} 6 | \title{Name key for plotting} 7 | \format{ 8 | A data frame with 25 rows and 2 variables 9 | } 10 | \usage{ 11 | data(name_key) 12 | } 13 | \description{ 14 | Expanded variable names so that plots look nicer. 15 | } 16 | -------------------------------------------------------------------------------- /man/norm2ordinal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/transformation_functions.R 3 | \name{norm2ordinal} 4 | \alias{norm2ordinal} 5 | \title{norm2ordinal} 6 | \usage{ 7 | norm2ordinal(x, k) 8 | } 9 | \arguments{ 10 | \item{x}{Input vector} 11 | 12 | \item{k}{Number of discrete values (e.g., 2=binary, 5=likert scale)} 13 | } 14 | \value{ 15 | A ordinal or binary variable 16 | } 17 | \description{ 18 | Transforms a vector with a normal distribution to a binomial distribution with two values. 19 | } 20 | \examples{ 21 | norm2ordinal(x = rnorm(n = 100,mean = 0,sd = 1),k=2) 22 | } 23 | -------------------------------------------------------------------------------- /man/plot_interaction.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_interaction.R 3 | \name{plot_interaction} 4 | \alias{plot_interaction} 5 | \title{Plot interaction} 6 | \usage{ 7 | plot_interaction(data, q = 3) 8 | } 9 | \arguments{ 10 | \item{data}{Output of generate_interaction().} 11 | 12 | \item{q}{Simple slope quantiles. Default is 2. X2 is the default moderator, unless X1 is already binary. Must be a positive integer > 1.} 13 | } 14 | \value{ 15 | A ggplot2 object 16 | } 17 | \description{ 18 | Plots a single simulated interaction data set 19 | } 20 | \examples{ 21 | dataset <- generate_interaction(N = 250,r.x1.y = 0,r.x2.y = .1,r.x1x2.y = -.2,r.x1.x2 = .3) 22 | plot_interaction(dataset,q=3) 23 | } 24 | -------------------------------------------------------------------------------- /man/plot_power_curve.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_power_curve.R 3 | \name{plot_power_curve} 4 | \alias{plot_power_curve} 5 | \title{Plot power curve} 6 | \usage{ 7 | plot_power_curve( 8 | power_data, 9 | x = NULL, 10 | group = NULL, 11 | facets = NULL, 12 | power_target = 0.8 13 | ) 14 | } 15 | \arguments{ 16 | \item{power_data}{Data frame of results from power_interaction(). Can accept the raw results if up to 3 parameters were varied during simulation. Any more and data should be filtered first.} 17 | 18 | \item{x}{Optional, the x-axis of the plot. Default is the first variable after 'pwr'.} 19 | 20 | \item{group}{Optional, grouping variable for the line color. Default is the second variable after 'pwr', if present.} 21 | 22 | \item{facets}{Optional, grouping variable for plot facets. Default is the third variable after 'pwr' if present.} 23 | 24 | \item{power_target}{The target power. Default is 80\%.} 25 | } 26 | \value{ 27 | A ggplot2 object 28 | } 29 | \description{ 30 | Plot the output of power_interaction(). 31 | } 32 | \examples{ 33 | power_analysis <- power_interaction(n.iter = 10,N = seq(100,300,by=100), 34 | r.x1.y = 0,r.x2.y = .1,r.x1x2.y = -.2,r.x1.x2 = .3,detailed_results = TRUE) 35 | plot_power_curve(power_analysis) 36 | } 37 | -------------------------------------------------------------------------------- /man/plot_simple_slope.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_simple_slope.R 3 | \name{plot_simple_slope} 4 | \alias{plot_simple_slope} 5 | \title{Simple slope plot} 6 | \usage{ 7 | plot_simple_slope(power_data, x = NULL, facets = NULL) 8 | } 9 | \arguments{ 10 | \item{power_data}{Data frame of results from power_interaction(). Can accept the raw results if up to 2 parameters were varied during simulation. Any more and data should be filtered first.} 11 | 12 | \item{x}{Optional, the x-axis of the plot. Default is the first variable after 'pwr'.} 13 | 14 | \item{facets}{Optional, grouping variable for plot facets. Default is the second variable after 'pwr' if present.} 15 | } 16 | \value{ 17 | A ggplot2 object 18 | } 19 | \description{ 20 | Plots the simple slope min and max estimates from power_interaction(). 21 | } 22 | \examples{ 23 | power_analysis <- power_interaction(n.iter = 10,N = seq(100,300,by=100), 24 | r.x1.y = 0,r.x2.y = .1,r.x1x2.y = -.2,r.x1.x2 = .3,detailed_results = TRUE) 25 | plot_simple_slope(power_analysis) 26 | } 27 | -------------------------------------------------------------------------------- /man/power_estimate.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/power_estimate.R 3 | \name{power_estimate} 4 | \alias{power_estimate} 5 | \title{Power estimate} 6 | \usage{ 7 | power_estimate(power_data, x, power_target) 8 | } 9 | \arguments{ 10 | \item{power_data}{Output of power_interaction().} 11 | 12 | \item{x}{The name of the target variable as a character string.} 13 | 14 | \item{power_target}{The desired power level. Must be between 0 and 1 (e.g., 0.8 for 80\% power).} 15 | } 16 | \value{ 17 | A data frame containing the value of x that achieves the target power for each combination of settings. Will return NA if target power is outside the simulation data. 18 | } 19 | \description{ 20 | Uses regression to estimate the value needed to attain the target power, given a set of simulation results. 21 | } 22 | \examples{ 23 | simulation_results = power_interaction_r2(N=seq(100,300,by=10), 24 | r.x1.y=0.2, r.x2.y=.2,r.x1x2.y=0.2,r.x1.x2=.2) 25 | power_estimate(power_data = simulation_results, x = "N", power_target = .8) 26 | } 27 | -------------------------------------------------------------------------------- /man/power_interaction.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/power_interaction.R 3 | \name{power_interaction} 4 | \alias{power_interaction} 5 | \title{Power analysis for interactions} 6 | \usage{ 7 | power_interaction( 8 | n.iter, 9 | N, 10 | r.x1.y, 11 | r.x2.y, 12 | r.x1x2.y, 13 | r.x1.x2, 14 | rel.x1 = 1, 15 | rel.x2 = 1, 16 | rel.y = 1, 17 | k.x1 = 0, 18 | k.x2 = 0, 19 | k.y = 0, 20 | adjust.correlations = TRUE, 21 | alpha = 0.05, 22 | q = 2, 23 | cl = NULL, 24 | ss.IQR = 1.5, 25 | N.adjustment = 1e+06, 26 | detailed_results = FALSE, 27 | full_simulation = FALSE, 28 | tol = 0.005, 29 | iter = 10, 30 | skew.x1 = NA, 31 | skew.x2 = NA, 32 | skew.y = NA 33 | ) 34 | } 35 | \arguments{ 36 | \item{n.iter}{Number of iterations. The number of simulations to run for each unique setting combination. Must be a positive integer.} 37 | 38 | \item{N}{Sample size. Must be a positive integer. Has no default value. Can be a single value or a vector of values.} 39 | 40 | \item{r.x1.y}{Pearson's correlation between x1 and y. Must be between -1 and 1.. Has no default value. Can be a single value or a vector of values.} 41 | 42 | \item{r.x2.y}{Pearson's correlation between x2 and y. Must be between -1 and 1.. Assumed to be the 'moderator' in some functions. Has no default value. Can be a single value or a vector of values.} 43 | 44 | \item{r.x1x2.y}{Pearson's correlation between the interaction term x1x2 (x1 * x2) and y. Must be between -1 and 1.. Has no default value. Can be a single value or a vector of values.} 45 | 46 | \item{r.x1.x2}{Pearson's correlation between x1 and x2. Must be between -1 and 1.. Has no default value. Can be a single value or a vector of values.} 47 | 48 | \item{rel.x1}{Reliability of x1 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 49 | 50 | \item{rel.x2}{Reliability of x2 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 51 | 52 | \item{rel.y}{Reliability of xy (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 53 | 54 | \item{k.x1}{Number of discrete values for x1. Can be used to make a variable binary or ordinal.} 55 | 56 | \item{k.x2}{Number of discrete values for x2. Can be used to make a variable binary or ordinal.} 57 | 58 | \item{k.y}{Number of discrete values for y. Can be used to make a variable binary or ordinal.} 59 | 60 | \item{adjust.correlations}{If variables are ordinal or binary, should correlations be adjusted so that output data has the specified correlation structure? Default is TRUE.} 61 | 62 | \item{alpha}{The alpha. At what p-value is the interaction deemed significant? Default is 0.05.} 63 | 64 | \item{q}{Simple slopes. How many quantiles should x2 be split into for simple slope testing? Default is 2. Simple slope testing returns the effect-size (slope) of y~x1 for the two most extreme quantiles of x2. If q=3 then the two slopes are y~x1 for the bottom 33\% of x2, and the top 33\% of x2.} 65 | 66 | \item{cl}{Number of clusters to use for running simulations in parallel (recommended). Default is 1 (i.e. not in parallel).} 67 | 68 | \item{ss.IQR}{Simple slope IQR. Multiplier when estimating the distribution of simple slopes within each simulation setting. Default is 1.5.} 69 | 70 | \item{N.adjustment}{Sample size for simulations where correlation matrix is corrected to allow for binary/ordinal variables. Default is 1000000} 71 | 72 | \item{detailed_results}{Default is FALSE. Should detailed results be reported?} 73 | 74 | \item{full_simulation}{Default is FALSE. If TRUE, will return a list that includes the full per-simulation results.} 75 | 76 | \item{tol}{Correlation adjustment tolerance. When adjust.correlations = TRUE, correlations are adjusted so that the population correlation is within r='tol' of the target. Default = 0.005.} 77 | 78 | \item{iter}{Max number of iterations to run the correlation adjustment for. Typically only a couple are needed. Default = 10.} 79 | 80 | \item{skew.x1}{No longer supported.} 81 | 82 | \item{skew.x2}{No longer supported.} 83 | 84 | \item{skew.y}{No longer supported.} 85 | } 86 | \value{ 87 | A data frame containing the power (\% significant results) for each unique setting combination. If full_simulation = TRUE will return a list, with one data frame that includes power, and a second that includes raw simulation results. 88 | } 89 | \description{ 90 | Power analysis for interaction models, by simulation. A set of n.iter simulations is run for each unique combination of model settings. 91 | } 92 | \examples{ 93 | power_interaction(n.iter=10, N=10,r.x1.y=0.2, r.x2.y=.2,r.x1x2.y=0.5,r.x1.x2=.2) 94 | } 95 | -------------------------------------------------------------------------------- /man/power_interaction_3way_r2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/power_interaction_3way_r2.R 3 | \name{power_interaction_3way_r2} 4 | \alias{power_interaction_3way_r2} 5 | \title{Analytic power analysis for 3-way interactions} 6 | \usage{ 7 | power_interaction_3way_r2( 8 | N, 9 | b.x1x2x3, 10 | r.x1.y, 11 | r.x2.y, 12 | r.x3.y, 13 | r.x1x2.y, 14 | r.x1x3.y, 15 | r.x2x3.y, 16 | r.x1.x2, 17 | r.x1.x3, 18 | r.x2.x3, 19 | rel.x1 = 1, 20 | rel.x2 = 1, 21 | rel.x3 = 1, 22 | rel.y = 1, 23 | alpha = 0.05, 24 | detailed_results = FALSE, 25 | cl = NULL 26 | ) 27 | } 28 | \arguments{ 29 | \item{N}{Sample size. Must be a positive integer. Has no default value. Can be a single value or a vector of values.} 30 | 31 | \item{b.x1x2x3}{Regression coefficient of the 3-way interaction term x1x2x3. Should not be specified if \code{f2} is specified. Must be between -1 and 1. Default is NULL. Can be a single value or a vector of values.} 32 | 33 | \item{r.x1.y}{Pearson's correlation between x1 and y. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.} 34 | 35 | \item{r.x2.y}{Pearson's correlation between x2 and y. Must be between -1 and 1. Assumed to be the 'moderator' in some functions. Has no default value. Can be a single value or a vector of values.} 36 | 37 | \item{r.x3.y}{Pearson's correlation between x3 and y. Must be between -1 and 1. Assumed to be the 'moderator' in some functions. Has no default value. Can be a single value or a vector of values.} 38 | 39 | \item{r.x1x2.y}{Pearson's correlation between the interaction term x1x2 (x1 * x2) and y. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.} 40 | 41 | \item{r.x1x3.y}{Pearson's correlation between the interaction term x1x2 (x1 * x3) and y. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.} 42 | 43 | \item{r.x2x3.y}{Pearson's correlation between the interaction term x1x2 (x2 * x3) and y. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.} 44 | 45 | \item{r.x1.x2}{Pearson's correlation between x1 and x2. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.} 46 | 47 | \item{r.x1.x3}{Pearson's correlation between x1 and x3. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.} 48 | 49 | \item{r.x2.x3}{Pearson's correlation between x2 and x3. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.} 50 | 51 | \item{rel.x1}{Reliability of x1 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 52 | 53 | \item{rel.x2}{Reliability of x2 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 54 | 55 | \item{rel.x3}{Reliability of x3 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 56 | 57 | \item{rel.y}{Reliability of xy (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 58 | 59 | \item{alpha}{The alpha. At what p-value is the interaction deemed significant? Default is 0.05.} 60 | 61 | \item{detailed_results}{Default is FALSE. Should detailed results be reported? Returns regression slopes, f2, r2, and the full correlation matrix.} 62 | 63 | \item{cl}{Number of clusters to use for running simulations in parallel. Default is NULL (i.e. not in parallel). Useful when running several thousand analyses at once.} 64 | } 65 | \value{ 66 | A data frame containing the power for each unique setting combination. 67 | } 68 | \description{ 69 | Power analysis for 3-way interaction models, computed via change in R2. Valid for interactions with continuous, normally distributed, variables. Either \code{b.x1x2x3} or \code{f2} can be used to specify the magnitude of the interaction effect size. 70 | } 71 | \examples{ 72 | power_interaction_3way_r2(N=1000,r.x1.y = .1,r.x2.y = .2,r.x3.y = .3, 73 | r.x1x2.y = .05,r.x1x3.y = .07,r.x2x3.y = .09,b.x1x2x3 =0.01, 74 | r.x1.x2 = .2,r.x1.x3 = .4,r.x2.x3 = .3) 75 | 76 | } 77 | -------------------------------------------------------------------------------- /man/power_interaction_r2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/power_interaction_r2.R 3 | \name{power_interaction_r2} 4 | \alias{power_interaction_r2} 5 | \title{Analytic power analysis for interactions} 6 | \usage{ 7 | power_interaction_r2( 8 | N, 9 | r.x1.y, 10 | r.x2.y, 11 | r.x1x2.y, 12 | r.x1.x2, 13 | rel.x1 = 1, 14 | rel.x2 = 1, 15 | rel.y = 1, 16 | alpha = 0.05, 17 | detailed_results = FALSE 18 | ) 19 | } 20 | \arguments{ 21 | \item{N}{Sample size. Must be a positive integer. Has no default value. Can be a single value or a vector of values.} 22 | 23 | \item{r.x1.y}{Pearson's correlation between x1 and y. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.} 24 | 25 | \item{r.x2.y}{Pearson's correlation between x2 and y. Must be between -1 and 1. Assumed to be the 'moderator' in some functions. Has no default value. Can be a single value or a vector of values.} 26 | 27 | \item{r.x1x2.y}{Pearson's correlation between the interaction term x1x2 (x1 * x2) and y. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.} 28 | 29 | \item{r.x1.x2}{Pearson's correlation between x1 and x2. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.} 30 | 31 | \item{rel.x1}{Reliability of x1 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 32 | 33 | \item{rel.x2}{Reliability of x2 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 34 | 35 | \item{rel.y}{Reliability of xy (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 36 | 37 | \item{alpha}{The alpha. At what p-value is the interaction deemed significant? Default is 0.05.} 38 | 39 | \item{detailed_results}{Default is FALSE. Should detailed results be reported?} 40 | } 41 | \value{ 42 | A data frame containing the power for each unique setting combination. 43 | } 44 | \description{ 45 | Power analysis for interaction models, computed via change in R2. Valid for interactions with continuous, normally distributed, variables. 46 | } 47 | \examples{ 48 | power_interaction_r2(N=seq(100,300,by=10),r.x1.y=0.2, r.x2.y=.2,r.x1x2.y=0.2,r.x1.x2=.2) 49 | 50 | } 51 | -------------------------------------------------------------------------------- /man/power_interaction_r2_covs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/power_interaction_r2_covs.R 3 | \name{power_interaction_r2_covs} 4 | \alias{power_interaction_r2_covs} 5 | \title{Analytic interaction power analysis with covariates} 6 | \usage{ 7 | power_interaction_r2_covs( 8 | cov.input, 9 | N, 10 | alpha = 0.05, 11 | detailed_results = FALSE, 12 | cl = NULL 13 | ) 14 | } 15 | \arguments{ 16 | \item{cov.input}{Output of 'power_interaction_r2_covs()'. Variable correlations and reliabilities are set by first modifying this list.} 17 | 18 | \item{N}{Sample size. Must be a positive integer. Has no default value. Can be a single value or a vector of values.} 19 | 20 | \item{alpha}{The alpha. At what p-value is the interaction deemed significant? Default is 0.05.} 21 | 22 | \item{detailed_results}{Default is FALSE. Should detailed results be reported?} 23 | 24 | \item{cl}{Number of clusters to use for running simulations in parallel. Default is NULL (i.e. not in parallel). Useful when running several thousand analyses at once.} 25 | } 26 | \value{ 27 | A data frame containing the analytic power for each unique setting combination. 28 | } 29 | \description{ 30 | Analytic power analysis of an interaction model with covariates. Additional covariate x main effect interaction terms are additionally added. 31 | } 32 | \examples{ 33 | ex1 = generate.interaction.cov.input(c.num=2) 34 | ex1$correlations$r.y.x1x2 = c(0.1,0.2,0.3) 35 | power_interaction_r2_covs(cov.input = ex1,N=100) 36 | } 37 | -------------------------------------------------------------------------------- /man/run_pos_power_search.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/run_pos_power_search.R 3 | \name{run_pos_power_search} 4 | \alias{run_pos_power_search} 5 | \title{Calculate the point of stability for a two-way interaction estimate} 6 | \usage{ 7 | run_pos_power_search( 8 | r.x1.y, 9 | r.x2.y, 10 | r.x1x2.y = NULL, 11 | r.x1.x2, 12 | rel.x1, 13 | rel.x2, 14 | rel.y = 1, 15 | single.N = NULL, 16 | start.power = 0.8, 17 | step = NULL, 18 | n.datasets = 1000, 19 | lower.bound = NULL, 20 | upper.bound = NULL, 21 | cos.width = 0.5, 22 | pos.percent = 0.8, 23 | n.cores = 1 24 | ) 25 | } 26 | \arguments{ 27 | \item{r.x1.y}{Pearson's correlation between x1 and y. Must be between -1 and 1. Has no default value.} 28 | 29 | \item{r.x2.y}{Pearson's correlation between x2 and y. Must be between -1 and 1. Assumed to be the 'moderator' in some functions. Has no default value.} 30 | 31 | \item{r.x1x2.y}{Pearson's correlation between the interaction term x1x2 (x1 * x2) and y. Must be between -1 and 1. If NULL or unspecified, it is automatically assigned as the average of the main effects divided by 2, considering reliability. The default value is NULL.} 32 | 33 | \item{r.x1.x2}{Pearson's correlation between x1 and x2. Must be between -1 and 1. Has no default value.} 34 | 35 | \item{rel.x1}{Reliability of x1 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 36 | 37 | \item{rel.x2}{Reliability of x2 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 38 | 39 | \item{rel.y}{Reliability of xy (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.} 40 | 41 | \item{single.N}{Numeric or NULL. A specific sample size at which the stability statistics (POS, COS) are computed. A numeric value overrides the search for a POS. Must be a whole number greater than 0 or NULL. Default is NULL.} 42 | 43 | \item{start.power}{Numeric or NULL. Determines the starting sample size of the search by locating the sample size with power equal to start.power. If it is non-null, it must be greater than 0 and less than 1. Note that a non-null start.power overrides user inputs for the parameters lower.bound and upper.bound so both are NULL. The default is 0.8.} 44 | 45 | \item{step}{Numeric or NULL. Determines the rounding (degree of precision) in the estimate of the POS. When set to NULL, dynamic adjustments are made with 1/100th the of the interval between the upper.bound and lower.bound on each iteration of the search algorithm. If it is non-null, it must be a whole natural number. Default is NULL.} 46 | 47 | \item{n.datasets}{Numeric. Number of simulations conducted at each sample size identified by the search process. Larger values result in greater computational demands. Default is 10000. Must be greater than 1.} 48 | 49 | \item{lower.bound}{Numeric or NULL. The lower bound for the search. It is automatically assigned when set to NULL The user can manually input one. There is an automatic override to NULL if start.power is non-null. The default is NULL.} 50 | 51 | \item{upper.bound}{Numeric or NULL. The upper bound for the search. If it is null, an upper bound is determined automatically; there is a ceiling of 1e7. Default is NULL.} 52 | 53 | \item{cos.width}{Numeric. The width of the corridor of stability COS within which we require some number of estimates to fall to identify the POS. Must be greater than 0. Values above 1 are unlikely to be informative. Default is 0.5.} 54 | 55 | \item{pos.percent}{Numeric. The minimum proportion of simulated estimates we require to fall inside the COS to consider the sample size to produce stable estimates. Default is 0.8.} 56 | 57 | \item{n.cores}{Numeric. Number of cores to be used in parallel processing. Default is 1.} 58 | } 59 | \value{ 60 | A data frame containing the variables 'rel.x1', 'rel.x2', 'rel.x1x2', 'rel.y', 'r.x1x2.y', 'r.x1.y', 'r.x2.y', 'obs.r.x1x2.y', 'COS_pos.percents', 'COS_interval', 'POS_samplesize', and 'POS_power' 61 | OR a data frame containing the variables 'single.N', 'rel.x1', 'rel.x2', 'rel.x1x2', 'rel.y', 'r.x1x2.y', 'r.x1.y', 'r.x2.y', 'obs.r.x1x2.y', 'COS_pos.percents', 'within_COS_interval', 'POS_determined_COS', 'within_POS_determined_COS', 'POS_determined_COS.percent', sign_error_rate', and 'power' 62 | If the user inputs single.N as NULL, the first dataframe is returned with the search results for the POS. 63 | If the user inputs single.N as a numeric whole number greater than 3, the second dataframe is returned with stability information at that specific sample size. 64 | 65 | \if{html}{\out{
    }}\preformatted{ COS_pos.percents: A string representing the COS width and target POS percentage. 66 | within_COS_interval: The proportion of estimates within the inputted COS at the sample size single.N. 67 | POS_determined_COS: The COS necessary to achieve the inputted pos.percent at the sample size single.N. There is a ceiling of 100 times the magnitude of the estimate. 68 | within_POS_determined_COS: The proportion of estimates within the POS_determined_COS at the sample size single.N. 69 | POS_determined_COS.percent: The percent deviation from the expected value defining POS_determined_COS. 70 | sign_error_rate: The number of estimates signed incorrectly at the sample size single.N. 71 | power: The statistical power, calculated analytically, at the sample size single.N. 72 | r.x1x2.y_to_be_stable_at_single.N: The minimum interaction effect required for stability at the sample size single.N, determined via binary search. 73 | power_to_be_stable: The statistical power associated with the stable_effect_size at sample size single.N. 74 | }\if{html}{\out{
    }} 75 | } 76 | \description{ 77 | Calculate the point of stability for a two-way interaction estimate 78 | } 79 | \examples{ 80 | run_pos_power_search(r.x1.y = 0.2, r.x2.y = 0.2, r.x1x2.y = 0.15, r.x1.x2 = 0.1, 81 | rel.x1 = 0.8, rel.x2 = 0.8,start.power = 0.8, step = NULL, n.datasets = 1000, 82 | lower.bound = NULL, upper.bound = 500, cos.width = 0.5, pos.percent = 0.8) 83 | } 84 | -------------------------------------------------------------------------------- /man/simple.slopes.3way.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plots.3way.R 3 | \name{simple.slopes.3way} 4 | \alias{simple.slopes.3way} 5 | \title{See the simple slopes for a 3-way interaction} 6 | \usage{ 7 | simple.slopes.3way(power.results, row.num = 1, return.plot = FALSE) 8 | } 9 | \arguments{ 10 | \item{power.results}{Data frame of results from power_interaction_3way_r2().} 11 | 12 | \item{row.num}{Which row to show? Can only be a single number. Default is 1.} 13 | 14 | \item{return.plot}{Return a matrix (FALSE, default), or a plot (TRUE)?} 15 | } 16 | \value{ 17 | A matrix or a ggplot2 object 18 | } 19 | \description{ 20 | Prints or plots the simple slopes for a 3-way interaction 21 | } 22 | \examples{ 23 | power_analysis = power_interaction_3way_r2(detailed_results = TRUE,N = c(1000), 24 | r.x1.y = .2,r.x2.y = .3,r.x3.y = .1,r.x1x2.y = .01,r.x1x3.y = .05,r.x2x3.y = .1, 25 | b.x1x2x3 = 0.1,r.x1.x2 = .1,r.x1.x3 = .1,r.x2.x3 = .1, 26 | rel.x1 = 1,rel.x2 = 1,rel.x3 = 1,rel.y = 1 ) 27 | simple.slopes.3way(power_analysis) 28 | } 29 | -------------------------------------------------------------------------------- /man/test_interaction.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/test_interaction.R 3 | \name{test_interaction} 4 | \alias{test_interaction} 5 | \title{Test interaction} 6 | \usage{ 7 | test_interaction( 8 | data, 9 | alpha = 0.05, 10 | detailed_results = FALSE, 11 | q = 2, 12 | simple = FALSE 13 | ) 14 | } 15 | \arguments{ 16 | \item{data}{Simulated data set. Output of 'generate_interaction()'.} 17 | 18 | \item{alpha}{The alpha. At what p-value is the interaction deemed significant? Default is 0.05.} 19 | 20 | \item{detailed_results}{Should results beyond the linear model (change in R2, simple slopes, correlations, and confidence intervals) be returned? Default is FALSE.} 21 | 22 | \item{q}{Simple slopes. How many quantiles should x2 be split into for simple slope testing? Default is 2. 23 | Simple slope testing returns the effect-size (slope) of y~x1 for the two most extreme quantiles of x2. 24 | If q=3 then the two slopes are y~x1 for the bottom 33\% of x2, and the top 33\% of x2.} 25 | 26 | \item{simple}{For internal use. Default is FALSE.} 27 | } 28 | \value{ 29 | Either a named list or a data frame containing the results of the regression y~x1+x2+x1*x2, the pearson's correlation between y, x1,x2, and x1x2, and the slopes of the simple slopes. 30 | } 31 | \description{ 32 | Test the interaction from a single simulated data set. 33 | } 34 | \examples{ 35 | dataset <- generate_interaction(N = 250,r.x1.y = 0,r.x2.y = .1,r.x1x2.y = -.2,r.x1.x2 = .3) 36 | test_interaction(data = dataset, alpha=0.05, q=2) 37 | } 38 | -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/pkgdown/favicon/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/pkgdown/favicon/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/pkgdown/favicon/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/pkgdown/favicon/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/pkgdown/favicon/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/pkgdown/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/pkgdown/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/pkgdown/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dbaranger/InteractionPoweR/a1c6d826844a584a091a9676ddca20ae743d3aab/pkgdown/favicon/favicon.ico -------------------------------------------------------------------------------- /revdep/.gitignore: -------------------------------------------------------------------------------- 1 | checks 2 | library 3 | checks.noindex 4 | library.noindex 5 | cloud.noindex 6 | data.sqlite 7 | *.html 8 | -------------------------------------------------------------------------------- /revdep/README.md: -------------------------------------------------------------------------------- 1 | # Platform 2 | 3 | |field |value | 4 | |:--------|:----------------------------------------| 5 | |version |R version 4.2.3 (2023-03-15 ucrt) | 6 | |os |Windows 10 x64 (build 19045) | 7 | |system |x86_64, mingw32 | 8 | |ui |RStudio | 9 | |language |(EN) | 10 | |collate |English_United States.utf8 | 11 | |ctype |English_United States.utf8 | 12 | |tz |America/New_York | 13 | |date |2023-04-17 | 14 | |rstudio |2023.03.0+386 Cherry Blossom (desktop) | 15 | |pandoc |2.14.0.1 @ C:\PROGRA~1\Pandoc\pandoc.exe | 16 | 17 | # Dependencies 18 | 19 | |package |old |new |Δ | 20 | |:----------------|:---------|:---------|:--| 21 | |InteractionPoweR |0.2.0 |0.2.1 |* | 22 | |beeswarm |0.4.0 |0.4.0 | | 23 | |brio |1.1.3 |1.1.3 | | 24 | |callr |3.7.3 |3.7.3 | | 25 | |chngpt |2023.1-30 |2023.1-30 | | 26 | |cli |3.6.1 |3.6.1 | | 27 | |colorspace |2.1-0 |2.1-0 | | 28 | |cpp11 |0.4.3 |0.4.3 | | 29 | |crayon |1.5.2 |1.5.2 | | 30 | |desc |1.4.2 |1.4.2 | | 31 | |diffobj |0.3.5 |0.3.5 | | 32 | |digest |0.6.31 |0.6.31 | | 33 | |doParallel |1.0.17 |1.0.17 | | 34 | |dplyr |1.1.1 |1.1.1 | | 35 | |ellipsis |0.3.2 |0.3.2 | | 36 | |evaluate |0.20 |0.20 | | 37 | |fansi |1.0.4 |1.0.4 | | 38 | |farver |2.1.1 |2.1.1 | | 39 | |foreach |1.5.2 |1.5.2 | | 40 | |fs |1.6.1 |1.6.1 | | 41 | |generics |0.1.3 |0.1.3 | | 42 | |ggbeeswarm |0.7.1 |0.7.1 | | 43 | |ggplot2 |3.4.2 |3.4.2 | | 44 | |glue |1.6.2 |1.6.2 | | 45 | |gtable |0.3.3 |0.3.3 | | 46 | |isoband |0.2.7 |0.2.7 | | 47 | |iterators |1.0.14 |1.0.14 | | 48 | |jsonlite |1.8.4 |1.8.4 | | 49 | |kyotil |2023.2-2 |2023.2-2 | | 50 | |labeling |0.4.2 |0.4.2 | | 51 | |lifecycle |1.0.3 |1.0.3 | | 52 | |lme4 |1.1-32 |1.1-32 | | 53 | |magrittr |2.0.3 |2.0.3 | | 54 | |minqa |1.2.5 |1.2.5 | | 55 | |munsell |0.5.0 |0.5.0 | | 56 | |nloptr |2.0.3 |2.0.3 | | 57 | |pillar |1.9.0 |1.9.0 | | 58 | |pkgconfig |2.0.3 |2.0.3 | | 59 | |pkgload |1.3.2 |1.3.2 | | 60 | |polynom |1.4-1 |1.4-1 | | 61 | |praise |1.0.0 |1.0.0 | | 62 | |processx |3.8.0 |3.8.0 | | 63 | |ps |1.7.4 |1.7.4 | | 64 | |purrr |1.0.1 |1.0.1 | | 65 | |R6 |2.5.1 |2.5.1 | | 66 | |RColorBrewer |1.1-3 |1.1-3 | | 67 | |Rcpp |1.0.10 |1.0.10 | | 68 | |RcppEigen |0.3.3.9.3 |0.3.3.9.3 | | 69 | |rematch2 |2.1.2 |2.1.2 | | 70 | |RhpcBLASctl |0.23-42 |0.23-42 | | 71 | |rlang |1.1.0 |1.1.0 | | 72 | |rprojroot |2.0.3 |2.0.3 | | 73 | |scales |1.2.1 |1.2.1 | | 74 | |stringi |1.7.12 |1.7.12 | | 75 | |stringr |1.5.0 |1.5.0 | | 76 | |testthat |3.1.7 |3.1.7 | | 77 | |tibble |3.2.1 |3.2.1 | | 78 | |tidyr |1.3.0 |1.3.0 | | 79 | |tidyselect |1.2.0 |1.2.0 | | 80 | |utf8 |1.2.3 |1.2.3 | | 81 | |vctrs |0.6.1 |0.6.1 | | 82 | |vipor |0.4.5 |0.4.5 | | 83 | |viridisLite |0.4.1 |0.4.1 | | 84 | |waldo |0.4.0 |0.4.0 | | 85 | |withr |2.5.0 |2.5.0 | | 86 | 87 | # Revdeps 88 | 89 | -------------------------------------------------------------------------------- /revdep/cran.md: -------------------------------------------------------------------------------- 1 | ## revdepcheck results 2 | 3 | We checked 0 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. 4 | 5 | * We saw 0 new problems 6 | * We failed to check 0 packages 7 | 8 | -------------------------------------------------------------------------------- /revdep/email.yml: -------------------------------------------------------------------------------- 1 | release_date: ??? 2 | rel_release_date: ??? 3 | my_news_url: ??? 4 | release_version: ??? 5 | release_details: ??? 6 | -------------------------------------------------------------------------------- /revdep/failures.md: -------------------------------------------------------------------------------- 1 | *Wow, no problems at all. :)* -------------------------------------------------------------------------------- /revdep/problems.md: -------------------------------------------------------------------------------- 1 | *Wow, no problems at all. :)* -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /vignettes/articles/CommonQuestions.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Questions & Errors" 3 | author: "David AA Baranger" 4 | output: 5 | html_document: 6 | toc: true 7 | toc_depth: 2 8 | --- 9 | 10 | ```{r setup, include=FALSE} 11 | knitr::opts_chunk$set(echo = TRUE) 12 | ``` 13 | 14 | This is a non-exhaustive list of common questions and error messages: 15 | 16 | ## Questions 17 | 18 | 1. "Does this package currently support power analyses for 3-way interactions?" 19 | 20 | - Yes! See the new function `power_interaction_3way_r2()`. We do not plan on adding simulation-based power analyses for 3-way interactions. Please get in touch if you have a research question that needs that functionality. 21 | 22 | # Error messages 23 | 24 | 1. "All reliabilities must be greater than 0 and less than or equal to 1" 25 | 26 | - Reliability can't be more than 1 (measurement variance attributable to true signal can't be more than 100%), and it can't be less than or equal to 0. If your reliability measure is less than 0, it is probably spuriously low, and you should set reliability to something like 0.001. 27 | 28 | 2. "All correlations must be within [-1,1]" 29 | 30 | - The main input effect sizes are Pearson's correlations, which range from [-1,1]. If you see this error, check for typos in your input. 31 | 32 | 3. "All correlations must be within [-1,1],." or "No valid settings" 33 | 34 | - If `adjust.correlations = TRUE`, and a variable is binary or ordinal, the algorithm will increase the correlations so that the output correlations match the effects input by the user. This is necessary because transforming normal variables to be binary or ordinal reduces their correlations with the other variables. However, it can happen that this is impossible, as it would require correlations greater than \|1\|. If you encounter this error, reduce your your correlations between variables. `power_interaction()` automatically removes these settings from the input. 35 | 36 | 4. "Settings produce a negative y-variance" or "No valid settings" 37 | 38 | - It is possible to specify an impossible correlation matrix. This error indicates that $X_1$, $X_2$, and $X_1X_2$ have settings that result in them explaining more than 100% of the $Y$ variance - obviously impossible. If you encounter this error, reduce your correlations. 39 | 40 | 5. "Correlation matrix is impossible - is not positive semi-definite." 41 | 42 | - Another way that a correlation matrix can be "impossible". This error means that the smallest eigenvalue is negative. This error can be caused when correlations are too large or when variables are binary/ordinal and correlations are transformed. If you encounter this error, reduce your correlations. 43 | 44 | 6. Something else not covered... 45 | 46 | - If you get a different confusing error, first check that your packages are up to date. Most frequently this occurs with the `{dplyr}` and `{ggplot2}` packages, so make sure those are updated first (i.e., re-install them). 47 | 48 | # Strange results 49 | 50 | 1. `power_estimate()` produces `NA`. 51 | 52 | - `power_estimate()` fits a regression model to the output of `power_interaction()` to identify when a specified power-level is reached. It will give a result of `NA` for three related reasons: 53 | 54 | 1. The predicted value where power is reached is outside the range of values tested by the simulation. Simply increase the range of values tested. 55 | 56 | 2. The predicted value is within the range of values tested, but only barely. For example, say `power_target = .8`, and one simulation achieved a `pwr = 0.804`. Even though 0.804 was achieved in one round of simulations, the regression analysis may predict, based on the other values tested in the simulation, that an even larger value is needed to achieve 80% power. The solution is again to increase the range of values tested. 57 | 58 | 3. Power-curves taper-off as power increases, eventually flattening out. `power_estimate()` fits a threshold regression model using the [chngpt](https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-017-1863-x) package, to identify whether the power-curve has flattened, and to remove the flattened portion if so. This is so that the main `power_estimate()` regression model will be more accurate. However, occasionally the threshold regression model is greedy, and it removes too much. This can happen particularly if the simulation only includes a few values. The solution is again to increase the range of values tested. 59 | 60 | 2. Results differ each time I run a simulation 61 | 62 | - The examples in this package use `n.iter = 1000` simulations, as this is enough to give a general sense of the pattern of results. However, we recommend `n.iter = 10000` for more stable results. `power_estimate()` fits a regression model, and as with any regression, the number of observations, as well as their variance, impacts results. So, increasing the range and density of parameters in the simulation will also improve the stability of results. The `seed` parameter can also be set, so that identical results are given each time. However, this is not recommended until results have stabilized (by increasing `n.iter`). If `seed` is set `n.iter = 50` will yield the same results every time, but that doesn't mean those results are informative. 63 | -------------------------------------------------------------------------------- /vignettes/articles/InteractionPoweR3wayvignette.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Interaction Power: Power analyses for 3-way interactions" 3 | author: "David AA Baranger" 4 | output: 5 | html_document: 6 | toc: true 7 | toc_depth: 3 8 | description: > 9 | This article describes how to use InteractionPoweR to run power 10 | analyses for 3-way interactions. 11 | --- 12 | 13 | ```{r setup, include=FALSE} 14 | knitr::opts_chunk$set(echo = TRUE) 15 | ``` 16 | 17 | This vignette describes how to run power analyses for 3-way interactions. It assumes you are already familiar with power analyses for 2-way interactions. If you aren't, check out our [tutorial paper](https://journals.sagepub.com/doi/full/10.1177/25152459231187531) or the [main vignette](https://dbaranger.github.io/InteractionPoweR/articles/InteractionPoweRvignette.html). 18 | 19 | # Introduction 20 | 21 | Three-way interaction analyses take the form: 22 | 23 | $$ 24 | Y \sim \beta_0 + X_1\beta_1 + X_2\beta_2 + X_3\beta_3 +X_1X_2\beta_4 + X_1X_3\beta_5 +X_2X_3\beta_6 +X_1X_2X_3\beta_7 +\epsilon 25 | $$ 26 | 27 | That's a lot of effect sizes! If you think about the correlation matrix for a linear regression with 7 independent variables, that's 28 different correlations. Luckily, because of our assumptions - that everything is mean-centered and that our variables are multivariate normal, only 10 effects need to be specified. See [Urge et al.](https://doi.org/10.5539/ijsp.v5n6p73) for more on this. The user needs to specify the relation between each variable and our dependent variable $Y$ (7 effects), as well as the correlations between $X_1$, $X_2$, and $X_3$ (3 effects). All other correlations are either 0 or are fully determined by the correlations between $X_1$, $X_2$, and $X_3$. In 2-way interactions, our assumptions result in the handy outcome that the interaction term is uncorrelated with the main effects. This is **not** the case for 3-way interactions. In fact, the 3-way interaction term will nearly always be correlated with at least one of the main effects ($X_1$, $X_2$, and $X_3$) unless all of the correlations between $X_1$, $X_2$, and $X_3$ are 0. Luckily, the 3-way interaction term is uncorrelated with the 2-way interaction terms (which are all correlated with each other), so at least there's that. Even so, multicollinearity is a fact of life when you're testing 3-way interactions. 28 | 29 | As a result of the multicollinearity inherent to 3-way interactions, the correlation between $Y$ and $X_1X_2X_3$ is not a very useful metric of the interaction effect size. For example, if this correlation is small, the magnitude of the regression coefficient $\beta_7$ could very easily have the opposite sign, and still be significant. Thus, instead of the correlation, our power analysis function for 3-way interactions uses $\beta_7$ as the interaction effect that users specify. 30 | 31 | As always, users have the option of specifying the reliability of $Y$, $X_1$, $X_2$, and $X_3$. The default is 1 (perfect reliability), though that is almost guaranteed to be an unreasonable assumption in most observational research. Special thanks to StackExchange user [R Carnell](https://stats.stackexchange.com/questions/605858/reliability-of-3-way-interaction-term-between-correlated-variables) for helping with the formula for the reliability of a 3-way interaction term. 32 | 33 | ## First steps 34 | 35 | Ok, lets run a power analysis for a single regression. 36 | 37 | ```{r warning=F,error=F} 38 | 39 | library(InteractionPoweR) 40 | power.results= power_interaction_3way_r2(N = 800, # Sample size 41 | b.x1x2x3 = .05, # Interaction regression coefficient 42 | r.x1.y = .4, # Main effects 43 | r.x2.y = .3, 44 | r.x3.y = .2, 45 | r.x1x2.y = .01, # 2-way interactions 46 | r.x1x3.y = .05, 47 | r.x2x3.y = .1, 48 | r.x1.x2 = .3, # Correlation between main effects 49 | r.x1.x3 = .1, 50 | r.x2.x3 = .2) 51 | power.results 52 | ``` 53 | 54 | We see we have 40% power. 55 | 56 | ## Getting more information 57 | 58 | We can still request `detailed_results = TRUE` to get more information about the analysis: 59 | 60 | ```{r warning=F,error=F} 61 | power.results= power_interaction_3way_r2(N = 800, # Sample size 62 | b.x1x2x3 = .05, # Interaction regression coefficient 63 | r.x1.y = .4, # Main effects 64 | r.x2.y = .3, 65 | r.x3.y = .2, 66 | r.x1x2.y = .01, # 2-way interactions 67 | r.x1x3.y = .05, 68 | r.x2x3.y = .1, 69 | r.x1.x2 = .3, # Correlation between main effects 70 | r.x1.x3 = .1, 71 | r.x2.x3 = .2, 72 | detailed_results = TRUE) 73 | power.results 74 | ``` 75 | 76 | This yields a lot of information, including the observed $f^2$, the $TotalR^2$ and $NullR^2$, the correlation between all the variables (`obs.r`) and the regression slopes (`obs.b`). We have added some convenience functions to help make sense of this output. 77 | 78 | First, we can look at the correlation matrix as a data frame 79 | 80 | ```{r} 81 | cor.mat.3way(power.results = power.results) 82 | ``` 83 | 84 | Or as a plot 85 | 86 | ```{r} 87 | cor.mat.3way(power.results = power.results,return.plot = TRUE) 88 | ``` 89 | 90 | Note here that while $\beta_7$ is 0.05, the pairwise correlation between $Y$ and $X_1X_2X_3$ is 0.198. 91 | 92 | We can also look at the simple slopes as a data frame 93 | 94 | ```{r} 95 | simple.slopes.3way(power.results) 96 | ``` 97 | 98 | Or as a plot 99 | 100 | ```{r} 101 | simple.slopes.3way(power.results,return.plot = TRUE) 102 | ``` 103 | 104 | ## Running multiple analyses 105 | 106 | As always, we can run multiple power analyses at once 107 | 108 | ```{r} 109 | 110 | power.results= power_interaction_3way_r2(N = seq(800,4000,100), # Sample size 111 | b.x1x2x3 = 0.05, # Interaction regression coefficient 112 | r.x1.y = .4, # Main effects 113 | r.x2.y = .3, 114 | r.x3.y = .2, 115 | r.x1x2.y = .01, # 2-way interactions 116 | r.x1x3.y = .05, 117 | r.x2x3.y = .1, 118 | r.x1.x2 = .3, # Correlation between main effects 119 | r.x1.x3 = .1, 120 | r.x2.x3 = .2, 121 | detailed_results = TRUE) 122 | ``` 123 | 124 | And we can plot a power curve 125 | 126 | ```{r} 127 | plot_power_curve(power_data = power.results,x = "N",power_target = .9) 128 | 129 | ``` 130 | 131 | And solve for what sample size we would need to have 90% power to detect our effect. 132 | 133 | ```{r} 134 | power_estimate(power_data = power.results,x = "N",power_target = .9) 135 | ``` 136 | In this example,we would need N=2781 to achieve 90% power. 137 | 138 | Even though analytic power analyses are fast, with so many parameters we can easily reach a point where the analysis will take a long time to run. Say for instance we are interested in testing out 10 different values of 4 different parameters - that's 10,000 power analyses. At that point, it can be helpful to run things in parallel. Parallel analyses can be run using the `cl` flag. `cl=4` is probably a reasonable value for most personal computers. 139 | -------------------------------------------------------------------------------- /vignettes/articles/InteractionPower2waycovsvignette.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Interaction Power: Power analyses for 2-way interactions with covariates" 3 | author: "David AA Baranger" 4 | output: 5 | html_document: 6 | toc: true 7 | toc_depth: 3 8 | description: > 9 | This article describes how to use InteractionPoweR to run power 10 | analyses for 2-way interactions that also include covariates 11 | --- 12 | 13 | ```{r setup, include=FALSE} 14 | knitr::opts_chunk$set(echo = TRUE) 15 | ``` 16 | 17 | This vignette describes how to run power analyses for 2-way interactions that include covariates. It assumes you are already familiar with power analyses for 2-way interactions. If you aren't, check out our [tutorial paper](https://journals.sagepub.com/doi/full/10.1177/25152459231187531) or the [main vignette](https://dbaranger.github.io/InteractionPoweR/articles/InteractionPoweRvignette.html). 18 | 19 | # Introduction 20 | 21 | A two-way interaction analysis with two covariates (for example, but any number is allowable) take the form: 22 | 23 | $$ 24 | Y \sim \beta_0 + X_1\beta_1 + X_2\beta_2 + X_1X_2\beta_3+ C_1\beta_5 + C_2\beta_6 + C_1X_1\beta_7 + C_1X_2\beta_8 + C_2X_1\beta_9 + C_2X_2\beta_{10} + \epsilon 25 | $$ 26 | 27 | Where $C_i$ are the covariates, and $C_iX_i$ are interactions between the covariates and the main variables of interest. The inclusion of the $C_iX_i$ terms may surprise some users. However, it is well established that failure to include them can lead to false-positive results, because of omitted variable bias. This can occur not only when $C_iX_i$ is independent predictor of $Y$, but also simply when $cor(X_i,C_i)$ is non-zero (i.e., when a covariate is correlated with either of the main interaction terms). A few relevant citations: [Hull et al., 1992](https://doi.org/10.1177/0146167292182001), [Yzerbyt et al., 2004](https://doi.org/10.1016/j.jesp.2003.10.001), [Keller, 2014](https://doi.org/10.1016%2Fj.biopsych.2013.09.006), and blogs: [Baranger](https://davidbaranger.com/2020/05/26/interaction-analyses-appropriately-adjusting-for-control-variables-part-4/), and [Simonsohn](https://datacolada.org/80). 28 | 29 | ## Running an analysis 30 | 31 | First, the function `generate.interaction.cov.input()` is used to setup the input correlations for the power analysis. The only input is the number of covariates. This generates a named list. All correlations are by default `0` and all reliabilites are `1`. 32 | 33 | ```{r warning=F,error=F} 34 | 35 | library(InteractionPoweR) 36 | power.input = generate.interaction.cov.input(c.num = 2) # number of covariates 37 | head(power.input$correlations) 38 | head(power.input$reliability) 39 | 40 | ``` 41 | Modify the list as-needed for your own power analysis: 42 | 43 | ```{r warning=F,error=F} 44 | power.input$correlations$r.y.x1 = .3 45 | power.input$correlations$r.y.x2 = .2 46 | power.input$correlations$r.y.c1 = .1 47 | power.input$correlations$r.y.c2 = .2 48 | power.input$correlations$r.y.x1x2 = seq(0.01,.1,.01) # inputs can be single values or vectors 49 | power.input$correlations$r.x1.x2 = .2 50 | power.input$correlations$r.c1.c2 = .3 51 | power.input$correlations$r.x1.c1 = .1 52 | power.input$correlations$r.x2.c1 = .1 53 | ``` 54 | 55 | Now we run the power analysis with the `power_interaction_r2_covs()` function: 56 | 57 | ```{r warning=F,error=F} 58 | pwr.analysis = power_interaction_r2_covs(cov.input =power.input, # our parameters 59 | N = c(1000) 60 | ) 61 | pwr.analysis 62 | ``` 63 | 64 | As always, we can plot the power curve: 65 | 66 | ```{r warning=F,error=F} 67 | plot_power_curve(power_data = pwr.analysis,x = "r.y.x1x2") 68 | ``` 69 | 70 | And we can estimate where the power curve intersects some desired level of power: 71 | 72 | ```{r warning=F,error=F} 73 | power_estimate(power_data = pwr.analysis,x = "r.y.x1x2",power_target = 0.8) 74 | ``` 75 | 76 | Even though analytic power analyses are fast, with so many parameters we can easily reach a point where the analysis will take a long time to run. Say for instance we are interested in testing out 10 different values of 4 different parameters - that's 10,000 power analyses. At that point, it can be helpful to run things in parallel. Parallel analyses can be run using the `cl` flag. `cl=4` is probably a reasonable value for most personal computers. 77 | --------------------------------------------------------------------------------