├── .gitignore ├── 0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs.Rmd ├── 0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs.docx ├── 0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs.pdf ├── 0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs.tex ├── 0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files ├── figure-docx │ ├── d-plot-1.pdf │ ├── d-plot-1.png │ ├── eta-plot-1.pdf │ ├── eta-plot-1.png │ ├── mean-plot-1.pdf │ ├── mean-plot-1.png │ ├── mean-plot2-1.pdf │ ├── mean-plot2-1.png │ ├── p-plot-1.pdf │ ├── p-plot-1.png │ ├── power-plot-1.pdf │ ├── power-plot-1.png │ ├── sim-3-1.pdf │ ├── sim-3-1.png │ ├── sim-3-2.pdf │ ├── sim-3-2.png │ ├── sim-4-1.pdf │ ├── sim-4-1.png │ ├── sim-holm-1.pdf │ ├── sim-holm-1.png │ ├── sim-interaction-2-1.pdf │ └── sim-interaction-2-1.png └── figure-latex │ ├── d-plot-1.pdf │ ├── d-plot-1.png │ ├── eta-plot-1.pdf │ ├── eta-plot-1.png │ ├── mean-plot-1.pdf │ ├── mean-plot-1.png │ ├── mean-plot-2.pdf │ ├── mean-plot-2.png │ ├── mean-plot-3.pdf │ ├── mean-plot-3.png │ ├── mean-plot-4.pdf │ ├── mean-plot-4.png │ ├── mean-plot-5.pdf │ ├── mean-plot-5.png │ ├── mean-plot2-1.pdf │ ├── mean-plot2-1.png │ ├── p-plot-1.pdf │ ├── p-plot-1.png │ ├── power-plot-1.pdf │ ├── power-plot-1.png │ ├── sim-3-1.pdf │ ├── sim-3-1.png │ ├── sim-3-2.pdf │ ├── sim-3-2.png │ ├── sim-4-1.pdf │ ├── sim-4-1.png │ ├── sim-holm-1.pdf │ ├── sim-holm-1.png │ ├── sim-interaction-2-1.pdf │ └── sim-interaction-2-1.png ├── 0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_old.pdf ├── ANOVA_design.R ├── ANOVA_power.R ├── ANOVA_power_manova_temp.R ├── ANOVA_power_simulation.R ├── ANOVA_power_simulation.Rproj ├── Appendix ├── 2019_set_seed.PNG ├── ANOVApowerInput.PNG ├── DataEntry.PNG ├── DataEntry2.PNG ├── DataEntry3.PNG ├── DesignInput1_3b1Sim.PNG ├── DesignInput2_3b1Sim.PNG ├── DesignInput_2bSim.PNG ├── DesignInput_3wSim.PNG ├── DesignInput_Inter1Sim.PNG ├── DesignOutput_2bSim.PNG ├── DesignOutput_3b1Sim.PNG ├── DesignOutput_3wSim.PNG ├── DesignOutput_Inter1Sim.PNG ├── DownloadReport.PNG ├── FactorLabels_2bSim.PNG ├── Means_2bSim.PNG ├── Num_Simulations.PNG ├── PowerInput_2bSim.PNG ├── PowerInput_3b1Sim.PNG ├── Report_2bSim.pdf ├── Report_3b1Sim.pdf ├── Report_3wSim.pdf ├── Report_Inter1.pdf ├── Report_Inter2.pdf ├── Report_Multi.pdf ├── SetSimulationSeed_default.PNG ├── SimInput_3w.PNG ├── SimInput_Multi.PNG ├── SimResult_2bSim.PNG ├── SimResult_3b1Sim.PNG ├── SimResult_3wSim.PNG ├── SimResult_Inter1Sim.PNG ├── SimResult_Inter2Sim.PNG ├── SimResult_MultiSim.PNG ├── SizeSDCorr_2bSim.PNG └── TestOutput.PNG ├── Appendix_R_Functions.Rmd ├── Appendix_R_Functions.html ├── Appendix_R_Functions.pdf ├── Appendix_Shiny_App.Rmd ├── Appendix_Shiny_App.html ├── Appendix_Shiny_App.log ├── Appendix_Shiny_App.pdf ├── Appendix_Shiny_App.tex ├── LICENSE ├── README.Rmd ├── README.md ├── README_files ├── figure-gfm │ ├── mean-plot-1.png │ ├── sim-interaction-2-1.png │ ├── sim-interaction-3-1.png │ ├── sim-interaction-3-2.png │ ├── unnamed-chunk-1-1.png │ ├── unnamed-chunk-11-1.png │ ├── unnamed-chunk-12-1.png │ ├── unnamed-chunk-18-1.png │ ├── unnamed-chunk-19-1.png │ ├── unnamed-chunk-21-1.png │ ├── unnamed-chunk-25-1.png │ ├── unnamed-chunk-27-1.png │ ├── unnamed-chunk-28-1.png │ ├── unnamed-chunk-31-1.png │ ├── unnamed-chunk-4-1.png │ ├── unnamed-chunk-6-1.png │ ├── unnamed-chunk-7-1.png │ └── unnamed-chunk-8-1.png └── figure-markdown_github │ ├── unnamed-chunk-2-1.png │ ├── unnamed-chunk-2-2.png │ ├── unnamed-chunk-3-1.png │ ├── unnamed-chunk-3-2.png │ └── unnamed-chunk-4-1.png ├── TEST3WAY.R ├── anova_power.bib ├── calc_f_d_eta.R ├── check_effect_size.R ├── conf_limits_nct.R ├── d_to_dz.R ├── dz_to_d.R ├── effect_size_d_independent_function.R ├── effect_size_d_paired_function.R ├── helper_functions ├── calc_error_rate.R ├── cor_mat_examples.xlsx ├── f_to_eta.R ├── loop_over_variables.R ├── plot_power_2x2_within.R ├── plot_power_oneway_between.R ├── plot_power_oneway_within.R ├── plot_power_twoway_between.R ├── power_2x2_within.R ├── power_oneway_between.R ├── power_oneway_within.R ├── power_threeway_between.R └── power_twoway_between.R ├── mu_from_ES.R ├── p_d_ttest.R ├── power_for_interactions.Rmd ├── program_temp_file.R ├── render_validation_files.R ├── screenshots ├── 3x6_correlation_matrix.png ├── PS2000.png ├── gpower_1.png ├── gpower_10.png ├── gpower_11.png ├── gpower_12.png ├── gpower_13.png ├── gpower_14.png ├── gpower_15.png ├── gpower_2.png ├── gpower_3.png ├── gpower_4.png ├── gpower_5.png ├── gpower_6.png ├── gpower_7.png ├── gpower_8.png ├── gpower_9.png ├── maturing.svg └── orcid.png ├── shiny_app ├── app.R └── report.Rmd ├── to_do.R ├── try_out single test.R └── validation_files ├── 1.1_validation_power_between_1x2.Rmd ├── 1.1_validation_power_between_1x2.md ├── 1.1_validation_power_between_1x2.pdf ├── 1.1_validation_power_between_1x2.tex ├── 1.2_validation_power_between_1x3.Rmd ├── 1.2_validation_power_between_1x3.md ├── 1.2_validation_power_between_1x3.pdf ├── 1.2_validation_power_between_1x3.tex ├── 1.3_validation_power_between_Brysbaert_1x3.Rmd ├── 1.3_validation_power_between_Brysbaert_1x3.md ├── 1.3_validation_power_between_Brysbaert_1x3.pdf ├── 1.3_validation_power_between_Brysbaert_1x3.tex ├── 1.3_validation_power_between_Brysbaert_1x3_files ├── figure-gfm │ ├── unnamed-chunk-10-1.png │ ├── unnamed-chunk-4-1.png │ └── unnamed-chunk-7-1.png └── figure-latex │ └── unnamed-chunk-4-1.pdf ├── 2.1_validation_power_within_2x1.Rmd ├── 2.1_validation_power_within_2x1.md ├── 2.1_validation_power_within_2x1.pdf ├── 2.1_validation_power_within_2x1.tex ├── 2.2_validation_power_within_3x1.Rmd ├── 2.2_validation_power_within_3x1.md ├── 2.2_validation_power_within_3x1.pdf ├── 2.2_validation_power_within_3x1.tex ├── 2.3_validation_power_within_Brysbaert_3x1.Rmd ├── 2.3_validation_power_within_Brysbaert_3x1.md ├── 2.3_validation_power_within_Brysbaert_3x1.pdf ├── 3.1_validation_power_between_within_2x2.Rmd ├── 3.1_validation_power_between_within_2x2.md ├── 3.1_validation_power_between_within_2x2.pdf ├── 3.1_validation_power_between_within_2x2.tex ├── 3.2_validation_power_within_within_2x2_Amsel.Rmd ├── 3.2_validation_power_within_within_2x2_Amsel.md ├── 3.3_validation_power_within_within_3x6.Rmd ├── 3.3_validation_power_within_within_Provin_Schutz_Not_Complete.Rmd ├── 3.3_validation_power_within_within_Provin_Schutz_Not_Complete.md ├── 4.1_error_control_in_exploratory_ANOVA.Rmd ├── 4.1_error_control_in_exploratory_ANOVA.md ├── 4.1_error_control_in_exploratory_ANOVA.tex ├── 4.1_error_control_in_exploratory_ANOVA_files └── figure-latex │ └── unnamed-chunk-1-1.pdf ├── 4.2_power_for_interactions.Rmd ├── 4.2_power_for_interactions.pdf ├── 4.2_power_for_interactions.tex ├── 4.3_analytic_power_functions.Rmd ├── 4.3_analytic_power_functions.md ├── 4.3_analytic_power_functions.pdf ├── 4.3_analytic_power_functions_files └── figure-latex │ ├── unnamed-chunk-1-1.pdf │ ├── unnamed-chunk-10-1.pdf │ ├── unnamed-chunk-5-1.pdf │ └── unnamed-chunk-8-1.pdf ├── 4.4_power_curves_2x2_within.Rmd ├── 4.4_power_curves_2x2_within.md ├── 4.4_power_curves_2x2_within.tex ├── 4.4_power_curves_2x2_within_files └── figure-latex │ └── unnamed-chunk-2-1.pdf ├── 4.5_power_for_design_variations.Rmd ├── 4.5_power_for_design_variations.md ├── 4.5_power_for_design_variations.pdf ├── 4.5_power_for_design_variations.tex ├── 4.6_threeway_interactions.Rmd ├── 4.6_threeway_interactions.md ├── 4.6_threeway_interactions.pdf ├── 4.6_threeway_interactions.tex ├── 4.6_threeway_interactions_files └── figure-markdown_github │ ├── unnamed-chunk-1-1.png │ ├── unnamed-chunk-3-1.png │ ├── unnamed-chunk-4-1.png │ └── unnamed-chunk-5-1.png ├── 4.7_f_in_threeway_interactions.Rmd ├── 5.1_tutorial_entering_correlation_matrix.Rmd ├── 6.1_educational_stuff.Rmd ├── 6.1_educational_stuff.md ├── 6.1_educational_stuff_files └── figure-markdown_github │ ├── unnamed-chunk-1-1.png │ └── unnamed-chunk-5-1.png ├── Validation.Rmd ├── Validation.md ├── Validation_files └── figure-markdown_github │ ├── unnamed-chunk-10-1.png │ ├── unnamed-chunk-3-1.png │ ├── unnamed-chunk-4-1.png │ └── unnamed-chunk-7-1.png ├── comments_Aaron.R ├── conversion_SPSS_partial_eta.pdf ├── final_pdf ├── 1.1_validation_power_between_1x2.pdf ├── 1.2_validation_power_between_1x3.pdf ├── 1.3_validation_power_between_Brysbaert_1x3.pdf ├── 2.1_validation_power_within_2x1.pdf ├── 2.2_validation_power_within_3x1.pdf ├── 2.3_validation_power_within_Brysbaert_3x1.pdf ├── 3.1_validation_power_between_within_2x2.pdf ├── 3.2_validation_power_within_within_2x2_Amsel.pdf ├── 3.3_validation_power_within_within_Provin_Schutz_Not_Complete.pdf ├── 4.1_error_control_in_exploratory_ANOVA.pdf ├── 4.3_analytic_power_functions.pdf └── 4.4_power_curves_2x2_within.pdf ├── power_code_brysbaert ├── Power ANCOVA Bayesian pre-post design.R ├── Power ANCOVA pre-post design.R ├── Power ANOVA 2x2 related groups.R ├── Power ANOVA 2x2 split-plot design.R ├── Power ANOVA three related groups.R ├── Power ANOVA three unrelated groups.R ├── Power Toster analysis correlation.R ├── Power Toster analysis related samples.R ├── Power Toster analysis unrelated samples.R ├── Power correlation test.R ├── Power t test related samples.R └── Power t test unrelated samples.R ├── pwr2ppl ├── DESCRIPTION ├── NAMESPACE ├── R │ ├── Chi2x2.R │ ├── Chi2x3.R │ ├── ChiES.R │ ├── ChiGOF.R │ ├── LRcat.R │ ├── LRcont.R │ ├── MANOVA1f.R │ ├── MRC.R │ ├── MRC_all.R │ ├── MRC_short2.R │ ├── MRC_shortcuts.R │ ├── R2_prec.R │ ├── R2ch.R │ ├── anc.R │ ├── anova1f_3.R │ ├── anova1f_3c.R │ ├── anova1f_4.R │ ├── anova1f_4c.R │ ├── anova2x2.R │ ├── anova2x2_se.R │ ├── corr.R │ ├── d_prec.R │ ├── depb.R │ ├── depcorr0.R │ ├── depcorr1.R │ ├── indR2.R │ ├── indb.R │ ├── indcorr.R │ ├── indt.R │ ├── lmm1F.R │ ├── lmm1Ftrends.R │ ├── lmm1w1b.R │ ├── lmm2F.R │ ├── lmm2Fse.R │ ├── md_precision.R │ ├── med.R │ ├── pairt.R │ ├── prop1.R │ ├── propind.R │ ├── r_prec.R │ ├── regint.R │ ├── regintR2.R │ ├── tfromd.R │ ├── win1F.R │ ├── win1Ftrends.R │ ├── win1bg1.R │ ├── win2F.R │ └── win2Fse.R ├── README.md ├── man │ ├── Chi2X3.Rd │ ├── Chi2x2.Rd │ ├── ChiES.Rd │ ├── ChiGOF.Rd │ ├── LRcat.Rd │ ├── LRcont.Rd │ ├── MANOVA1f.Rd │ ├── MRC.Rd │ ├── MRC_all.Rd │ ├── MRC_short2.Rd │ ├── R2_prec.Rd │ ├── R2ch.Rd │ ├── anc.Rd │ ├── anova1f_3.Rd │ ├── anova1f_3c.Rd │ ├── anova1f_4.Rd │ ├── anova1f_4c.Rd │ ├── anova2x2.Rd │ ├── anova2x2_se.Rd │ ├── corr.Rd │ ├── d_prec.Rd │ ├── depb.Rd │ ├── depcorr0.Rd │ ├── depcorr1.Rd │ ├── hello.Rd │ ├── indR2.Rd │ ├── indb.Rd │ ├── indcorr.Rd │ ├── indt.Rd │ ├── lmm1F.Rd │ ├── lmm1Ftrends.Rd │ ├── lmm1w1b.Rd │ ├── lmm2F.Rd │ ├── lmm2Fse.Rd │ ├── md_prec.Rd │ ├── med.Rd │ ├── mrc_shortcuts.Rd │ ├── packrat │ │ ├── init.R │ │ ├── packrat.lock │ │ └── packrat.opts │ ├── pairt.Rd │ ├── prop1.Rd │ ├── propind.Rd │ ├── r_prec.Rd │ ├── regint.Rd │ ├── regintR2.Rd │ ├── tfromd.Rd │ ├── win1F.Rd │ ├── win1Ftrends.Rd │ ├── win1bg1.Rd │ ├── win2F.Rd │ └── win2Fse.Rd ├── pwr2ppl.Rproj └── pwr2ppl_0.1.0.tar.gz ├── screenshots ├── 3x6_correlation_matrix.png ├── PS2000.png ├── gpower_1.png ├── gpower_10.png ├── gpower_11.png ├── gpower_12.png ├── gpower_13.png ├── gpower_14.png ├── gpower_15.png ├── gpower_2.png ├── gpower_3.png ├── gpower_4.png ├── gpower_5.png ├── gpower_6.png ├── gpower_7.png ├── gpower_8.png └── gpower_9.png ├── transforming_effect_sizes.R ├── try_out_variable_cors.R ├── validation_calc_f_d_eta.Rmd ├── validation_calc_f_d_eta.md ├── validation_effect_sizes_between.Rmd ├── validation_effect_sizes_between.md ├── validation_effect_sizes_between_files └── figure-markdown_github │ ├── unnamed-chunk-4-1.png │ ├── unnamed-chunk-6-1.png │ └── unnamed-chunk-8-1.png ├── validation_mlm.R ├── validation_power_between.Rmd ├── validation_power_between.md ├── validation_power_between_files └── figure-markdown_github │ ├── unnamed-chunk-4-1.png │ ├── unnamed-chunk-6-1.png │ ├── unnamed-chunk-8-1.png │ └── unnamed-chunk-9-1.png ├── validation_power_between_within.Rmd ├── validation_power_between_within.md ├── validation_power_between_within_files └── figure-markdown_github │ ├── unnamed-chunk-2-1.png │ └── unnamed-chunk-3-1.png ├── validation_power_within.md ├── validation_power_within_Brysbaert.Rmd ├── validation_power_within_Brysbaert.md ├── validation_power_within_Brysbaert_files └── figure-markdown_github │ ├── unnamed-chunk-4-1.png │ └── unnamed-chunk-8-1.png └── validation_power_within_files └── figure-markdown_github ├── gpower_1.png └── unnamed-chunk-4-1.png /.gitignore: -------------------------------------------------------------------------------- 1 | .Rhistory 2 | .RData 3 | .Ruserdata 4 | .httr-oauth 5 | Other/** 6 | .Rproj.user 7 | sim_data 8 | -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs.docx -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/d-plot-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/d-plot-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/d-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/d-plot-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/eta-plot-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/eta-plot-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/eta-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/eta-plot-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/mean-plot-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/mean-plot-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/mean-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/mean-plot-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/mean-plot2-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/mean-plot2-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/mean-plot2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/mean-plot2-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/p-plot-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/p-plot-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/p-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/p-plot-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/power-plot-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/power-plot-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/power-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/power-plot-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-3-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-3-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-3-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-3-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-3-2.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-3-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-3-2.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-4-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-4-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-4-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-holm-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-holm-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-holm-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-holm-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-interaction-2-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-interaction-2-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-interaction-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-docx/sim-interaction-2-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/d-plot-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/d-plot-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/d-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/d-plot-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/eta-plot-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/eta-plot-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/eta-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/eta-plot-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-2.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-2.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-3.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-3.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-4.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-4.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-5.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot-5.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot2-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot2-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/mean-plot2-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/p-plot-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/p-plot-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/p-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/p-plot-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/power-plot-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/power-plot-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/power-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/power-plot-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-3-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-3-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-3-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-3-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-3-2.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-3-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-3-2.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-4-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-4-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-4-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-holm-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-holm-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-holm-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-holm-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-interaction-2-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-interaction-2-1.pdf -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-interaction-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_files/figure-latex/sim-interaction-2-1.png -------------------------------------------------------------------------------- /0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_old.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/0.1_Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs_old.pdf -------------------------------------------------------------------------------- /ANOVA_power_simulation.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 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 | -------------------------------------------------------------------------------- /Appendix/2019_set_seed.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/2019_set_seed.PNG -------------------------------------------------------------------------------- /Appendix/ANOVApowerInput.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/ANOVApowerInput.PNG -------------------------------------------------------------------------------- /Appendix/DataEntry.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DataEntry.PNG -------------------------------------------------------------------------------- /Appendix/DataEntry2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DataEntry2.PNG -------------------------------------------------------------------------------- /Appendix/DataEntry3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DataEntry3.PNG -------------------------------------------------------------------------------- /Appendix/DesignInput1_3b1Sim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DesignInput1_3b1Sim.PNG -------------------------------------------------------------------------------- /Appendix/DesignInput2_3b1Sim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DesignInput2_3b1Sim.PNG -------------------------------------------------------------------------------- /Appendix/DesignInput_2bSim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DesignInput_2bSim.PNG -------------------------------------------------------------------------------- /Appendix/DesignInput_3wSim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DesignInput_3wSim.PNG -------------------------------------------------------------------------------- /Appendix/DesignInput_Inter1Sim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DesignInput_Inter1Sim.PNG -------------------------------------------------------------------------------- /Appendix/DesignOutput_2bSim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DesignOutput_2bSim.PNG -------------------------------------------------------------------------------- /Appendix/DesignOutput_3b1Sim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DesignOutput_3b1Sim.PNG -------------------------------------------------------------------------------- /Appendix/DesignOutput_3wSim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DesignOutput_3wSim.PNG -------------------------------------------------------------------------------- /Appendix/DesignOutput_Inter1Sim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DesignOutput_Inter1Sim.PNG -------------------------------------------------------------------------------- /Appendix/DownloadReport.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/DownloadReport.PNG -------------------------------------------------------------------------------- /Appendix/FactorLabels_2bSim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/FactorLabels_2bSim.PNG -------------------------------------------------------------------------------- /Appendix/Means_2bSim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/Means_2bSim.PNG -------------------------------------------------------------------------------- /Appendix/Num_Simulations.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/Num_Simulations.PNG -------------------------------------------------------------------------------- /Appendix/PowerInput_2bSim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/PowerInput_2bSim.PNG -------------------------------------------------------------------------------- /Appendix/PowerInput_3b1Sim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/PowerInput_3b1Sim.PNG -------------------------------------------------------------------------------- /Appendix/Report_2bSim.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/Report_2bSim.pdf -------------------------------------------------------------------------------- /Appendix/Report_3b1Sim.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/Report_3b1Sim.pdf -------------------------------------------------------------------------------- /Appendix/Report_3wSim.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/Report_3wSim.pdf -------------------------------------------------------------------------------- /Appendix/Report_Inter1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/Report_Inter1.pdf -------------------------------------------------------------------------------- /Appendix/Report_Inter2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/Report_Inter2.pdf -------------------------------------------------------------------------------- /Appendix/Report_Multi.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/Report_Multi.pdf -------------------------------------------------------------------------------- /Appendix/SetSimulationSeed_default.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/SetSimulationSeed_default.PNG -------------------------------------------------------------------------------- /Appendix/SimInput_3w.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/SimInput_3w.PNG -------------------------------------------------------------------------------- /Appendix/SimInput_Multi.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/SimInput_Multi.PNG -------------------------------------------------------------------------------- /Appendix/SimResult_2bSim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/SimResult_2bSim.PNG -------------------------------------------------------------------------------- /Appendix/SimResult_3b1Sim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/SimResult_3b1Sim.PNG -------------------------------------------------------------------------------- /Appendix/SimResult_3wSim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/SimResult_3wSim.PNG -------------------------------------------------------------------------------- /Appendix/SimResult_Inter1Sim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/SimResult_Inter1Sim.PNG -------------------------------------------------------------------------------- /Appendix/SimResult_Inter2Sim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/SimResult_Inter2Sim.PNG -------------------------------------------------------------------------------- /Appendix/SimResult_MultiSim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/SimResult_MultiSim.PNG -------------------------------------------------------------------------------- /Appendix/SizeSDCorr_2bSim.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/SizeSDCorr_2bSim.PNG -------------------------------------------------------------------------------- /Appendix/TestOutput.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix/TestOutput.PNG -------------------------------------------------------------------------------- /Appendix_R_Functions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix_R_Functions.pdf -------------------------------------------------------------------------------- /Appendix_Shiny_App.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/Appendix_Shiny_App.pdf -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | ```{r setup, include=FALSE} 6 | knitr::opts_chunk$set(echo = TRUE) 7 | ``` 8 | 9 | # This project is depracated 10 | 11 | The alpha version of ANOVApower has been transformed into Superpower together with Aaron Caldwell. The new GitHub repository is at: https://github.com/arcaldwell49/Superpower. 12 | An extensive manual for Superpower can be found at: https://aaroncaldwell.us/SuperpowerBook/. 13 | ANOVApower will not be updated. All future development will happen at the SUperpower site. 14 | 15 | The manuscript introducing Superpower can now be found at: https://github.com/Lakens/Simulation_Based_Power_Analysis_For_Factorial_ANOVA_Designs -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # This project is depracated 3 | 4 | The alpha version of ANOVApower has been transformed into Superpower 5 | together with Aaron Caldwell. The new GitHub repository is at: 6 | . An extensive manual for 7 | Superpower can be found at: . 8 | ANOVApower will not be updated. All future development will happen at 9 | the SUperpower site. 10 | 11 | The manuscript introducing Superpower can now be found at: 12 | 13 | -------------------------------------------------------------------------------- /README_files/figure-gfm/mean-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/mean-plot-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/sim-interaction-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/sim-interaction-2-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/sim-interaction-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/sim-interaction-3-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/sim-interaction-3-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/sim-interaction-3-2.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-1-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-11-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-11-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-12-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-18-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-18-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-19-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-19-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-21-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-21-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-25-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-25-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-27-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-27-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-28-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-28-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-31-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-31-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /README_files/figure-gfm/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-gfm/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /README_files/figure-markdown_github/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-markdown_github/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /README_files/figure-markdown_github/unnamed-chunk-2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-markdown_github/unnamed-chunk-2-2.png -------------------------------------------------------------------------------- /README_files/figure-markdown_github/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-markdown_github/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /README_files/figure-markdown_github/unnamed-chunk-3-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-markdown_github/unnamed-chunk-3-2.png -------------------------------------------------------------------------------- /README_files/figure-markdown_github/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/README_files/figure-markdown_github/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /calc_f_d_eta.R: -------------------------------------------------------------------------------- 1 | #This function allows you to calculate f, d and eta squared following Cohen, 1988, p 277 2 | # From Cohen, 1988, p 277 3 | # The patterns are: 4 | # I. Minimum variability: one mean at each end of d, the remaining k- 2 means all at the midpoint. 5 | # 2. Intermediate variability: the k means equally spaced over d. 6 | # 3. Maximum variability: the means all at the end points of d. 7 | 8 | # For each of these patterns, there is a fixed relationship between f and d for any given number of means, k. 9 | 10 | # Pattern 1. For any given range of means, d, the minimum standard 11 | # deviation, f1, results when the remaining k - 2 means are concentrated at 12 | # the mean of the means (0 when expressed in standard units), i.e., half-way 13 | # between the largest and smallest. 14 | # 15 | # Pattern 2. A pattern of medium variability results when the k means 16 | # are equally spaced over the range, and therefore at intervals of d/(k- 1). 17 | # 18 | # Pattern 3. It is demonstrable and intuitively evident that for any given 19 | # range the dispersion which yield~ the maximum standard deviation has the 20 | # k means falling at both extremes of the range. When k is even, !k fall at 21 | # - !d and the other !k fall at + !d; when k is odd, (k + I )/2 of the means 22 | # fall at either end and the (k- 1)/2 remaining means at the other. With this 23 | # pattern, for all even numbers of means, use formula (8.2.12). 24 | # When k is odd, and there is thus one more mean at one extreme than at 25 | # the other, use formula (8.2.13). 26 | 27 | calc_f_d_eta <- function(mu, sd, variability){ 28 | if(variability == "minimum"){ 29 | k = length(mu) 30 | d <- (max(mu)-min(mu))/sd 31 | f <- d*sqrt(1/(2*k)) 32 | f2 <- f^2 33 | ES <- f2/(f2+1) 34 | } 35 | if(variability == "medium"){ 36 | k = length(mu) 37 | d <- (max(mu)-min(mu))/sd 38 | f <- (d/2)*sqrt((k+1)/(3*(k-1))) 39 | f2 <- f^2 40 | ES <- f2/(f2+1) 41 | } 42 | if(variability == "maximum"){ 43 | k = length(mu) 44 | d <- (max(mu)-min(mu))/sd 45 | f <- ifelse(k %% 2 == 0, .5*d, d*(sqrt(k^2-1)/(2*k))) 46 | f2 <- f^2 47 | ES <- f2/(f2+1) 48 | } 49 | invisible(list(mu = mu, 50 | sd = sd, 51 | d = d, 52 | f = f, 53 | f2 = f2, 54 | ES = ES)) 55 | } -------------------------------------------------------------------------------- /check_effect_size.R: -------------------------------------------------------------------------------- 1 | library(mvtnorm) 2 | library(afex) 3 | library(emmeans) 4 | library(ggplot2) 5 | library(gridExtra) 6 | library(reshape2) 7 | 8 | source("ANOVA_design.R") 9 | source("ANOVA_power.R") 10 | 11 | 12 | #simply repeated effect 13 | design_result <- ANOVA_design(string = "2w", 14 | n = 80, 15 | mu = c(1, 1.4), 16 | sd = 1, 17 | r=0.9, 18 | p_adjust = "none", 19 | labelnames = c("age", "old", "young")) 20 | 21 | simulation_result <- ANOVA_power(design_result, alpha = 0.05, nsims = 500) 22 | 23 | #This should return a Cohen's dz of 0.9844. 24 | 25 | #same design, now between effect 26 | design_result <- ANOVA_design(string = "2b", 27 | n = 80, 28 | mu = c(1, 1.4), 29 | sd = 1, 30 | r=0.9, 31 | p_adjust = "none", 32 | labelnames = c("age", "old", "young")) 33 | 34 | simulation_result <- ANOVA_power(design_result, alpha = 0.05, nsims = 500) 35 | 36 | #This should return a Cohen's d of 0.4. 37 | 38 | #now again within effect, but r = 0.5 39 | design_result <- ANOVA_design(string = "2w", 40 | n = 80, 41 | mu = c(1, 1.4), 42 | sd = 1, 43 | r=0.5, 44 | p_adjust = "none", 45 | labelnames = c("age", "old", "young")) 46 | 47 | simulation_result <- ANOVA_power(design_result, alpha = 0.05, nsims = 500) 48 | 49 | #This should return a Cohen's dz of 0.4 (because the r = 0.5, same as between) -------------------------------------------------------------------------------- /d_to_dz.R: -------------------------------------------------------------------------------- 1 | #This function allows you to compute d from dz (Morris & DeShon, 2002) 2 | 3 | d_to_dz <- function(d, r){ 4 | dz <- d/(sqrt(2*(1-r))) 5 | invisible(list(d = d, 6 | r = r, 7 | dz = dz)) 8 | } -------------------------------------------------------------------------------- /dz_to_d.R: -------------------------------------------------------------------------------- 1 | #This function allows you to compute dz from d (Morris & DeShon, 2002) 2 | 3 | dz_to_d <- function(dz, r){ 4 | d <- dz * sqrt(2*(1-r)) 5 | invisible(list(d = d, 6 | r = r, 7 | dz = dz)) 8 | } -------------------------------------------------------------------------------- /helper_functions/calc_error_rate.R: -------------------------------------------------------------------------------- 1 | calc_error_rate_main <- function(power_result, alpha_level=0.05){ 2 | sum(apply(as.matrix(power_result$sim_data[(1:length(power_result$main_results$power))]), 1, 3 | function(x) round(mean(ifelse(x < alpha_level, 1, 0)),4)) > 0)/power_result$nsims*100 4 | } 5 | 6 | calc_error_rate_pc <- function(power_result, alpha_level=0.05){ 7 | sum(apply(as.matrix(power_result$sim_data[(2*length(power_result$main_results$power)+1:length(power_result$pc_results$power))]), 1, 8 | function(x) round(mean(ifelse(x < alpha_level, 1, 0)),4)) > 0)/power_result$nsims*100 9 | } 10 | 11 | 12 | xxxx <- as.matrix(power_result$sim_data[(2*length(power_result$main_results$power)+1:length(power_result$pc_results$power))]) 13 | -------------------------------------------------------------------------------- /helper_functions/cor_mat_examples.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/helper_functions/cor_mat_examples.xlsx -------------------------------------------------------------------------------- /helper_functions/f_to_eta.R: -------------------------------------------------------------------------------- 1 | # I. Minimum variability: one mean at each end of d, the remaining k- 2 means all at the midpoint 2 | mu = c(2, 0, 0, -2) # population means 3 | sd = 1 #population standard deviations 4 | k = length(mu) 5 | d <- (max(mu)-min(mu))/sd 6 | f <- .5*d 7 | f2 <- f^2 8 | ES <- f2/(f2+1) 9 | ES 10 | 11 | 12 | # 2. A pattern of medium variability results when the k means are equally spaced over the range, and therefore at intervals of d/(k- 1) 13 | mu = c(6, 2, -2, -6) # population means 14 | sd = 1 #population standard deviations 15 | k = length(mu) 16 | d <- (max(mu)-min(mu))/sd 17 | f <- (d/2)*sqrt((k+1)/(3*(k-1))) 18 | f2 <- f^2 19 | ES <- f2/(f2+1) 20 | ES 21 | 22 | 23 | 24 | # 3. Maximum variability: the means all at the end points of d 25 | mu = c(-1, -1, 1, 1) # population means 26 | sd = 1 #population standard deviations 27 | k = length(mu) 28 | d <- (max(mu)-min(mu))/sd 29 | f <- ifelse(k %% 2 == 0, .5*d, d*(sqrt(k^2-1)/(2*k))) 30 | f2 <- f^2 31 | ES <- f2/(f2+1) 32 | ES 33 | 34 | -------------------------------------------------------------------------------- /helper_functions/loop_over_variables.R: -------------------------------------------------------------------------------- 1 | # Install the two functions from GitHub by running the code below: 2 | 3 | source("https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/master/ANOVA_design.R") 4 | source("https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/master/ANOVA_power.R") 5 | 6 | 7 | 8 | 9 | repeat_sim <- function(x){ANOVA_power(ANOVA_design(string = "2b*2w", 10 | n = x, 11 | mu = c(1.03, 1.21, 0.98, 1.01), 12 | sd = 1.03, 13 | r=0.87, 14 | p_adjust = "none"), 15 | nsims = 100) 16 | } 17 | 18 | repeat_sim(x=20) -------------------------------------------------------------------------------- /helper_functions/plot_power_oneway_between.R: -------------------------------------------------------------------------------- 1 | plot_power_oneway_between <- function(design_result, max_n){ 2 | 3 | string = design_result$string 4 | mu = design_result$mu 5 | sd <- design_result$sd 6 | r <- design_result$r 7 | p_adjust = design_result$p_adjust 8 | labelnames = c(design_result$factornames[[1]], design_result$labelnames[[1]]) 9 | 10 | n_vec <- seq(from = 5, to = max_n) 11 | 12 | power_A <- numeric(length(n_vec)) 13 | 14 | for (i in 1:length(n_vec)){ 15 | design_result <- ANOVA_design(string = string, 16 | n = n_vec[i], 17 | mu = mu, 18 | sd = sd, 19 | r = r, 20 | p_adjust = p_adjust, 21 | labelnames = labelnames) 22 | 23 | power_res <- power_oneway_between(design_result) 24 | 25 | power_A[i] <- power_res$power*100 26 | } 27 | 28 | res_df <- data.frame(n_vec, power_A) 29 | 30 | library(ggplot2) 31 | library(gridExtra) 32 | p1 <- ggplot(data=res_df, aes(x = n_vec, y = power_A)) + 33 | geom_line( size=1.5) + 34 | scale_x_continuous(limits = c(0, max(n_vec))) + 35 | scale_y_continuous(limits = c(0, 100)) + 36 | theme_bw() + 37 | labs(x="Sample size", y = "Power Factor A") 38 | 39 | invisible(list(p1 = p1, 40 | power_df = data.frame(paste("f = ", 41 | round(power_res$Cohen_f,2)), 42 | n_vec, 43 | power_A))) 44 | } -------------------------------------------------------------------------------- /helper_functions/plot_power_oneway_within.R: -------------------------------------------------------------------------------- 1 | plot_power_oneway_within <- function(design_result, max_n){ 2 | 3 | string = design_result$string 4 | mu = design_result$mu 5 | sd <- design_result$sd 6 | r <- design_result$r 7 | p_adjust = design_result$p_adjust 8 | labelnames = c(design_result$factornames[[1]], design_result$labelnames[[1]]) 9 | 10 | n_vec <- seq(from = 5, to = max_n) 11 | 12 | power_A <- numeric(length(n_vec)) 13 | 14 | for (i in 1:length(n_vec)){ 15 | design_result <- ANOVA_design(string = string, 16 | n = n_vec[i], 17 | mu = mu, 18 | sd = sd, 19 | r = r, 20 | p_adjust = p_adjust, 21 | labelnames = labelnames) 22 | 23 | power_res <- power_oneway_within(design_result) 24 | 25 | power_A[i] <- power_res$power*100 26 | } 27 | 28 | res_df <- data.frame(n_vec, power) 29 | 30 | library(ggplot2) 31 | library(gridExtra) 32 | p1 <- ggplot(data=res_df, aes(x = n_vec, y = power_A)) + 33 | geom_line( size=1.5) + 34 | scale_x_continuous(limits = c(0, max(n_vec))) + 35 | scale_y_continuous(limits = c(0, 100)) + 36 | theme_bw() + 37 | labs(x="Sample size", y = "Power Factor A") 38 | 39 | invisible(list(p1 = p1, 40 | power_df = data.frame(paste("f = ", 41 | round(power_res$Cohen_f,2)), 42 | n_vec, 43 | power_A))) 44 | } -------------------------------------------------------------------------------- /helper_functions/power_oneway_between.R: -------------------------------------------------------------------------------- 1 | power_oneway_between <- function(design_result, alpha_level=0.05){ 2 | mean_mat <- t(matrix(design_result$mu, 3 | nrow = length(design_result$mu)/design_result$factors, 4 | ncol = design_result$factors)) #Create a mean matrix 5 | colnames(mean_mat) <- design_result$design_list 6 | rownames(mean_mat) <- design_result$factornames 7 | 8 | # Using the sweep function to remove rowmeans from the matrix 9 | mean_mat_res <- sweep(mean_mat,2, rowMeans(mean_mat)) 10 | mean_mat_res 11 | MS_A <- design_result$n * (sum(mean_mat_res^2)/(length(design_result$mu)-1)) 12 | SS_A <- design_result$n * sum(mean_mat_res^2) 13 | MS_error <- design_result$sd^2 14 | SS_error <- MS_error * (design_result$n*length(design_result$mu)) 15 | df1 <- length(design_result$mu)-1 16 | df2 <- (design_result$n*length(design_result$mu) - length(design_result$mu)) 17 | eta_p_2 <- SS_A/(SS_A+SS_error) 18 | f_2 <- eta_p_2/(1-eta_p_2) 19 | lambda <- f_2 * design_result$n * length(design_result$mu) 20 | # Cohen_f <- sqrt(sum(mean_mat_res^2)/length(design_result$mu))/sd #based on G*power manual page 28 21 | # We just take the sqrt(f_2) because formula above assumes maximum difference of means. 22 | Cohen_f <- sqrt(f_2) 23 | F_critical <- qf(alpha_level, df1, df2, lower.tail=FALSE) # Critical F-Value 24 | power <- pf(F_critical, df1, df2, lambda, lower.tail = FALSE) # power 25 | 26 | invisible(list(mu = design_result$mu, 27 | sigma = design_result$sd, 28 | n = design_result$n, 29 | alpha_level = alpha_level, 30 | Cohen_f = Cohen_f, 31 | f_2 = f_2, 32 | lambda = lambda, 33 | F_critical = F_critical, 34 | power = power, 35 | df1 = df1, 36 | df2 = df2, 37 | eta_p_2 = eta_p_2, 38 | mean_mat = mean_mat)) 39 | } -------------------------------------------------------------------------------- /mu_from_ES.R: -------------------------------------------------------------------------------- 1 | # Using the formulas below, we can calculate the means for between designs with one factor (One-Way ANOVA). 2 | # Using the formula also used in Albers & Lakens (2018), we can determine the means that should yield a 3 | # specified effect sizes (expressed in Cohen's f). 4 | 5 | mu_from_ES <- function(K, ES){ # provides the vector of population means for a given population ES and nr of groups 6 | f2 <- ES/(1-ES) 7 | if(K == 2){ 8 | a <- sqrt(f2) 9 | muvec <- c(-a,a) 10 | } 11 | if(K == 3){ 12 | a <- sqrt(3*f2/2) 13 | muvec <- c(-a, 0, a) 14 | } 15 | if(K == 4){ 16 | a <- sqrt(f2) 17 | muvec <- c(-a, -a, a, a) 18 | } # note: function gives error when K not 2,3,4. But we don't need other K. 19 | return(muvec) 20 | } 21 | -------------------------------------------------------------------------------- /p_d_ttest.R: -------------------------------------------------------------------------------- 1 | effect_size_d <- function (x, y, conf.level = 0.95){ 2 | sd1 <- sd(x) #standard deviation of measurement 1 3 | sd2 <- sd(y) #standard deviation of measurement 2 4 | n1 <- length(x) #number of pairs 5 | n2 <- length(y) #number of pairs 6 | df <- n1 + n2 - 2 7 | m_diff <- mean(y-x) 8 | sd_pooled <- (sqrt((((n1 - 1) * ((sd1^2))) + (n2 - 1) * ((sd2^2))) / ((n1 + n2 -2)))) #pooled standard deviation 9 | #Calculate Hedges' correction. Uses gamma, unless this yields a nan (huge n), then uses approximation 10 | j <- ifelse(is.na(gamma((n1 + n2 - 2)/2)/(sqrt((n1 + n2 - 2)/2) * gamma(((n1 + n2 - 2) - 1)/2))), 11 | (1 - 3/(4 * (n1 + n2 - 2)-1)), 12 | gamma((n1 + n2 - 2)/2)/(sqrt((n1 + n2 - 2)/2) * gamma(((n1 + n2 - 2) - 1)/2))) 13 | t_value <- m_diff / sqrt(sd_pooled^2 / n1 + sd_pooled^2 / n2) 14 | p_value = 2*pt(-abs(t_value), 15 | df = df) 16 | 17 | d <- m_diff / sd_pooled #Cohen's d 18 | d_unb <- d*j #Hedges g, of unbiased d 19 | 20 | invisible(list(d = d, 21 | d_unb = d_unb, 22 | p_value = p_value)) 23 | } 24 | 25 | effect_size_d_paired <- function (x, y, conf.level = 0.95){ 26 | sd1 <- sd(x) #standard deviation of measurement 1 27 | sd2 <- sd(y) #standard deviation of measurement 2 28 | s_diff <- sd(x-y) #standard deviation of the difference scores 29 | N <- length(x) #number of pairs 30 | df = N-1 31 | s_av <- sqrt((sd1^2+sd2^2)/2) #averaged standard deviation of both measurements 32 | 33 | #Cohen's d_av, using s_av as standardizer 34 | m_diff <- mean(y-x) 35 | d_av <- m_diff/s_av 36 | d_av_unb <- (1-(3/(4*(N-1)-1)))*d_av 37 | 38 | #get the t-value for the CI 39 | t_value <- m_diff/(s_diff/sqrt(N)) 40 | p_value = 2*pt(-abs(t_value), 41 | df = df) 42 | test_res <- t.test(y, x, paired = TRUE) 43 | 44 | #Cohen's d_z, using s_diff as standardizer 45 | d_z <- t_value/sqrt(N) 46 | d_z 47 | d_z_unb <- (1-(3/(4*(N-1)-1)))*d_z 48 | 49 | invisible(list(d_z = d_z, 50 | d_z_unb = d_z_unb, 51 | p_value = p_value)) 52 | } 53 | -------------------------------------------------------------------------------- /program_temp_file.R: -------------------------------------------------------------------------------- 1 | library(MASS) 2 | 3 | design_result <- ANOVA_design(string = "2w*2w", 4 | n = 80, 5 | mu = c(1.03, 1.21, 0.98, 1.01), 6 | sd = 1.03, 7 | r=0.87, 8 | p_adjust = "none", 9 | labelnames = c("age", "old", "young", "speed", "fast", "slow")) 10 | 11 | simulation_result <- ANOVA_power(design_result, alpha = 0.05, nsims = 100) 12 | 13 | 14 | #simply repeated effect 15 | design_result <- ANOVA_design(string = "2w", 16 | n = 80, 17 | mu = c(1, 1.4), 18 | sd = 1, 19 | r=0.9, 20 | p_adjust = "none", 21 | labelnames = c("age", "old", "young")) 22 | 23 | simulation_result <- ANOVA_power(design_result, alpha = 0.05, nsims = 1000) 24 | 25 | 1/sqrt(2)*0.4 26 | 27 | string = "2b*3w" 28 | n = 20 29 | mu = c(1.03, 1.21, 0.98, 1.01, 1, 1) 30 | sd = 1.03 31 | r=0.87 32 | p_adjust = "none" 33 | labelnames = c("age", "a1", "a2", "speed", "s1", "s2", "s3") 34 | 35 | 36 | alpha <- 0.05 37 | nsims <- 100 38 | 39 | string = "2b*2w*2b" 40 | n = 20 41 | mu = c(1.03, 1.21, 0.98, 1.01, 1.11, 1.03, 1.22, 0.99) 42 | sd = 1.03 43 | r=0.87 44 | p_adjust = "none" 45 | labelnames = c("age", "a1", "a2", "speed", "s1", "s2", "time", "t1", "t2") 46 | 47 | 48 | y <- c("age_*_speed_s1") 49 | x <- glob2rx(c("age_a1_speed_s1", "age_a1_speed_s2", "age_a1_speed_s3", "age_a2_speed_s1", "age_a2_speed_s2", "age_a2_speed_s3")) 50 | grepl(y, x) 51 | 52 | 53 | x <- c("age_a1_speed_s1", "age_a1_speed_s2", "age_a1_speed_s3", "age_a2_speed_s1", "age_a2_speed_s2", "age_a2_speed_s3") 54 | 55 | 56 | 57 | grepl("age_a1_speed_$", x) 58 | 59 | 60 | y <- c("age_a1_speed_s1_time_*") 61 | x <- c("age_a1_speed_s1_time_", "age_a1_speed_s2", "age_a1_speed_s3", "age_a2_speed_s1", "age_a2_speed_s2", "age_a2_speed_s3") 62 | grepl(y, x) 63 | 64 | -------------------------------------------------------------------------------- /render_validation_files.R: -------------------------------------------------------------------------------- 1 | rmarkdown::render("validation_files/1.1_validation_power_between_1x2.Rmd") 2 | rmarkdown::render("validation_files/1.2_validation_power_between_1x3.Rmd") 3 | rmarkdown::render("validation_files/1.3_validation_power_between_Brysbaert_1x3.Rmd") 4 | rmarkdown::render("validation_files/2.1_validation_power_within_2x1.Rmd") 5 | rmarkdown::render("validation_files/2.2_validation_power_within_3x1.Rmd") 6 | rmarkdown::render("validation_files/2.3_validation_power_within_Brysbaert_3x1.Rmd") 7 | rmarkdown::render("validation_files/3.1_validation_power_between_within_2x2.Rmd") 8 | rmarkdown::render("validation_files/3.2_validation_power_within_within_2x2_Amsel.Rmd") 9 | rmarkdown::render("validation_files/3.3_validation_power_within_within_Provin_Schutz_Not_Complete.Rmd") 10 | rmarkdown::render("validation_files/3.3_validation_power_within_within_Provin_Schutz_Not_Complete.md", output_format = "pdf_document") 11 | rmarkdown::render("validation_files/4.1_error_control_in_exploratory_ANOVA.Rmd") 12 | 13 | rmarkdown::render("validation_files/1.1_validation_power_between_1x2.Rmd", output_format = "pdf_document") 14 | rmarkdown::render("validation_files/1.2_validation_power_between_1x3.Rmd", output_format = "pdf_document") 15 | rmarkdown::render("validation_files/1.3_validation_power_between_Brysbaert_1x3.Rmd", output_format = "pdf_document") 16 | rmarkdown::render("validation_files/2.1_validation_power_within_2x1.Rmd", output_format = "pdf_document") 17 | rmarkdown::render("validation_files/2.2_validation_power_within_3x1.Rmd", output_format = "pdf_document") 18 | rmarkdown::render("validation_files/2.3_validation_power_within_Brysbaert_3x1.md", output_format = "pdf_document") 19 | rmarkdown::render("validation_files/3.1_validation_power_between_within_2x2.Rmd", output_format = "pdf_document") 20 | rmarkdown::render("validation_files/3.2_validation_power_within_within_2x2_Amsel.Rmd", output_format = "pdf_document") 21 | rmarkdown::render("validation_files/4.1_error_control_in_exploratory_ANOVA.Rmd", output_format = "pdf_document") 22 | rmarkdown::render("validation_files/4.2_power_for_interactions.Rmd", output_format = "pdf_document") 23 | rmarkdown::render("validation_files/4.3_analytic_power_functions.Rmd", output_format = "pdf_document") 24 | rmarkdown::render("validation_files/4.4_power_curves_2x2_within.Rmd", output_format = "pdf_document") 25 | rmarkdown::render("validation_files/4.5_power_for_design_variations.Rmd", output_format = "pdf_document") 26 | rmarkdown::render("validation_files/4.6_threeway_interactions.Rmd", output_format = "pdf_document") 27 | -------------------------------------------------------------------------------- /screenshots/3x6_correlation_matrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/3x6_correlation_matrix.png -------------------------------------------------------------------------------- /screenshots/PS2000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/PS2000.png -------------------------------------------------------------------------------- /screenshots/gpower_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_1.png -------------------------------------------------------------------------------- /screenshots/gpower_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_10.png -------------------------------------------------------------------------------- /screenshots/gpower_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_11.png -------------------------------------------------------------------------------- /screenshots/gpower_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_12.png -------------------------------------------------------------------------------- /screenshots/gpower_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_13.png -------------------------------------------------------------------------------- /screenshots/gpower_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_14.png -------------------------------------------------------------------------------- /screenshots/gpower_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_15.png -------------------------------------------------------------------------------- /screenshots/gpower_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_2.png -------------------------------------------------------------------------------- /screenshots/gpower_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_3.png -------------------------------------------------------------------------------- /screenshots/gpower_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_4.png -------------------------------------------------------------------------------- /screenshots/gpower_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_5.png -------------------------------------------------------------------------------- /screenshots/gpower_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_6.png -------------------------------------------------------------------------------- /screenshots/gpower_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_7.png -------------------------------------------------------------------------------- /screenshots/gpower_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_8.png -------------------------------------------------------------------------------- /screenshots/gpower_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/gpower_9.png -------------------------------------------------------------------------------- /screenshots/maturing.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecyclematuringmaturing -------------------------------------------------------------------------------- /screenshots/orcid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/screenshots/orcid.png -------------------------------------------------------------------------------- /shiny_app/report.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Simulation Results" 3 | subtitle: "Shiny App developed by Daniël Lakens and Aaron Caldwell" 4 | output: pdf_document 5 | date: '`r format(Sys.time(), "%B %d, %Y")`' 6 | params: 7 | tablePC: NA, 8 | tableMain: NA, 9 | pvalue_plot1: NA, 10 | pvalue_plot2: NA, 11 | means_plot: NA, 12 | n: NA, 13 | padjust: NA, 14 | model: NA, 15 | design: NA, 16 | cor_mat: NA, 17 | sigmatrix: NA 18 | seed_number: NA 19 | nsims: NA 20 | alpha_level: NA 21 | --- 22 | 23 | 24 | 25 | 26 | Below are the results from the ANOVA simulation app. If you encounter any problems please visit our GitHub page (https://github.com/Lakens/ANOVA_power_simulation) to the raise the issue. 27 | 28 | **Study Design** 29 | 30 | `r paste(params$design)` 31 | 32 | **Model Formula** 33 | 34 | `r paste(params$model)` 35 | 36 | The sample size was **`r params$n`** per cell with the following adjustment for multiple comparisons: **`r params$padjust`**. 37 | 38 | **Correlation Matrix** 39 | ```{r echo = FALSE} 40 | knitr::kable(params$cor_mat) 41 | ``` 42 | 43 | **Variance-Covariance Matrix** 44 | ```{r echo = FALSE} 45 | knitr::kable(params$sigmatrix) 46 | ``` 47 | 48 | ```{r, results='asis', echo=FALSE} 49 | cat("\\newpage") 50 | ``` 51 | 52 | 53 | ```{r echo = FALSE} 54 | params$means_plot 55 | ``` 56 | 57 | 58 | ```{r, results='asis', echo=FALSE} 59 | cat("\\newpage") 60 | ``` 61 | 62 | The seed number for this simulation was set at `r paste(params$seed_number)`. 63 | A total number of `r paste(params$nsims)` simulations with an alpha level of `r paste(params$alpha_level)`. 64 | Please re-use this input to replicate the results below. 65 | 66 | **ANOVA Power (%) and Effect Sizes (Partial Eta Squared)** 67 | 68 | ```{r echo = FALSE} 69 | knitr::kable(params$tableMain) 70 | 71 | params$pvalue_plot1 72 | ``` 73 | 74 | **Multiple Comparisons Power (%) and Effect Sizes (Cohen's d~z~)** 75 | 76 | ```{r echo = FALSE} 77 | knitr::kable(params$tablePC) 78 | 79 | params$pvalue_plot2 80 | ``` 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /to_do.R: -------------------------------------------------------------------------------- 1 | # https://www.markhw.com/blog/power-twoway 2 | # Can be used to vallidate the 2x2 interaction. -------------------------------------------------------------------------------- /try_out single test.R: -------------------------------------------------------------------------------- 1 | library(mvtnorm) 2 | library(afex) 3 | library(emmeans) 4 | library(ggplot2) 5 | library(gridExtra) 6 | library(reshape2) 7 | 8 | nsims = 100 9 | K <- 3 10 | mu <- c(0, 0.4, 0.4) 11 | n <- 50 12 | sd <- 1 13 | r <- 0.5 14 | string = paste(K,"w",sep="") 15 | alpha_level <- 0.05 16 | design_result <- ANOVA_design(string = string, 17 | n = n, 18 | mu = mu, 19 | sd = sd, 20 | r = r, 21 | p_adjust = "none", 22 | labelnames = c("factor1", "level1", "level2", "level3")) 23 | 24 | 25 | nsims = 100 26 | mu <- c(0, 0.4, 0.4, 0) 27 | n <- 50 28 | sd <- 1 29 | r <- 0.5 30 | string = "2w*2b" 31 | alpha_level <- 0.05 32 | p_adjust = "none" 33 | labelnames = c("age", "old", "young", "color", "blue", "red") 34 | design_result <- ANOVA_design(string = string, 35 | n = n, 36 | mu = mu, 37 | sd = sd, 38 | r = r, 39 | p_adjust = p_adjust, 40 | labelnames = labelnames) 41 | 42 | 43 | simulation_result <- ANOVA_power(design_result, alpha = 0.05, nsims = 100) 44 | -------------------------------------------------------------------------------- /validation_files/1.1_validation_power_between_1x2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/1.1_validation_power_between_1x2.pdf -------------------------------------------------------------------------------- /validation_files/1.2_validation_power_between_1x3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/1.2_validation_power_between_1x3.pdf -------------------------------------------------------------------------------- /validation_files/1.3_validation_power_between_Brysbaert_1x3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/1.3_validation_power_between_Brysbaert_1x3.pdf -------------------------------------------------------------------------------- /validation_files/1.3_validation_power_between_Brysbaert_1x3_files/figure-gfm/unnamed-chunk-10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/1.3_validation_power_between_Brysbaert_1x3_files/figure-gfm/unnamed-chunk-10-1.png -------------------------------------------------------------------------------- /validation_files/1.3_validation_power_between_Brysbaert_1x3_files/figure-gfm/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/1.3_validation_power_between_Brysbaert_1x3_files/figure-gfm/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /validation_files/1.3_validation_power_between_Brysbaert_1x3_files/figure-gfm/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/1.3_validation_power_between_Brysbaert_1x3_files/figure-gfm/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /validation_files/1.3_validation_power_between_Brysbaert_1x3_files/figure-latex/unnamed-chunk-4-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/1.3_validation_power_between_Brysbaert_1x3_files/figure-latex/unnamed-chunk-4-1.pdf -------------------------------------------------------------------------------- /validation_files/2.1_validation_power_within_2x1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/2.1_validation_power_within_2x1.pdf -------------------------------------------------------------------------------- /validation_files/2.2_validation_power_within_3x1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/2.2_validation_power_within_3x1.pdf -------------------------------------------------------------------------------- /validation_files/2.3_validation_power_within_Brysbaert_3x1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/2.3_validation_power_within_Brysbaert_3x1.pdf -------------------------------------------------------------------------------- /validation_files/3.1_validation_power_between_within_2x2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/3.1_validation_power_between_within_2x2.pdf -------------------------------------------------------------------------------- /validation_files/4.1_error_control_in_exploratory_ANOVA_files/figure-latex/unnamed-chunk-1-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.1_error_control_in_exploratory_ANOVA_files/figure-latex/unnamed-chunk-1-1.pdf -------------------------------------------------------------------------------- /validation_files/4.2_power_for_interactions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.2_power_for_interactions.pdf -------------------------------------------------------------------------------- /validation_files/4.3_analytic_power_functions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.3_analytic_power_functions.pdf -------------------------------------------------------------------------------- /validation_files/4.3_analytic_power_functions_files/figure-latex/unnamed-chunk-1-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.3_analytic_power_functions_files/figure-latex/unnamed-chunk-1-1.pdf -------------------------------------------------------------------------------- /validation_files/4.3_analytic_power_functions_files/figure-latex/unnamed-chunk-10-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.3_analytic_power_functions_files/figure-latex/unnamed-chunk-10-1.pdf -------------------------------------------------------------------------------- /validation_files/4.3_analytic_power_functions_files/figure-latex/unnamed-chunk-5-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.3_analytic_power_functions_files/figure-latex/unnamed-chunk-5-1.pdf -------------------------------------------------------------------------------- /validation_files/4.3_analytic_power_functions_files/figure-latex/unnamed-chunk-8-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.3_analytic_power_functions_files/figure-latex/unnamed-chunk-8-1.pdf -------------------------------------------------------------------------------- /validation_files/4.4_power_curves_2x2_within_files/figure-latex/unnamed-chunk-2-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.4_power_curves_2x2_within_files/figure-latex/unnamed-chunk-2-1.pdf -------------------------------------------------------------------------------- /validation_files/4.5_power_for_design_variations.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.5_power_for_design_variations.pdf -------------------------------------------------------------------------------- /validation_files/4.6_threeway_interactions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.6_threeway_interactions.pdf -------------------------------------------------------------------------------- /validation_files/4.6_threeway_interactions_files/figure-markdown_github/unnamed-chunk-1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.6_threeway_interactions_files/figure-markdown_github/unnamed-chunk-1-1.png -------------------------------------------------------------------------------- /validation_files/4.6_threeway_interactions_files/figure-markdown_github/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.6_threeway_interactions_files/figure-markdown_github/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /validation_files/4.6_threeway_interactions_files/figure-markdown_github/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.6_threeway_interactions_files/figure-markdown_github/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /validation_files/4.6_threeway_interactions_files/figure-markdown_github/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/4.6_threeway_interactions_files/figure-markdown_github/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /validation_files/6.1_educational_stuff_files/figure-markdown_github/unnamed-chunk-1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/6.1_educational_stuff_files/figure-markdown_github/unnamed-chunk-1-1.png -------------------------------------------------------------------------------- /validation_files/6.1_educational_stuff_files/figure-markdown_github/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/6.1_educational_stuff_files/figure-markdown_github/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /validation_files/Validation_files/figure-markdown_github/unnamed-chunk-10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/Validation_files/figure-markdown_github/unnamed-chunk-10-1.png -------------------------------------------------------------------------------- /validation_files/Validation_files/figure-markdown_github/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/Validation_files/figure-markdown_github/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /validation_files/Validation_files/figure-markdown_github/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/Validation_files/figure-markdown_github/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /validation_files/Validation_files/figure-markdown_github/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/Validation_files/figure-markdown_github/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /validation_files/conversion_SPSS_partial_eta.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/conversion_SPSS_partial_eta.pdf -------------------------------------------------------------------------------- /validation_files/final_pdf/1.1_validation_power_between_1x2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/final_pdf/1.1_validation_power_between_1x2.pdf -------------------------------------------------------------------------------- /validation_files/final_pdf/1.2_validation_power_between_1x3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/final_pdf/1.2_validation_power_between_1x3.pdf -------------------------------------------------------------------------------- /validation_files/final_pdf/1.3_validation_power_between_Brysbaert_1x3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/final_pdf/1.3_validation_power_between_Brysbaert_1x3.pdf -------------------------------------------------------------------------------- /validation_files/final_pdf/2.1_validation_power_within_2x1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/final_pdf/2.1_validation_power_within_2x1.pdf -------------------------------------------------------------------------------- /validation_files/final_pdf/2.2_validation_power_within_3x1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/final_pdf/2.2_validation_power_within_3x1.pdf -------------------------------------------------------------------------------- /validation_files/final_pdf/2.3_validation_power_within_Brysbaert_3x1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/final_pdf/2.3_validation_power_within_Brysbaert_3x1.pdf -------------------------------------------------------------------------------- /validation_files/final_pdf/3.1_validation_power_between_within_2x2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/final_pdf/3.1_validation_power_between_within_2x2.pdf -------------------------------------------------------------------------------- /validation_files/final_pdf/3.2_validation_power_within_within_2x2_Amsel.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/final_pdf/3.2_validation_power_within_within_2x2_Amsel.pdf -------------------------------------------------------------------------------- /validation_files/final_pdf/3.3_validation_power_within_within_Provin_Schutz_Not_Complete.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/final_pdf/3.3_validation_power_within_within_Provin_Schutz_Not_Complete.pdf -------------------------------------------------------------------------------- /validation_files/final_pdf/4.1_error_control_in_exploratory_ANOVA.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/final_pdf/4.1_error_control_in_exploratory_ANOVA.pdf -------------------------------------------------------------------------------- /validation_files/final_pdf/4.3_analytic_power_functions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/final_pdf/4.3_analytic_power_functions.pdf -------------------------------------------------------------------------------- /validation_files/final_pdf/4.4_power_curves_2x2_within.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/final_pdf/4.4_power_curves_2x2_within.pdf -------------------------------------------------------------------------------- /validation_files/power_code_brysbaert/Power Toster analysis correlation.R: -------------------------------------------------------------------------------- 1 | #TOSTER Power Analysis correlations 2 | 3 | library(TOSTER) 4 | library(MASS) 5 | 6 | r<-0.0 #Set the true effect size of the correlation 7 | N<-860 #Set sample size of your study (number in each group) 8 | nSim<-5000 #Set number of simulations (it takes a while, be patient) 9 | alpha<-.05 #Set the alpha-level 10 | 11 | # make vectors to save the two p-values 12 | p <-numeric(nSim) 13 | 14 | # create progress bar because it might take a while 15 | pb <- winProgressBar(title = "progress bar", min = 0, max = nSim, width = 300) 16 | 17 | for(i in 1:nSim){ #for each simulated experiment 18 | setWinProgressBar(pb, i, title=paste(round(i/nSim*100, 1), "% done")) 19 | data = mvrnorm(n=N, mu=c(0, 0), Sigma=matrix(c(1, r, r, 1), nrow=2)) 20 | x = data[, 1] # standard normal (mu=0, sd=1) 21 | y = data[, 2] # standard normal (mu=0, sd=1) 22 | corr <- cor(x,y) 23 | tosttest <- TOSTr(n=N,r=corr,low_eqbound_r=-0.1, high_eqbound_r=0.1, 24 | alpha = 0.05, verbose=FALSE) 25 | #print(tosttest) 26 | p[i] <-max(tosttest$TOST_p1, tosttest$TOST_p2) 27 | } 28 | close(pb)#close progress bar 29 | 30 | supportH0 <- sum(p=alpha)/nSim 39 | #supportH1 <- sum(bf>threshold)/nSim 40 | supportH1 <- sum(p=alpha)/nSim 33 | #supportH1 <- sum(bf>threshold)/nSim 34 | supportH1 <- sum(p=alpha)/nSim 34 | #supportH1 <- sum(bf>threshold)/nSim 35 | supportH1 <- sum(p 7 | Description: Statistical Power Analysis for designs including t-tests, correlations, multiple regression, ANOVA, mediation, and logistic regression. 8 | License: GPL (>= 2) 9 | Encoding: UTF-8 10 | LazyData: true 11 | RoxygenNote: 6.1.1 12 | Depends: car, 13 | MASS, 14 | dplyr, 15 | tidyr, 16 | ez, 17 | nlme, 18 | phia, 19 | afex, 20 | lavaan, 21 | MBESS 22 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(Chi2X3) 4 | export(Chi2x2) 5 | export(ChiES) 6 | export(ChiGOF) 7 | export(LRcat) 8 | export(LRcont) 9 | export(MANOVA1f) 10 | export(MRC) 11 | export(MRC_all) 12 | export(MRC_short2) 13 | export(MRC_shortcuts) 14 | export(R2_prec) 15 | export(R2ch) 16 | export(anc) 17 | export(anova1f_3) 18 | export(anova1f_3c) 19 | export(anova1f_4) 20 | export(anova1f_4c) 21 | export(anova2x2) 22 | export(anova2x2_se) 23 | export(corr) 24 | export(d_prec) 25 | export(depb) 26 | export(depcorr0) 27 | export(depcorr1) 28 | export(indR2) 29 | export(indb) 30 | export(indcorr) 31 | export(indt) 32 | export(lmm1F) 33 | export(lmm1Ftrends) 34 | export(lmm1w1b) 35 | export(lmm2F) 36 | export(lmm2Fse) 37 | export(md_prec) 38 | export(med) 39 | export(pairt) 40 | export(prop1) 41 | export(propind) 42 | export(r_prec) 43 | export(regint) 44 | export(regintR2) 45 | export(tfromd) 46 | export(win1F) 47 | export(win1Ftrends) 48 | export(win1bg1) 49 | export(win2F) 50 | export(win2Fse) 51 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/Chi2x2.R: -------------------------------------------------------------------------------- 1 | #'Compute power for an Chi Square 2x2 2 | #'Takes proportions for each group. Alpha is .05 by default, alterative values may be entered by user 3 | #'@param r1c1 Proportion of overall scores in Row 1, Column 1 4 | #'@param r1c2 Proportion of overall scores in Row 1, Column 2 5 | #'@param r2c1 Proportion of overall scores in Row 2, Column 1 6 | #'@param r2c2 Proportion of overall scores in Row 2, Column 2 7 | #'@param n Total sample size 8 | #'@param alpha Type I error (default is .05) 9 | #'@return Power for 2x2 Chi Square 10 | #'@export 11 | #' 12 | #' 13 | 14 | Chi2x2<-function(r1c1, r1c2, r2c1, r2c2, n, alpha=.05) 15 | { 16 | df<-1 #Defines df 17 | po1<-r1c1 #Proportion Observed for Row 1, Column 1 18 | po2<-r1c2 #Proportion Observed for Row 1, Column 2 19 | po3<-r2c1 #Proportion Observed for Row 2, Column 1 20 | po4<-r2c2 #Proportion Observed for Row 2, Column 2 21 | sum<-po1+po2+po3+po4 22 | pe1<-(r1c1+r1c2)*(r1c1+r2c1) #Proportion Expected for Row 1, Column 1 23 | pe2<-(r1c1+r1c2)*(r1c2+r2c2) 24 | pe3<-(r2c1+r2c2)*(r1c1+r2c1) 25 | pe4<-(r1c1+r1c2)*(r1c2+r2c2) 26 | lambda<-n*((((po1-pe1)^2)/pe1)+(((po2-pe2)^2)/pe2)+(((po3-pe3)^2)/pe3)+(((po4-pe4)^2)/pe4)) 27 | tabled<-stats::qchisq(1-alpha, df=df) 28 | power<-round(1-stats::pchisq(tabled, df=df, lambda),3) 29 | if(sum!=1.0){stop("Expected proportions must add to 1.0. Check input po values") 30 | } 31 | else {print(paste("Power for n of", n, "=", power))} 32 | } 33 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/Chi2x3.R: -------------------------------------------------------------------------------- 1 | #'Compute power for an Chi Square 2x3 2 | #'Takes proportions for each group. Alpha is .05 by default, alterative values may be entered by user 3 | #'@param r1c1 Proportion of overall scores in Row 1, Column 1 4 | #'@param r1c2 Proportion of overall scores in Row 1, Column 2 5 | #'@param r1c3 Proportion of overall scores in Row 1, Column 3 6 | #'@param r2c1 Proportion of overall scores in Row 2, Column 1 7 | #'@param r2c2 Proportion of overall scores in Row 2, Column 2 8 | #'@param r2c3 Proportion of overall scores in Row 2, Column 3 9 | #'@param n Total sample size 10 | #'@param alpha Type I error (default is .05) 11 | #'@return Power for 2x3 Chi Square 12 | #'@export 13 | #' 14 | #' 15 | 16 | Chi2X3<-function(r1c1, r1c2, r1c3, r2c1, r2c2, r2c3, n, alpha=.05) 17 | { 18 | df<-2 19 | po1<-r1c1 20 | po2<-r1c2 21 | po3<-r1c3 22 | po4<-r2c1 23 | po5<-r2c2 24 | po6<-r2c3 25 | pe1<-(r1c1+r1c2+r1c3)*(r1c1+r2c1) 26 | pe2<-(r1c1+r1c2+r1c3)*(r1c2+r2c2) 27 | pe3<-(r1c1+r1c2+r1c3)*(r1c3+r2c3) 28 | pe4<-(r2c1+r2c2+r2c3)*(r1c1+r2c1) 29 | pe5<-(r2c1+r2c2+r2c3)*(r1c2+r2c2) 30 | pe6<-(r2c1+r2c2+r2c3)*(r1c3+r2c3) 31 | lambda<-n*((((po1-pe1)^2)/pe1)+(((po2-pe2)^2)/pe2)+(((po3-pe3)^2)/pe3)+(((po4-pe4)^2)/pe4)+ 32 | (((po5-pe5)^2)/pe5)+(((po6-pe6)^2)/pe6)) 33 | tabled<-stats::qchisq(1-alpha, df=df) 34 | power<-round(1-stats::pchisq(tabled, df=df, lambda),3) 35 | sum<-po1+po2+po3+po4+po5+po6 36 | if(sum!=1.0){stop("Expected proportions must add to 1.0. Check input po values") 37 | } 38 | else {print(paste("Power for n of", n, "=", power))} 39 | } 40 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/ChiES.R: -------------------------------------------------------------------------------- 1 | #'Compute power for Chi Square Based on Effect Size 2 | #'Takes phi, degrees of freedom, and a range of sameple sizes. Alpha is .05 by default, alterative values may be entered by user 3 | #'@param phi phi coefficient (effect size for 2x2) 4 | #'@param df degrees of freedom 5 | #'@param nlow starting sample size 6 | #'@param nhigh ending sample size 7 | #'@param by Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14) 8 | #'@param alpha Type I error (default is .05) 9 | #'@return Power for Chi Square Based on Effect Size 10 | #'@export 11 | #' 12 | #' 13 | 14 | ChiES<-function(phi, df, nlow, nhigh, by = 1, alpha=.05) 15 | { 16 | {if(phi<0|phi>1.0){stop("Invalid effect size, phi must be between 0 and 1.0") 17 | } 18 | else 19 | for(n in seq(nlow,nhigh, by)){ 20 | lambda<-n*phi^2 21 | tabled<-stats::qchisq(1-alpha, df=df) 22 | power<-round(1-stats::pchisq(tabled, df=df, lambda),4) 23 | print(paste("Power for n of", n, "=", power))} 24 | }} 25 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/ChiGOF.R: -------------------------------------------------------------------------------- 1 | #'Compute power for an Chi Square Goodness of Fit 2 | #'Takes proportions for up to six group. Alpha is .05 by default, alterative values may be entered by user 3 | #'@param po1 Proportion observed Group 1 4 | #'@param po2 Proportion observed Group 2 5 | #'@param po3 Proportion observed Group 3 6 | #'@param po4 Proportion observed Group 4 7 | #'@param po5 Proportion observed Group 5 8 | #'@param po6 Proportion observed Group 6 9 | #'@param groups Number of groups 10 | #'@param n Total sample size 11 | #'@param alpha Type I error (default is .05) 12 | #'@return Power for Chi Square Goodness of Fit 13 | #'@export 14 | #' 15 | #' 16 | 17 | ChiGOF<-function(groups, po1, po2, po3=NULL, po4=NULL, po5=NULL, po6=NULL, n, alpha=.05) 18 | { 19 | df<-groups-1 20 | if(groups==2){ 21 | pe1<-1/groups 22 | pe2<-1/groups 23 | sum<-po1+po2 24 | lambda<-n*((((po1-pe1)^2)/pe1)+(((po2-pe2)^2)/pe2)) 25 | } 26 | else if(groups==3) 27 | { 28 | pe1<-1/groups 29 | pe2<-1/groups 30 | pe3<-1/groups 31 | sum<-po1+po2+po3 32 | lambda<-n*((((po1-pe1)^2)/pe1)+(((po2-pe2)^2)/pe2)+(((po3-pe3)^2)/pe3)) 33 | } 34 | else if(groups==4) 35 | { 36 | pe1<-1/groups 37 | pe2<-1/groups 38 | pe3<-1/groups 39 | pe4<-1/groups 40 | sum<-po1+po2+po3+po4 41 | lambda<-n*((((po1-pe1)^2)/pe1)+(((po2-pe2)^2)/pe2)+(((po3-pe3)^2)/pe3)+(((po4-pe4)^2)/pe4)) 42 | } 43 | else if(groups==5) 44 | { 45 | pe1<-1/groups 46 | pe2<-1/groups 47 | pe3<-1/groups 48 | pe4<-1/groups 49 | pe5<-1/groups 50 | sum<-po1+po2+po3+po4+po5 51 | lambda<-n*((((po1-pe1)^2)/pe1)+(((po2-pe2)^2)/pe2)+(((po3-pe3)^2)/pe3)+(((po4-pe4)^2)/pe4)+(((po5-pe5)^2)/pe5)) 52 | } 53 | else if(groups==6) 54 | { 55 | pe1<-1/groups 56 | pe2<-1/groups 57 | pe3<-1/groups 58 | pe4<-1/groups 59 | pe5<-1/groups 60 | pe6<-1/groups 61 | sum<-po1+po2+po3+po4+po5+po6 62 | lambda<-n*((((po1-pe1)^2)/pe1)+(((po2-pe2)^2)/pe2)+(((po3-pe3)^2)/pe3)+(((po4-pe4)^2)/pe4)+(((po5-pe5)^2)/pe5)+(((po6-pe6)^2)/pe6)) 63 | } 64 | 65 | tabled<-stats::qchisq(1-alpha, df=df) 66 | power<-round(1-stats::pchisq(tabled, df=df, lambda),3) 67 | if(sum!=1.0){stop("Expected proportions must add to 1.0. Check input po values") 68 | } 69 | else {print(paste("Power for n of", n, "=", power))} 70 | } 71 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/LRcat.R: -------------------------------------------------------------------------------- 1 | #'Compute Power for Logistic Regression with a Single Categorical Predictor 2 | #'@param p0 Probability of a Desirable Outcome in the Control Condition 3 | #'@param p1 Probability of a Desirable Outcome in the Treatment Condition 4 | #'@param prop Proportion in the Treatment Condition 5 | #'@param alpha Type I error (default is .05) 6 | #'@param power Desired Power 7 | #'@param R2 How Well Predictor of Interest is Explained by Other Predictors (default is 0) 8 | #'@return Power for Logistic Regression with a Single Categorical Predictor 9 | #'@export 10 | #' 11 | #' 12 | 13 | 14 | 15 | LRcat<-function(p0=NULL, p1=NULL, prop=.50, alpha=.05, power, R2=.00) 16 | { 17 | R<-prop 18 | pbar<-((1-R)*p0)+(R*p1) 19 | zalpha<-stats::qnorm(1-alpha/2) 20 | zbeta<-stats::qnorm(power) 21 | num1<-zalpha*(((pbar*(1-pbar))/R)^.5) 22 | num2<-zbeta*(((p0*(1-p0))+((p1*(1-p1)*(1-R)))/R))^.5 23 | den<-((p0-p1)^2)*(1-R) 24 | n<-((num1+num2)^2/den)/(1-R2) 25 | nprint<-ceiling(n) 26 | OR<-round((p1/(1-p1))/(p0/(1-p0)),3) 27 | print(paste("Sample Size =", nprint, "for Odds Ratio = ", OR))} 28 | 29 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/LRcont.R: -------------------------------------------------------------------------------- 1 | #'Compute Power for Logistic Regression with Continuous Predictors 2 | #'@param OR Odds Ratio for Predictor of Interest 3 | #'@param r Correlation for Predictor of Interest 4 | #'@param ER Event Ratio Probability of a Desirable Outcome Overall 5 | #'@param R2 How Well Predictor of Interest is Explained by Other Predictors (default is 0) 6 | #'@param alpha Type I error (default is .05) 7 | #'@param power Desired Power 8 | #'@return Power for Logistic Regression with Continuous Predictors 9 | #'@export 10 | #' 11 | #' 12 | 13 | LRcont<-function(OR = NA, r = NA, ER=NULL, alpha=.05, power=NULL, R2=.00) 14 | { 15 | est<-NA 16 | est[is.na(OR)]<-1 #r 17 | est[is.na(r)]<-2 #OR 18 | if(est=="1"){ 19 | tod<-(2*r)/((1-r^2)^.5) 20 | OR<-exp(((tod)*pi)/(3^.5))} 21 | lgOR<-log(OR) 22 | zalpha<-stats::qnorm(1-alpha/2) 23 | zpower<-stats::qnorm(power) 24 | num<-zalpha+zpower 25 | den<-ER*(1-ER)*lgOR^2 26 | n<-(num^2/den)/(1-R2) 27 | nprint<-ceiling(n) 28 | OR<-round((OR),4) 29 | print(paste("Sample Size =", nprint, ", Odds Ratio = ", OR))} 30 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/MRC_shortcuts.R: -------------------------------------------------------------------------------- 1 | #'Compute Mutliple Regression shortcuts with three predictors (will expand to handle two to five) 2 | #'Requires correlations between all variables as sample size. Means and sds are option. Also computes Power(All) 3 | #'@param ry1 Correlation between DV (y) and first predictor (1) 4 | #'@param ry2 Correlation between DV (y) and second predictor (2) 5 | #'@param ry3 Correlation between DV (y) and third predictor (3) 6 | #'@param r12 Correlation between first (1) and second predictor (2) 7 | #'@param r13 Correlation between first (1) and third predictor (3) 8 | #'@param r23 Correlation between second (2) and third predictor (3) 9 | #'@param n Sample size 10 | #'@param alpha Type I error (default is .05) 11 | #'@param my Mean of DV (default is 0) 12 | #'@param m1 Mean of first predictor (default is 0) 13 | #'@param m2 Mean of second redictor (default is 0) 14 | #'@param m3 Mean of third predictor (default is 0) 15 | #'@param sy Standard deviation of DV (default is 1) 16 | #'@param s1 Standard deviation of first predictor (default is 1) 17 | #'@param s2 Standard deviation of second predictor (default is 1) 18 | #'@param s3 Standard deviation of third predictor (default is 1) 19 | #'@return Mutliple Regression shortcuts with three predictors 20 | #'@export 21 | #' 22 | MRC_shortcuts<-function(ry1=NULL, ry2=NULL, ry3=NULL, r12=NULL, r13=NULL, r23=NULL,n=100, alpha=.05, 23 | my=0, m1=0, m2=0,m3=0,s1=1,s2=1,s3=1,sy=1){ 24 | vary<-sy^2; var1<-s1^2;var2<-s2^2;var3<-s3^2 25 | covy1<-ry1*sy*s1 26 | covy2<-ry2*sy*s2 27 | covy3<-ry3*sy*s3 28 | cov12<-r12*s1*s2 29 | cov13<-r13*s1*s3 30 | cov23<-r23*s2*s3 31 | pop <- MASS::mvrnorm(n, mu = c(my, m1, m2, m3), Sigma = matrix(c(vary, covy1, covy2, covy3, 32 | covy1, var1, cov12, cov13, 33 | covy2, cov12,var2,cov23, 34 | covy3, cov13, cov23, var3), 35 | ncol = 4), empirical = TRUE) 36 | 37 | 38 | pop2 = data.frame(pop) 39 | pred<-NA 40 | pred[is.null(r23)]<-2 41 | pred[!is.null(r23)]<-3 42 | 43 | full<-summary(stats::lm(X1~X2+X3+X4, pop2)) 44 | print(full) 45 | } 46 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/R2_prec.R: -------------------------------------------------------------------------------- 1 | #'Compute Precision Analyses for R-Squared 2 | #'This approach simply loops a function from MBESS 3 | #'@param R2 R-squared 4 | #'@param pred Number of Predictors 5 | #'@param nlow starting sample size 6 | #'@param nhigh ending sample size 7 | #'@param by Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14) 8 | #'@param ci Type of Confidence Interval (e.g., .95) 9 | #'@return Precision Analyses for R-Squared 10 | #'@export 11 | #' 12 | 13 | R2_prec<-function(R2,nlow, nhigh, pred, ci=.95, by=1) 14 | { 15 | for(n in seq(nlow,nhigh, by)){ 16 | df1<-pred 17 | df2<-n-pred-1 18 | a<-MBESS::ci.R2(R2=R2, df.1=df1,df.2=df2, conf.level = .95, Random.Predictors = FALSE) 19 | ll<-a[1] 20 | ul<-a[3] 21 | ll<-round(as.numeric(ll),4) 22 | ul<-round(as.numeric(ul),4) 23 | print(paste("n=",n,"R2 = ",R2,",LL = ",ll,",UL = ",ul,",precision = ",ul-ll ))}} 24 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/anova1f_3.R: -------------------------------------------------------------------------------- 1 | #'Compute power for a One Factor ANOVA with three levels. 2 | #'Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 3 | #'@param m1 Mean of first group 4 | #'@param m2 Mean of second group 5 | #'@param m3 Mean of third group 6 | #'@param s1 Standard deviation of first group 7 | #'@param s2 Standard deviation of second group 8 | #'@param s3 Standard deviation of third group 9 | #'@param n1 Sample size for first group 10 | #'@param n2 Sample size for second group 11 | #'@param n3 Sample size for third group 12 | #'@param alpha Type I error (default is .05) 13 | #'@return Power for the One Factor ANOVA 14 | #'@export 15 | 16 | 17 | anova1f_3<-function(m1=NULL,m2=NULL,m3=NULL,s1=NULL,s2=NULL,s3=NULL,n1=NULL,n2=NULL,n3=NULL,alpha=.05){ 18 | x<-stats::rnorm(n1,m1,s1) 19 | X<-x 20 | MEAN<-m1 21 | SD<-s1 22 | Z <- (((X - mean(X, na.rm = TRUE))/stats::sd(X, na.rm = TRUE))) * SD 23 | y<-MEAN + Z 24 | group<-rep("A1",n1) 25 | l1<-data.frame(y, group) 26 | x<-stats::rnorm(n2,m2,s2) 27 | X<-x 28 | MEAN<-m2 29 | SD<-s2 30 | Z <- (((X - mean(X, na.rm = TRUE))/stats::sd(X, na.rm = TRUE))) * SD 31 | y<-MEAN + Z 32 | group<-rep("A2",n2) 33 | l2<-data.frame(y, group) 34 | x<-stats::rnorm(n3,m3,s3) 35 | X<-x 36 | MEAN<-m3 37 | SD<-s3 38 | Z <- (((X - mean(X, na.rm = TRUE))/stats::sd(X, na.rm = TRUE))) * SD 39 | y<-MEAN + Z 40 | group<-rep("A3",n3) 41 | l3<-data.frame(y, group) 42 | simdat<-rbind(l1,l2,l3) 43 | anova<-stats::aov(y~group, data=simdat) 44 | anova<-car::Anova(anova, type="III") 45 | SSA<-anova[2,1] #column, row 46 | SSwin<-anova[3,1] 47 | dfwin<-anova[3,2] 48 | dfbg<-anova[2,2] 49 | eta2<-SSA/(SSA+SSwin) 50 | f2<-eta2/(1-eta2) 51 | lambda<-f2*dfwin 52 | minusalpha<-1-alpha 53 | Ft<-stats::qf(minusalpha, dfbg, dfwin) 54 | power<-1-stats::pf(Ft, dfbg,dfwin,lambda) 55 | list(Power = power)} 56 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/anova1f_3c.R: -------------------------------------------------------------------------------- 1 | #'Compute power for a One Factor ANOVA with three levels and contrasts. 2 | #'Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 3 | #'@param m1 Mean of first group 4 | #'@param m2 Mean of second group 5 | #'@param m3 Mean of third group 6 | #'@param s1 Standard deviation of first group 7 | #'@param s2 Standard deviation of second group 8 | #'@param s3 Standard deviation of third group 9 | #'@param n1 Sample size for first group 10 | #'@param n2 Sample size for second group 11 | #'@param n3 Sample size for third group 12 | #'@param alpha Type I error (default is .05) 13 | #'@param c1 Weight for Contrast 1 (default is 0) 14 | #'@param c2 Weight for Contrast 2 (default is 0) 15 | #'@param c3 Weight for Contrast 3 (default is 0) 16 | #'@return Power for the One Factor ANOVA 17 | #'@export 18 | #' 19 | #' 20 | anova1f_3c<-function(m1=NULL,m2=NULL,m3=NULL,s1=NULL,s2=NULL,s3=NULL,n1=NULL,n2=NULL,n3=NULL,alpha=.05, c1 =0, c2=0, c3=0) 21 | { 22 | x<-stats::rnorm(n1,m1,s1) 23 | X<-x 24 | MEAN<-m1 25 | SD<-s1 26 | Z <- (((X - mean(X, na.rm = TRUE))/stats::sd(X, na.rm = TRUE))) * SD 27 | y<-MEAN + Z 28 | group<-rep("A1",n1) 29 | l1<-data.frame(y, group) 30 | x<-stats::rnorm(n2,m2,s2) 31 | X<-x 32 | MEAN<-m2 33 | SD<-s2 34 | Z <- (((X - mean(X, na.rm = TRUE))/stats::sd(X, na.rm = TRUE))) * SD 35 | y<-MEAN + Z 36 | group<-rep("A2",n2) 37 | l2<-data.frame(y, group) 38 | x<-stats::rnorm(n3,m3,s3) 39 | X<-x 40 | MEAN<-m3 41 | SD<-s3 42 | Z <- (((X - mean(X, na.rm = TRUE))/stats::sd(X, na.rm = TRUE))) * SD 43 | y<-MEAN + Z 44 | group<-rep("A3",n3) 45 | l3<-data.frame(y, group) 46 | simdat<-rbind(l1,l2,l3) 47 | anova<-stats::aov(y~group, data=simdat) 48 | anova<-car::Anova(anova, type="III") 49 | SSA<-anova[2,1] #column, row 50 | SSwin<-anova[3,1] 51 | dfwin<-anova[3,2] 52 | mswin<-SSwin/dfwin 53 | dfbg<-anova[2,2] 54 | eta2<-SSA/(SSA+SSwin) 55 | f2<-eta2/(1-eta2) 56 | lambda<-f2*dfwin 57 | minusalpha<-1-alpha 58 | Ft<-stats::qf(minusalpha, dfbg, dfwin) 59 | power<-1-stats::pf(Ft, dfbg,dfwin,lambda) 60 | delta=((c1*m1)+(c2*m2)+(c3*m3))/((mswin*((c1^2/n1)+(c2^2/n2)+(c3^2/n3))))^.5 61 | lambda.c=delta^2 62 | Ft.c<-stats::qf(minusalpha, 1, dfwin) 63 | power.contrast<-1-stats::pf(Ft.c, 1,dfwin,lambda.c) 64 | list(Power.for.Contrast = power.contrast)} 65 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/anova1f_4.R: -------------------------------------------------------------------------------- 1 | #'Compute power for a One Factor Between Subjects ANOVA with four levels 2 | #'Takes means, sds, and sample sizes for each group 3 | #'@param m1 Mean of first group 4 | #'@param m2 Mean of second group 5 | #'@param m3 Mean of third group 6 | #'@param m4 Mean of fourth group 7 | #'@param s1 Standard deviation of first group 8 | #'@param s2 Standard deviation of second group 9 | #'@param s3 Standard deviation of third group 10 | #'@param s4 Standard deviation of forth group 11 | #'@param n1 Sample size for first group 12 | #'@param n2 Sample size for second group 13 | #'@param n3 Sample size for third group 14 | #'@param n4 Sample size for fourth grou 15 | #'@param alpha Type I error (default is .05) 16 | #'@return Power for the One Factor Between Subjects ANOVA 17 | #'@export 18 | 19 | anova1f_4<-function(m1=NULL,m2=NULL,m3=NULL,m4=NULL, s1=NULL,s2=NULL,s3=NULL,s4=NULL, 20 | n1=NULL,n2=NULL,n3=NULL,n4=NULL, alpha=.05){ 21 | x<-stats::rnorm(n1,m1,s1) 22 | X<-x 23 | MEAN<-m1 24 | SD<-s1 25 | Z <- (((X - mean(X, na.rm = TRUE))/stats::sd(X, na.rm = TRUE))) * SD 26 | y<-MEAN + Z 27 | group<-rep("A1",n1) 28 | l1<-data.frame(y, group) 29 | x<-stats::rnorm(n2,m2,s2) 30 | X<-x 31 | MEAN<-m2 32 | SD<-s2 33 | Z <- (((X - mean(X, na.rm = TRUE))/stats::sd(X, na.rm = TRUE))) * SD 34 | y<-MEAN + Z 35 | group<-rep("A2",n2) 36 | l2<-data.frame(y, group) 37 | x<-stats::rnorm(n3,m3,s3) 38 | X<-x 39 | MEAN<-m3 40 | SD<-s3 41 | Z <- (((X - mean(X, na.rm = TRUE))/stats::sd(X, na.rm = TRUE))) * SD 42 | y<-MEAN + Z 43 | group<-rep("A3",n3) 44 | l3<-data.frame(y, group) 45 | x<-stats::rnorm(n4,m4,s4) 46 | X<-x 47 | MEAN<-m4 48 | SD<-s4 49 | Z <- (((X - mean(X, na.rm = TRUE))/stats::sd(X, na.rm = TRUE))) * SD 50 | y<-MEAN + Z 51 | group<-rep("A4",n4) 52 | l4<-data.frame(y, group) 53 | simdat<-rbind(l1,l2,l3,l4) 54 | anova<-stats::aov(y~group, data=simdat) 55 | anova<-car::Anova(anova, type="III") 56 | SSA<-anova[2,1] #column, row 57 | SSwin<-anova[3,1] 58 | dfwin<-anova[3,2] 59 | dfbg<-anova[2,2] 60 | eta2<-SSA/(SSA+SSwin) 61 | f2<-eta2/(1-eta2) 62 | lambda<-f2*dfwin 63 | minusalpha<-1-alpha 64 | Ft<-stats::qf(minusalpha, dfbg, dfwin) 65 | power<-round(1-stats::pf(Ft, dfbg,dfwin,lambda),3) 66 | #list(Power = power) 67 | {print(paste("Power =", power))} 68 | } 69 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/corr.R: -------------------------------------------------------------------------------- 1 | #'Compute power for Pearson's Correlation 2 | #'Takes correlation and range of values 3 | #'@param r Correlation 4 | #'@param nlow Starting sample size 5 | #'@param nhigh Ending sample size 6 | #'@param by Incremental increase in sample size from low ot high 7 | #'@param tails one or two-tailed tests (default is 2) 8 | #'@param alpha Type I error (default is .05) 9 | #'@return Power for Pearson's Correlation 10 | #'@export 11 | #' 12 | #' 13 | corr<-function(r,nlow, nhigh, alpha=.05, tails=2, by=1) 14 | { 15 | d<-abs(2*abs(r))/(1-r^2)^.5 16 | for(n in seq(nlow,nhigh, by)){ 17 | delta<-(d*(n-2)^.5)/2 18 | alphatails<-alpha/tails 19 | tabled<-stats::qt(1-alphatails, df=n-2) 20 | t<-1-stats::pt(alphatails, 1, n-2) 21 | Power<-round(1-stats::pt(tabled, n-2,delta),4) 22 | print(paste("Power for n of", n, "=", Power))} 23 | } 24 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/d_prec.R: -------------------------------------------------------------------------------- 1 | #'Compute Precision Analyses for Standardized Mean Differences 2 | #'@param d Standardized means difference between groups 3 | #'@param nlow starting sample size 4 | #'@param nhigh ending sample size 5 | #'@param by Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14) 6 | #'@param propn1 Proportion in First Group 7 | #'@param ci Type of Confidence Interval (e.g., .95) 8 | #'@param tails number of tails for test (default is 2) 9 | #'@return Precision Analyses for Standardized Mean Differences 10 | #'@export 11 | #' 12 | 13 | 14 | d_prec<-function(d,nlow, nhigh, propn1= .5, ci=.95, tails=2, by=1) 15 | { 16 | for(n in seq(nlow,nhigh, by)){ 17 | n1<-n * propn1 18 | n2<-n * (1-propn1) 19 | a<-MBESS::ci.smd(smd=d, n.1=n1,n.2=n2, conf.level = .95) 20 | ll<-a[1] 21 | ul<-a[3] 22 | ll<-round(as.numeric(ll),4) 23 | ul<-round(as.numeric(ul),4) 24 | print(paste("n1=",n1,",n2 =",n2,"d = ",d,",LL = ",ll,",UL = ",ul,",precision =",ul-ll ))} 25 | } 26 | 27 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/depcorr0.R: -------------------------------------------------------------------------------- 1 | #'Compute Power for Comparing Two Dependent Correlations, No Variables in Common 2 | #'Takes correlations and range of values. First variable in each pair is termed predictor, second is DV 3 | #'@param r12 Correlation between the predictor and DV (first set of measures) 4 | #'@param rxy Correlation between the predictor and DV (second set of measures) 5 | #'@param r1x Correlation between the predictor (first measure) and the predictor variable (first measure) 6 | #'@param r2x Correlation between the DV (first measure) and the predictor variable (first measure) 7 | #'@param r1y Correlation between the predictor (first measure) and the dependent variable (second measure) 8 | #'@param r2y Correlation between the DV (first measure) and the dependent variable (second measure) 9 | #'@param nlow Starting sample size 10 | #'@param nhigh Ending sample size 11 | #'@param by Incremental increase in sample size from low ot high 12 | #'@param tails one or two-tailed tests (default is 2) 13 | #'@param alpha Type I error (default is .05) 14 | #'@return Power for Comparing Two Dependent Correlations, No Variables in Common 15 | #'@export 16 | #' 17 | #' 18 | depcorr0<-function(r12,rxy,r1x,r1y,r2x,r2y, nlow, nhigh, alpha=.05, tails=2, by=1) 19 | { 20 | for(n in seq(nlow,nhigh, by)){ 21 | zr12<-0.5*(log((1+r12)/(1-r12))) 22 | zrxy<-0.5*(log((1+rxy)/(1-rxy))) 23 | zdiff<-abs(zr12-zrxy) 24 | rave<-(r12+rxy)/2 25 | denom <-(1-rave^2)^2 26 | numer1<-(r1x -(r12*r2x))*(r2y-(r2x*rxy)) 27 | numer2<-(r1y -(r1x*rxy))*(r2x-(r12*r1x)) 28 | numer3<-(r1x -(r1y*rxy))*(r2y-(r12*r1y)) 29 | numer4<-(r1y -(r12*r2y))*(r2x-(r2y*rxy)) 30 | numer<-(numer1 + numer2 +numer3+numer4)/2 31 | sd<-numer /denom 32 | z<-(zdiff*((n-3)^.5)) / ((2-(2*sd))^.5) 33 | alphatails<-alpha/tails 34 | tabled<-stats::qnorm(1-alphatails) 35 | zpower<-tabled-z 36 | Power<-round((1-stats::pnorm(zpower)),4) 37 | print(paste("Power for n of", n, "=", Power))} 38 | } 39 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/depcorr1.R: -------------------------------------------------------------------------------- 1 | #'Compute Power for Comparing Two Dependent Correlations, One Variable in Common 2 | #'Takes correlations and range of values 3 | #'@param r1y Correlation between the first predictor and the dependent variable 4 | #'@param r2y Correlation between the second predictor and the dependent variable 5 | #'@param r12 Correlation between the first predictor and the second predictor 6 | #'@param nlow Starting sample size 7 | #'@param nhigh Ending sample size 8 | #'@param by Incremental increase in sample size from low ot high 9 | #'@param tails one or two-tailed tests (default is 2) 10 | #'@param alpha Type I error (default is .05) 11 | #'@return Power for Comparing Dependent Correlations, One Variable in Common 12 | #'@export 13 | #' 14 | #' 15 | depcorr1<-function(r1y,r2y,r12, nlow, nhigh, alpha=.05, tails=2, by=1) 16 | { 17 | for(n in seq(nlow,nhigh, by)){ 18 | df<-n-3 19 | rdiff<-abs(r1y-r2y) 20 | rave<-(r1y+r2y)/2 21 | rdet<-1-(r1y**2)-(r2y**2)-(r12**2)+(2*r1y*r2y*r12) 22 | numer<-(n-1)*(1+r12) 23 | denom1<-((2*(n-1))/(n-3))*rdet 24 | denom2<-(rave**2)*((1-r12)**3) 25 | denom<-denom1+denom2 26 | delta<-rdiff*((numer/denom)^.5) 27 | alphatails<-alpha/tails 28 | tabled <- stats::qt(1-alphatails, df) 29 | Power<-round(1-stats::pt(tabled, df,delta),4) 30 | print(paste("Power for n of", n, "=", Power))} 31 | } 32 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/indcorr.R: -------------------------------------------------------------------------------- 1 | #'Compute Power for Comparing Two Independent Correlations 2 | #'Takes correlations and range of values 3 | #'@param r1 Correlation for Group 1 4 | #'@param r2 Correlation for Group 2 5 | #'@param nlow Starting sample size 6 | #'@param nhigh Ending sample size 7 | #'@param by Incremental increase in sample size from low ot high 8 | #'@param propn1 Proportion of sample in first group (default is .50 for equally size groups) 9 | #'@param tails one or two-tailed tests (default is 2) 10 | #'@param alpha Type I error (default is .05) 11 | #'@return Power for Comparing Two Independent Correlations 12 | #'@export 13 | #' 14 | #' 15 | indcorr<-function(r1,r2,nlow, nhigh, propn1= .5, alpha=.05, tails=2, by=1) 16 | { 17 | for(n in seq(nlow,nhigh, by)){ 18 | n1<-n*propn1 19 | n2<-n*(1-propn1) 20 | zr1<-0.5*(log((1+r1)/(1-r1))) 21 | zr2<-0.5*(log((1+r2)/(1-r2))) 22 | zdiff<-abs(zr1-zr2) 23 | sdz<-((1/(n1-3))+(1/(n2-3)))^.5 24 | z<-zdiff/sdz 25 | alphatails<-alpha/tails 26 | tabled<-stats::qnorm(1-alphatails) 27 | zpower<-tabled-z 28 | Power<-round((1-stats::pnorm(zpower)),4) 29 | print(paste("Power for n of", n, "=", Power))} 30 | } 31 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/indt.R: -------------------------------------------------------------------------------- 1 | #'Compute power for an Independent Samples t-test 2 | #'Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 3 | #'@param m1 Mean of first group 4 | #'@param m2 Mean of second group 5 | #'@param s1 Standard deviation of first group 6 | #'@param s2 Standard deviation of second group 7 | #'@param n1 Sample size for first group 8 | #'@param n2 Sample size for second group 9 | #'@param alpha Type I error (default is .05) 10 | #'@return Power for Independent Samples t-test 11 | #'@export 12 | #' 13 | #' 14 | indt<-function(m1=NULL,m2=NULL, s1=NULL,s2=NULL, n1=NULL,n2=NULL, alpha=.05){ 15 | x<-stats::rnorm(n1,m1,s1) 16 | X<-x 17 | MEAN<-m1 18 | SD<-s1 19 | Z <- (((X - mean(X, na.rm = TRUE))/stats::sd(X, na.rm = TRUE))) * SD 20 | y<-MEAN + Z 21 | group<-rep("A1",n1) 22 | l1<-data.frame(y, group) 23 | x<-stats::rnorm(n2,m2,s2) 24 | X<-x 25 | MEAN<-m2 26 | SD<-s2 27 | Z <- (((X - mean(X, na.rm = TRUE))/stats::sd(X, na.rm = TRUE))) * SD 28 | y<-MEAN + Z 29 | group<-rep("A2",n2) 30 | l2<-data.frame(y, group) 31 | simdat<-rbind(l1,l2) 32 | anova<-stats::aov(y~group, data=simdat) 33 | anova<-car::Anova(anova, type="III") 34 | SSA<-anova[2,1] #column, row 35 | SSwin<-anova[3,1] 36 | dfwin<-anova[3,2] 37 | mswin<-SSwin/dfwin 38 | dfbg<-anova[2,2] 39 | eta2<-SSA/(SSA+SSwin) 40 | f2<-eta2/(1-eta2) 41 | lambda<-f2*dfwin 42 | d<-round((m1-m2)/(mswin^.5),3) 43 | minusalpha<-1-alpha 44 | Ft<-stats::qf(minusalpha, dfbg, dfwin) 45 | Power<-1-stats::pf(Ft, dfbg,dfwin,lambda) 46 | sx1_un <- s1/(n1^.5) 47 | sx2_un <- s2/(n2^.5) 48 | sx1x2_un <- ((sx1_un^2)+(sx2_un^2))^.5 49 | t_un <- (m1-m2)/sx1x2_un 50 | d_un <- round(t_un * sqrt((n1+n2)/(n1*n2)),3) 51 | n_harm <- ((2*n1*n2)/(n1+n2)) 52 | var1<-s1^2 53 | var2<-s2^2 54 | sat_num <- ((var1/n1)+(var2/n2))*((var1/n1)+(var2/n2)) 55 | sat_denom <- ((((s1^2/n1)^2))/(n1-1)) +((((s2^2/n2)^2))/(n2-1)) 56 | df_un <- round(sat_num/sat_denom,3) 57 | delta_un <-(d_un*((n_harm/2)^.5)) 58 | lambda_un <-delta_un^2 59 | Ft_un<-stats::qf(minusalpha, dfbg, df_un) 60 | Power_unequal<-1-stats::pf(Ft_un, dfbg,df_un,lambda_un) 61 | pe<-round(Power,3) 62 | pu<-round(Power_unequal,3) 63 | {print(paste("Equal Variance Power for n1 =",n1,",", "n2 =",n2, "with d =", d, "=", pe))} 64 | {print(paste("Unequal Variance Power for n1 =",n1,",", "n2 =",n2, "with d =", d_un, "=", pu))} 65 | } 66 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/md_precision.R: -------------------------------------------------------------------------------- 1 | #'Compute Precision Analyses for Mean Differences 2 | #'@param m1 Mean of first group 3 | #'@param m2 Mean of second group 4 | #'@param s1 Standard deviation of first group 5 | #'@param s2 Standard deviation of second group 6 | #'@param nlow starting sample size 7 | #'@param nhigh ending sample size 8 | #'@param by Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14) 9 | #'@param propn1 Proportion in First Group 10 | #'@param ci Type of Confidence Interval (e.g., .95) 11 | #'@return Precision Analyses for Mean Differences 12 | #'@export 13 | #' 14 | 15 | md_prec<-function(m1,m2,s1,s2,nlow, nhigh, propn1= .5, ci=.95, by=1) 16 | 17 | { 18 | for(n in seq(nlow,nhigh, by)){ 19 | n1<-n * propn1 20 | n2<-n * (1-propn1) 21 | var1 <- s1*s1 22 | var2 <- s2*s2 23 | nxs1 <- (n1-1)*(var1) 24 | nxs2 <- (n2-1)*(var2) 25 | s2p<-(nxs1+nxs2)/(n1+n2-2) 26 | sp <- sqrt(s2p) 27 | d<-(m1-m2)/sp 28 | a<-MBESS::ci.smd(smd=d, n.1=n1,n.2=n2, conf.level = .95) 29 | ll<-a[1] 30 | ul<-a[3] 31 | ll<-as.numeric(ll) 32 | ul<-as.numeric(ul) 33 | ll_m<-ll*sp 34 | ul_m<-ul*sp 35 | ll_m<-round((ll_m),4) 36 | ul_m<-round((ul_m),4) 37 | print(paste("n1=",n1,",n2 =",n2,",d = ",d,",LL = ",ll_m,",UL = ",ul_m,",precision =",ul_m-ll_m ))} 38 | } 39 | 40 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/pairt.R: -------------------------------------------------------------------------------- 1 | #'Compute power for a Paired t-test 2 | #'Takes means, sd, and sample sizes. Alpha is .05 by default, alterative values may be entered by user. 3 | #'correlation (r) defaults to .50. 4 | #'@param m1 Mean for Pre Test 5 | #'@param m2 Mean for Post Test 6 | #'@param s Standard deviation 7 | #'@param r Correlation pre-post measures (default is .50) 8 | #'@param n Sample size 9 | #'@param alpha Type I error (default is .05) 10 | #'@return Power for the Paired t-test 11 | #'@export 12 | 13 | pairt<-function(m1=NULL,m2=NULL, s=NULL, n=NULL, r = NULL, alpha=.05) 14 | { 15 | cov<-s^2 16 | corr<-r*cov 17 | data <- MASS::mvrnorm(n, mu = c(m1,m2), Sigma = matrix(c(cov,corr,corr,cov), ncol = 2), 18 | empirical = TRUE) 19 | data<-as.data.frame(data) 20 | t<-stats::t.test(data$V1,data$V2, paired=TRUE) 21 | lambda<-abs(t$statistic)^2 22 | minusalpha<-1-alpha 23 | Ft<-stats::qf(minusalpha, 1, n-1) 24 | Power<-round(1-stats::pf(Ft, 1,n-1,lambda),4) 25 | values<-list(Power = Power, lambda=lambda) 26 | print(paste("Power for n = ", n, "is", Power)) 27 | } 28 | 29 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/prop1.R: -------------------------------------------------------------------------------- 1 | #'Compute power for a single sample proportion test 2 | #'Takes phi, degrees of freedom, and a range of sameple sizes. Alpha is .05 by default, alterative values may be entered by user 3 | #'@param p1 expected proportion (a.k.a. alternative proportion) 4 | #'@param p0 null proportion 5 | #'@param nlow starting sample size 6 | #'@param nhigh ending sample size 7 | #'@param by Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14) 8 | #'@param alpha Type I error (default is .05) 9 | #'@param tails number of tails for test (default is 2) 10 | #'@return Power for Tests of Single Proportion 11 | #'@export 12 | #' 13 | #' 14 | 15 | prop1<-function(p1,p0,nlow, nhigh, alpha=.05, tails=2, by=1) 16 | { 17 | {if(p1<0|p1>1.0|p0<0|p0>1.0){stop("Invalid proportions, must be between 0 and 1.0") 18 | } 19 | else 20 | p1a<-2*asin(p1^.5) 21 | p0a<-2*asin(p0^.5) 22 | h = abs(p1a-p0a) 23 | for(n in seq(nlow,nhigh, by)){ 24 | zlambda<-h*(n^.5) 25 | prob<-1-(alpha/tails) 26 | tabled<-abs(stats::qnorm(prob)) 27 | zpower<-tabled-zlambda 28 | power<-round(1-stats::pnorm(zpower),4) 29 | print(paste("Power for n of", n, "=", power))} 30 | }} 31 | 32 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/propind.R: -------------------------------------------------------------------------------- 1 | #'Compute power for Tests of Two Independent Proportions 2 | #'Takes phi, degrees of freedom, and a range of sameple sizes. Alpha is .05 by default, alterative values may be entered by user 3 | #'@param p1 expected proportion Group 1 4 | #'@param p2 expected proportion Group 2 5 | #'@param nlow starting sample size 6 | #'@param nhigh ending sample size 7 | #'@param nratio ratio of sample size of first group to second (default is .5 for equally sized groups) 8 | #'@param by Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14) 9 | #'@param alpha Type I error (default is .05) 10 | #'@param tails number of tails for test (default is 2) 11 | #'@return Power for Tests of Two Independent Proportions 12 | #'@export 13 | #' 14 | #' 15 | 16 | propind<-function(p1,p2,nlow, nhigh, nratio=0.5, alpha=.05, tails=2, by=1) 17 | { 18 | {if(p1<0|p1>1.0|p2<0|p2>1.0){stop("Invalid proportions, must be between 0 and 1.0") 19 | } 20 | else 21 | p1a<-2*asin(p1^.5) 22 | p2a<-2*asin(p2^.5) 23 | h<- abs(p1a-p2a) 24 | for(n in seq(nlow,nhigh, by)){ 25 | n1<-n*nratio 26 | n2<-n-n1 27 | nharm<-(2*n1*n2)/(n1+n2) 28 | zlambda<-h*((nharm/2)^.5) 29 | prob<-1-(alpha/tails) 30 | tabled<-abs(stats::qnorm(prob)) 31 | zpower<-tabled-zlambda 32 | power<-round(1-stats::pnorm(zpower),4) 33 | #print(c(p1a,p2a))} 34 | print(paste("Power for sample sizes of ", n1, n2, "=", power))} 35 | 36 | }} 37 | 38 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/r_prec.R: -------------------------------------------------------------------------------- 1 | #'Compute Precision Analyses for Correlations 2 | #'This approach simply loops a function from MBESS 3 | #'@param r Correlation 4 | #'@param nlow starting sample size 5 | #'@param nhigh ending sample size 6 | #'@param by Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14) 7 | #'@param ci Type of Confidence Interval (e.g., .95) 8 | #'@return Precision Analyses for Correlations 9 | #'@export 10 | #' 11 | 12 | r_prec<-function(r,nlow, nhigh, ci=.95, by=1) 13 | { 14 | for(n in seq(nlow,nhigh, by)){ 15 | a<-MBESS::ci.cc(r, n, ci) 16 | ll<-a[1] 17 | ul<-a[3] 18 | ll<-round(as.numeric(ll),4) 19 | ul<-round(as.numeric(ul),4) 20 | print(paste("n=",n,"r = ",r,",LL = ",ll,",UL = ",ul,",precision = ",ul-ll ))}} 21 | 22 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/regint.R: -------------------------------------------------------------------------------- 1 | #'Compute Power for Regression Interaction (Correlation/Coefficient Approach) 2 | #'@param Group1 Estimates (r or b) for Group 1 3 | #'@param Group2 Estimates (r or b) for Group 2 4 | #'@param Prop_n1 Proportion of Sample in First Group (defaults to equal sample sizes) 5 | #'@param Estimates 1 for Correlations (default), 2 for coefficients 6 | #'@param sx1 Standard deviation of predictor, group 1 (defaults to 1) 7 | #'@param sx2 Standard deviation of predictor, group 2 (defaults to 1) 8 | #'@param sy1 Standard deviation of outcome, group 1 (defaults to 1) 9 | #'@param sy2 Standard deviation of outcome, group 2 (defaults to 1) 10 | #'@param nlow starting sample size 11 | #'@param nhigh ending sample size 12 | #'@param by incrimental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14) 13 | #'@param alpha Type I error (default is .05) 14 | #'@return Power for Regression Interaction (Correlation/Coefficient Approach) 15 | #'@export 16 | #' 17 | #' 18 | 19 | 20 | regint<-function(Group1,Group2, sx1=1, sx2=1, sy1=1, sy2=1, nlow, nhigh, alpha=.05, Prop_n1=.5, by=2, Estimates=1){ 21 | for(n in seq(nlow,nhigh, by)){ 22 | n1 <- n * Prop_n1 23 | n2 <- n * (1-Prop_n1) 24 | if (Estimates=="1"){ 25 | r1 <- Group1 26 | r2 <- Group2} 27 | if (Estimates=="2"){ 28 | r1 <- Group1*(sx1/sy1) 29 | r2 <- Group2*(sx2/sy2)} 30 | sx1_sq <- sx1^2 31 | sx2_sq <- sx2^2 32 | sy1_sq <- sy1^2 33 | sy2_sq <- sy2^2 34 | r1_sq <- r1^2 35 | r2_sq <- r2^2 36 | numer1 <- ((n1-1)*r1_sq* sy1_sq) + ((n2-1)*r2_sq* sy2_sq) 37 | numer2 <- (((n1-1)*r1 * sx1 * sy1)+ ((n2-1)*r2 * sx2 * sy2))^2 38 | numer3 <- ((n1-1)* sx1_sq)+ ((n2-1)* sx2_sq) 39 | numer <- numer1 - (numer2 / numer3) 40 | denom <- ((n1-2)*(1-r1_sq)* sy1_sq) + ((n2-2)*(1-r2_sq)* sy2_sq) 41 | f2 <- numer/denom 42 | df1 <- 1 43 | df2 <- n-4 44 | lambda <- f2 * df2 45 | minusalpha<-1-alpha 46 | Ft<-stats::qf(minusalpha, df1, df2) 47 | Power<-round(1-stats::pf(Ft, df1,df2,lambda),4) 48 | R2<-round((f2/(1+f2)),4) 49 | print(paste("Power with n1 = ", n1, "n2 = ", n2, "= ", Power))} 50 | print(paste("Effect size (R2 Change/Squared Semi Partial) = ", R2))} 51 | 52 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/regintR2.R: -------------------------------------------------------------------------------- 1 | #'Compute Power for Regression Interaction (R2 Change Approach) 2 | #'@param R2Mod Full Model R2 3 | #'@param R2Ch Change in R2 Added by Interaction 4 | #'@param mod_pred Full Model Number of Predictors 5 | #'@param ch_pred Change Model Number of Predictors 6 | #'@param nlow starting sample size 7 | #'@param nhigh ending sample size 8 | #'@param by incrimental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14) 9 | #'@param alpha Type I error (default is .05) 10 | #'@return Power for Regression Interaction (R2 Change Approach) 11 | #'@export 12 | #' 13 | #' 14 | 15 | 16 | regintR2<-function(R2Mod, R2Ch, mod_pred, ch_pred,nlow, nhigh, by =1, alpha=.05) 17 | { 18 | for(n in seq(nlow,nhigh, by)){ 19 | df_denom <- (n - mod_pred)-1 20 | f2 <- R2Ch/(1-R2Mod) 21 | lambda = f2*df_denom 22 | minusalpha<-1-alpha 23 | Ft<-stats::qf(minusalpha, ch_pred, df_denom) 24 | Power<-round(1-stats::pf(Ft, ch_pred, df_denom,lambda),4) 25 | print(paste("Power with n = ", n, "= ", Power))} 26 | } 27 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/R/tfromd.R: -------------------------------------------------------------------------------- 1 | #'Compute power for a t test using d statistic 2 | #'Takes d, sample size range, type of test, and tails. 3 | #'@param d standardize mean difference (Cohen's d) 4 | #'@param nlow Starting sample size 5 | #'@param nhigh Ending sample size 6 | #'@param by Incremental increase in sample size from low ot high 7 | #'@param tails one or two-tailed tests (default is 2) 8 | #'@param test "I" for independent, "P" for paired 9 | #'@param alpha Type I error (default is .05) 10 | #'@return Power for the t-test from d statistic 11 | #'@export 12 | #' 13 | #' 14 | 15 | tfromd<-function(d,nlow, nhigh, alpha=.05, test="I", tails=2, by=1) 16 | { 17 | if (test=="I") { 18 | d<-abs(d) 19 | for(n in seq(nlow,nhigh, by)){ 20 | ncalc<-n/2 21 | delta<-d*(ncalc^.5) 22 | lambda<-delta^2 23 | minusalpha<-1-alpha 24 | Ft<-stats::qf(minusalpha, 1, n-2) 25 | Power<-round(1-stats::pf(Ft, 1,n-2,lambda),4) 26 | print(paste("Power a per group n of (Independent)", n, "=", Power))} 27 | } 28 | else if (test=="P") 29 | for(n in seq(nlow,nhigh, by)){ 30 | d<-abs(d) 31 | delta<-d*(n^.5) 32 | lambda<-delta^2 33 | minusalpha<-1-alpha 34 | Ft<-stats::qf(minusalpha, 1, n-1) 35 | Power<-round(1-stats::pf(Ft, 1,n-2,lambda),3) 36 | print(paste("Power for total n of (Paired)", n, "=", Power))} 37 | } 38 | 39 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/README.md: -------------------------------------------------------------------------------- 1 | prw2ppl Readme 2 | ================ 3 | Chris Aberson 4 | May 19, 2018 5 | 6 | pwr2ppl 7 | ======= 8 | 9 | pwr2ppl contains protocols for running a wide range of power analyses. Analyses range from simple approaches such as t-test and correlations to multifactor ANOVA (between and within subjects, linear mixed model approaches) and regression-based approaches (basic multiple regression, moderated regression, mediation, and logistic regression). 10 | 11 | These protocols accompany the book *Applied Power Analysis for the Behavioral Sciences (2nd ed.)*. The book should be out in 2019. The book gives lots of illustritive examples of using the code but is not necessary for using the package. 12 | 13 | Getting Started 14 | --------------- 15 | 16 | Install the entire package (pwr2ppl\_0.1.0.tar.gz). At present devtools::install_github is not working. 17 | In RStudio choose install - from package archive then direct to where you stored the downloaded tar.gz file 18 | 19 | ### Prerequisites 20 | 21 | I built this under R 3.5.0 22 | 23 | Authors 24 | ------- 25 | 26 | - **Chris Aberson** [chrisaberson](https://github.com/chrisaberson) 27 | 28 | License 29 | ------- 30 | 31 | This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details 32 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/Chi2X3.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/Chi2x3.R 3 | \name{Chi2X3} 4 | \alias{Chi2X3} 5 | \title{Compute power for an Chi Square 2x3 6 | Takes proportions for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | Chi2X3(r1c1, r1c2, r1c3, r2c1, r2c2, r2c3, n, alpha = 0.05) 9 | } 10 | \arguments{ 11 | \item{r1c1}{Proportion of overall scores in Row 1, Column 1} 12 | 13 | \item{r1c2}{Proportion of overall scores in Row 1, Column 2} 14 | 15 | \item{r1c3}{Proportion of overall scores in Row 1, Column 3} 16 | 17 | \item{r2c1}{Proportion of overall scores in Row 2, Column 1} 18 | 19 | \item{r2c2}{Proportion of overall scores in Row 2, Column 2} 20 | 21 | \item{r2c3}{Proportion of overall scores in Row 2, Column 3} 22 | 23 | \item{n}{Total sample size} 24 | 25 | \item{alpha}{Type I error (default is .05)} 26 | } 27 | \value{ 28 | Power for 2x3 Chi Square 29 | } 30 | \description{ 31 | Compute power for an Chi Square 2x3 32 | Takes proportions for each group. Alpha is .05 by default, alterative values may be entered by user 33 | } 34 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/Chi2x2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/Chi2x2.R 3 | \name{Chi2x2} 4 | \alias{Chi2x2} 5 | \title{Compute power for an Chi Square 2x2 6 | Takes proportions for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | Chi2x2(r1c1, r1c2, r2c1, r2c2, n, alpha = 0.05) 9 | } 10 | \arguments{ 11 | \item{r1c1}{Proportion of overall scores in Row 1, Column 1} 12 | 13 | \item{r1c2}{Proportion of overall scores in Row 1, Column 2} 14 | 15 | \item{r2c1}{Proportion of overall scores in Row 2, Column 1} 16 | 17 | \item{r2c2}{Proportion of overall scores in Row 2, Column 2} 18 | 19 | \item{n}{Total sample size} 20 | 21 | \item{alpha}{Type I error (default is .05)} 22 | } 23 | \value{ 24 | Power for 2x2 Chi Square 25 | } 26 | \description{ 27 | Compute power for an Chi Square 2x2 28 | Takes proportions for each group. Alpha is .05 by default, alterative values may be entered by user 29 | } 30 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/ChiES.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ChiES.R 3 | \name{ChiES} 4 | \alias{ChiES} 5 | \title{Compute power for Chi Square Based on Effect Size 6 | Takes phi, degrees of freedom, and a range of sameple sizes. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | ChiES(phi, df, nlow, nhigh, by = 1, alpha = 0.05) 9 | } 10 | \arguments{ 11 | \item{phi}{phi coefficient (effect size for 2x2)} 12 | 13 | \item{df}{degrees of freedom} 14 | 15 | \item{nlow}{starting sample size} 16 | 17 | \item{nhigh}{ending sample size} 18 | 19 | \item{by}{Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14)} 20 | 21 | \item{alpha}{Type I error (default is .05)} 22 | } 23 | \value{ 24 | Power for Chi Square Based on Effect Size 25 | } 26 | \description{ 27 | Compute power for Chi Square Based on Effect Size 28 | Takes phi, degrees of freedom, and a range of sameple sizes. Alpha is .05 by default, alterative values may be entered by user 29 | } 30 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/ChiGOF.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ChiGOF.R 3 | \name{ChiGOF} 4 | \alias{ChiGOF} 5 | \title{Compute power for an Chi Square Goodness of Fit 6 | Takes proportions for up to six group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | ChiGOF(groups, po1, po2, po3 = NULL, po4 = NULL, po5 = NULL, 9 | po6 = NULL, n, alpha = 0.05) 10 | } 11 | \arguments{ 12 | \item{groups}{Number of groups} 13 | 14 | \item{po1}{Proportion observed Group 1} 15 | 16 | \item{po2}{Proportion observed Group 2} 17 | 18 | \item{po3}{Proportion observed Group 3} 19 | 20 | \item{po4}{Proportion observed Group 4} 21 | 22 | \item{po5}{Proportion observed Group 5} 23 | 24 | \item{po6}{Proportion observed Group 6} 25 | 26 | \item{n}{Total sample size} 27 | 28 | \item{alpha}{Type I error (default is .05)} 29 | } 30 | \value{ 31 | Power for Chi Square Goodness of Fit 32 | } 33 | \description{ 34 | Compute power for an Chi Square Goodness of Fit 35 | Takes proportions for up to six group. Alpha is .05 by default, alterative values may be entered by user 36 | } 37 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/LRcat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/LRcat.R 3 | \name{LRcat} 4 | \alias{LRcat} 5 | \title{Compute Power for Logistic Regression with a Single Categorical Predictor} 6 | \usage{ 7 | LRcat(p0 = NULL, p1 = NULL, prop = 0.5, alpha = 0.05, power, 8 | R2 = 0) 9 | } 10 | \arguments{ 11 | \item{p0}{Probability of a Desirable Outcome in the Control Condition} 12 | 13 | \item{p1}{Probability of a Desirable Outcome in the Treatment Condition} 14 | 15 | \item{prop}{Proportion in the Treatment Condition} 16 | 17 | \item{alpha}{Type I error (default is .05)} 18 | 19 | \item{power}{Desired Power} 20 | 21 | \item{R2}{How Well Predictor of Interest is Explained by Other Predictors (default is 0)} 22 | } 23 | \value{ 24 | Power for Logistic Regression with a Single Categorical Predictor 25 | } 26 | \description{ 27 | Compute Power for Logistic Regression with a Single Categorical Predictor 28 | } 29 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/LRcont.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/LRcont.R 3 | \name{LRcont} 4 | \alias{LRcont} 5 | \title{Compute Power for Logistic Regression with Continuous Predictors} 6 | \usage{ 7 | LRcont(OR = NA, r = NA, ER = NULL, alpha = 0.05, power = NULL, 8 | R2 = 0) 9 | } 10 | \arguments{ 11 | \item{OR}{Odds Ratio for Predictor of Interest} 12 | 13 | \item{r}{Correlation for Predictor of Interest} 14 | 15 | \item{ER}{Event Ratio Probability of a Desirable Outcome Overall} 16 | 17 | \item{alpha}{Type I error (default is .05)} 18 | 19 | \item{power}{Desired Power} 20 | 21 | \item{R2}{How Well Predictor of Interest is Explained by Other Predictors (default is 0)} 22 | } 23 | \value{ 24 | Power for Logistic Regression with Continuous Predictors 25 | } 26 | \description{ 27 | Compute Power for Logistic Regression with Continuous Predictors 28 | } 29 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/MRC.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/MRC.R 3 | \name{MRC} 4 | \alias{MRC} 5 | \title{Compute power for Multiple Regression with up to Five Predictors 6 | Example code below for three predictors. Expand as needed for four or five} 7 | \usage{ 8 | MRC(ry1 = NULL, ry2 = NULL, ry3 = NULL, ry4 = NULL, ry5 = NULL, 9 | r12 = NULL, r13 = NULL, r14 = NULL, r15 = NULL, r23 = NULL, 10 | r24 = NULL, r25 = NULL, r34 = NULL, r35 = NULL, r45 = NULL, 11 | n = NULL, alpha = 0.05, rep = 10000) 12 | } 13 | \arguments{ 14 | \item{ry1}{Correlation between DV (y) and first predictor (1)} 15 | 16 | \item{ry2}{Correlation between DV (y) and second predictor (2)} 17 | 18 | \item{ry3}{Correlation between DV (y) and third predictor (3)} 19 | 20 | \item{ry4}{Correlation between DV (y) and fourth predictor (4)} 21 | 22 | \item{ry5}{Correlation between DV (y) and fifth predictor (5)} 23 | 24 | \item{r12}{Correlation between first (1) and second predictor (2)} 25 | 26 | \item{r13}{Correlation between first (1) and third predictor (3)} 27 | 28 | \item{r14}{Correlation between first (1) and fourth predictor (4)} 29 | 30 | \item{r15}{Correlation between first (1) and fifth predictor (5)} 31 | 32 | \item{r23}{Correlation between second (2) and third predictor (3)} 33 | 34 | \item{r24}{Correlation between second (2) and fourth predictor (4)} 35 | 36 | \item{r25}{Correlation between second (2) and fifth predictor (5)} 37 | 38 | \item{r34}{Correlation between third (3) and fourth predictor (4)} 39 | 40 | \item{r35}{Correlation between third (3) and fifth predictor (5)} 41 | 42 | \item{r45}{Correlation between fourth (4) and fifth predictor (5)} 43 | 44 | \item{n}{Sample size} 45 | 46 | \item{alpha}{Type I error (default is .05)} 47 | 48 | \item{rep}{number of replications (default is 10000)} 49 | } 50 | \value{ 51 | Power for Multiple Regression with Two to Five Predictors 52 | } 53 | \description{ 54 | Compute power for Multiple Regression with up to Five Predictors 55 | Example code below for three predictors. Expand as needed for four or five 56 | } 57 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/MRC_all.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/MRC_all.R 3 | \name{MRC_all} 4 | \alias{MRC_all} 5 | \title{Compute power for Mutliple Regression with Three Predictors 6 | Requires correlations between all variables as sample size. Means, sds, and alpha are option. Also computes Power(All)} 7 | \usage{ 8 | MRC_all(ry1 = NULL, ry2 = NULL, ry3 = NULL, r12 = NULL, 9 | r13 = NULL, r23 = NULL, n = NULL, alpha = 0.05, rep = 10000, 10 | my = 0, m1 = 0, m2 = 0, m3 = 0, sy = 1, s1 = 1, s2 = 1, 11 | s3 = 1) 12 | } 13 | \arguments{ 14 | \item{ry1}{Correlation between DV (y) and first predictor (1)} 15 | 16 | \item{ry2}{Correlation between DV (y) and second predictor (2)} 17 | 18 | \item{ry3}{Correlation between DV (y) and third predictor (3)} 19 | 20 | \item{r12}{Correlation between first (1) and second predictor (2)} 21 | 22 | \item{r13}{Correlation between first (1) and third predictor (3)} 23 | 24 | \item{r23}{Correlation between second (2) and third predictor (3)} 25 | 26 | \item{n}{Sample size} 27 | 28 | \item{alpha}{Type I error (default is .05)} 29 | 30 | \item{rep}{number of replications (default is 10000)} 31 | } 32 | \value{ 33 | Power for Multiple Regression (ALL) 34 | } 35 | \description{ 36 | Compute power for Mutliple Regression with Three Predictors 37 | Requires correlations between all variables as sample size. Means, sds, and alpha are option. Also computes Power(All) 38 | } 39 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/R2_prec.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/R2_prec.R 3 | \name{R2_prec} 4 | \alias{R2_prec} 5 | \title{Compute Precision Analyses for R-Squared 6 | This approach simply loops a function from MBESS} 7 | \usage{ 8 | R2_prec(R2, nlow, nhigh, pred, ci = 0.95, by = 1) 9 | } 10 | \arguments{ 11 | \item{R2}{R-squared} 12 | 13 | \item{nlow}{starting sample size} 14 | 15 | \item{nhigh}{ending sample size} 16 | 17 | \item{pred}{Number of Predictors} 18 | 19 | \item{ci}{Type of Confidence Interval (e.g., .95)} 20 | 21 | \item{by}{Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14)} 22 | } 23 | \value{ 24 | Precision Analyses for R-Squared 25 | } 26 | \description{ 27 | Compute Precision Analyses for R-Squared 28 | This approach simply loops a function from MBESS 29 | } 30 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/R2ch.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/R2ch.R 3 | \name{R2ch} 4 | \alias{R2ch} 5 | \title{Compute power for R2 change in Mutliple Regression (up to three predictors) 6 | Requires correlations between all variables as sample size. Means, sds, and alpha are option. Also computes Power(All) 7 | Example code below for three predictors. Expand as needed for four or five} 8 | \usage{ 9 | R2ch(ry1 = NULL, ry2 = NULL, ry3 = NULL, r12 = NULL, r13 = NULL, 10 | r23 = NULL, n = NULL, alpha = 0.05, my = 0, m1 = 0, m2 = 0, 11 | m3 = 0, s1 = 1, s2 = 1, s3 = 1, sy = 1) 12 | } 13 | \arguments{ 14 | \item{ry1}{Correlation between DV (y) and first predictor (1)} 15 | 16 | \item{ry2}{Correlation between DV (y) and second predictor (2)} 17 | 18 | \item{ry3}{Correlation between DV (y) and third predictor (3)} 19 | 20 | \item{r12}{Correlation between first (1) and second predictor (2)} 21 | 22 | \item{r13}{Correlation between first (1) and third predictor (3)} 23 | 24 | \item{r23}{Correlation between second (2) and third predictor (3)} 25 | 26 | \item{n}{Sample size} 27 | 28 | \item{alpha}{Type I error (default is .05)} 29 | 30 | \item{my}{Mean of DV (default is 0)} 31 | 32 | \item{m1}{Mean of first predictor (default is 0)} 33 | 34 | \item{m2}{Mean of second redictor (default is 0)} 35 | 36 | \item{m3}{Mean of third predictor (default is 0)} 37 | 38 | \item{s1}{Standard deviation of first predictor (default is 1)} 39 | 40 | \item{s2}{Standard deviation of second predictor (default is 1)} 41 | 42 | \item{s3}{Standard deviation of third predictor (default is 1)} 43 | 44 | \item{sy}{Standard deviation of DV (default is 1)} 45 | } 46 | \value{ 47 | Power for R2 change in Mutliple Regression (up to three predictors) 48 | } 49 | \description{ 50 | Compute power for R2 change in Mutliple Regression (up to three predictors) 51 | Requires correlations between all variables as sample size. Means, sds, and alpha are option. Also computes Power(All) 52 | Example code below for three predictors. Expand as needed for four or five 53 | } 54 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/anc.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/anc.R 3 | \name{anc} 4 | \alias{anc} 5 | \title{Compute Power for One or Two Factor ANCOVA with a single covariate 6 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | anc(m1.1, m2.1, m1.2, m2.2, m1.3 = NULL, m2.3 = NULL, m1.4 = NULL, 9 | m2.4 = NULL, s1.1, s2.1, s1.2, s2.2, s1.3 = NULL, s2.3 = NULL, 10 | s1.4 = NULL, s2.4 = NULL, r, s = NULL, alpha = 0.05, factors, n) 11 | } 12 | \arguments{ 13 | \item{m1.1}{Cell mean for First level of Factor A, First level of Factor B} 14 | 15 | \item{m2.1}{Cell mean for Second level of Factor A, First level of Factor B} 16 | 17 | \item{m1.2}{Cell mean for First level of Factor A, Second level of Factor B} 18 | 19 | \item{m2.2}{Cell mean for Second level of Factor A, Second level of Factor B} 20 | 21 | \item{m1.3}{Cell mean for First level of Factor A, Third level of Factor B} 22 | 23 | \item{m2.3}{Cell mean for Second level of Factor A, Third level of Factor B} 24 | 25 | \item{m1.4}{Cell mean for First level of Factor A, Fourth level of Factor B} 26 | 27 | \item{m2.4}{Cell mean for Second level of Factor A, Fourth level of Factor B} 28 | 29 | \item{s1.1}{Cell standard deviation for First level of Factor A, First level of Factor B} 30 | 31 | \item{s2.1}{Cell standard deviation for Second level of Factor A, First level of Factor B} 32 | 33 | \item{s1.2}{Cell standard deviation for First level of Factor A, Second level of Factor B} 34 | 35 | \item{s2.2}{Cell standard deviation for Second level of Factor A, Second level of Factor B} 36 | 37 | \item{s1.3}{Cell standard deviation for First level of Factor A, Third level of Factor B} 38 | 39 | \item{s2.3}{Cell standard deviation for Second level of Factor A, Third level of Factor B} 40 | 41 | \item{s1.4}{Cell standard deviation for First level of Factor A, Fourth level of Factor B} 42 | 43 | \item{s2.4}{Cell standard deviation for Second level of Factor A, Fourth level of Factor B} 44 | 45 | \item{r}{Correlation between covariate and dependent variable.} 46 | 47 | \item{s}{Overall standard deviation. Sets all cell sds equal} 48 | 49 | \item{alpha}{Type I error (default is .05)} 50 | 51 | \item{factors}{Number of factors (1 or 2)} 52 | 53 | \item{n}{Sample Size per cell} 54 | } 55 | \value{ 56 | Power for One or Two Factor ANCOVA with a single covariate 57 | } 58 | \description{ 59 | Compute Power for One or Two Factor ANCOVA with a single covariate 60 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 61 | } 62 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/anova1f_3.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/anova1f_3.R 3 | \name{anova1f_3} 4 | \alias{anova1f_3} 5 | \title{Compute power for a One Factor ANOVA with three levels. 6 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | anova1f_3(m1 = NULL, m2 = NULL, m3 = NULL, s1 = NULL, s2 = NULL, 9 | s3 = NULL, n1 = NULL, n2 = NULL, n3 = NULL, alpha = 0.05) 10 | } 11 | \arguments{ 12 | \item{m1}{Mean of first group} 13 | 14 | \item{m2}{Mean of second group} 15 | 16 | \item{m3}{Mean of third group} 17 | 18 | \item{s1}{Standard deviation of first group} 19 | 20 | \item{s2}{Standard deviation of second group} 21 | 22 | \item{s3}{Standard deviation of third group} 23 | 24 | \item{n1}{Sample size for first group} 25 | 26 | \item{n2}{Sample size for second group} 27 | 28 | \item{n3}{Sample size for third group} 29 | 30 | \item{alpha}{Type I error (default is .05)} 31 | } 32 | \value{ 33 | Power for the One Factor ANOVA 34 | } 35 | \description{ 36 | Compute power for a One Factor ANOVA with three levels. 37 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 38 | } 39 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/anova1f_3c.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/anova1f_3c.R 3 | \name{anova1f_3c} 4 | \alias{anova1f_3c} 5 | \title{Compute power for a One Factor ANOVA with three levels and contrasts. 6 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | anova1f_3c(m1 = NULL, m2 = NULL, m3 = NULL, s1 = NULL, s2 = NULL, 9 | s3 = NULL, n1 = NULL, n2 = NULL, n3 = NULL, alpha = 0.05, 10 | c1 = 0, c2 = 0, c3 = 0) 11 | } 12 | \arguments{ 13 | \item{m1}{Mean of first group} 14 | 15 | \item{m2}{Mean of second group} 16 | 17 | \item{m3}{Mean of third group} 18 | 19 | \item{s1}{Standard deviation of first group} 20 | 21 | \item{s2}{Standard deviation of second group} 22 | 23 | \item{s3}{Standard deviation of third group} 24 | 25 | \item{n1}{Sample size for first group} 26 | 27 | \item{n2}{Sample size for second group} 28 | 29 | \item{n3}{Sample size for third group} 30 | 31 | \item{alpha}{Type I error (default is .05)} 32 | 33 | \item{c1}{Weight for Contrast 1 (default is 0)} 34 | 35 | \item{c2}{Weight for Contrast 2 (default is 0)} 36 | 37 | \item{c3}{Weight for Contrast 3 (default is 0)} 38 | } 39 | \value{ 40 | Power for the One Factor ANOVA 41 | } 42 | \description{ 43 | Compute power for a One Factor ANOVA with three levels and contrasts. 44 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 45 | } 46 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/anova1f_4.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/anova1f_4.R 3 | \name{anova1f_4} 4 | \alias{anova1f_4} 5 | \title{Compute power for a One Factor Between Subjects ANOVA with four levels 6 | Takes means, sds, and sample sizes for each group} 7 | \usage{ 8 | anova1f_4(m1 = NULL, m2 = NULL, m3 = NULL, m4 = NULL, s1 = NULL, 9 | s2 = NULL, s3 = NULL, s4 = NULL, n1 = NULL, n2 = NULL, 10 | n3 = NULL, n4 = NULL, alpha = 0.05) 11 | } 12 | \arguments{ 13 | \item{m1}{Mean of first group} 14 | 15 | \item{m2}{Mean of second group} 16 | 17 | \item{m3}{Mean of third group} 18 | 19 | \item{m4}{Mean of fourth group} 20 | 21 | \item{s1}{Standard deviation of first group} 22 | 23 | \item{s2}{Standard deviation of second group} 24 | 25 | \item{s3}{Standard deviation of third group} 26 | 27 | \item{s4}{Standard deviation of forth group} 28 | 29 | \item{n1}{Sample size for first group} 30 | 31 | \item{n2}{Sample size for second group} 32 | 33 | \item{n3}{Sample size for third group} 34 | 35 | \item{n4}{Sample size for fourth grou} 36 | 37 | \item{alpha}{Type I error (default is .05)} 38 | } 39 | \value{ 40 | Power for the One Factor Between Subjects ANOVA 41 | } 42 | \description{ 43 | Compute power for a One Factor Between Subjects ANOVA with four levels 44 | Takes means, sds, and sample sizes for each group 45 | } 46 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/anova1f_4c.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/anova1f_4c.R 3 | \name{anova1f_4c} 4 | \alias{anova1f_4c} 5 | \title{Compute power for a One Factor ANOVA with four levels. 6 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | anova1f_4c(m1 = NULL, m2 = NULL, m3 = NULL, m4 = NULL, s1 = NULL, 9 | s2 = NULL, s3 = NULL, s4 = NULL, n1 = NULL, n2 = NULL, 10 | n3 = NULL, n4 = NULL, alpha = 0.05, c1 = 0, c2 = 0, c3 = 0, 11 | c4 = 0) 12 | } 13 | \arguments{ 14 | \item{m1}{Mean of first group} 15 | 16 | \item{m2}{Mean of second group} 17 | 18 | \item{m3}{Mean of third group} 19 | 20 | \item{m4}{Mean of fourth group} 21 | 22 | \item{s1}{Standard deviation of first group} 23 | 24 | \item{s2}{Standard deviation of second group} 25 | 26 | \item{s3}{Standard deviation of third group} 27 | 28 | \item{s4}{Standard deviation of forth group} 29 | 30 | \item{n1}{Sample size for first group} 31 | 32 | \item{n2}{Sample size for second group} 33 | 34 | \item{n3}{Sample size for third group} 35 | 36 | \item{n4}{Sample size for fourth grou} 37 | 38 | \item{alpha}{Type I error (default is .05)} 39 | 40 | \item{c1}{Weight for Contrast 1 (default is 0)} 41 | 42 | \item{c2}{Weight for Contrast 2 (default is 0)} 43 | 44 | \item{c3}{Weight for Contrast 3 (default is 0)} 45 | 46 | \item{c4}{Weight for Contrast 4 (default is 0)} 47 | } 48 | \value{ 49 | Power for the One Factor ANOVA 50 | } 51 | \description{ 52 | Compute power for a One Factor ANOVA with four levels. 53 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 54 | } 55 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/anova2x2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/anova2x2.R 3 | \name{anova2x2} 4 | \alias{anova2x2} 5 | \title{Compute power for a Two by Two Between Subjects ANOVA with four levels. 6 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | anova2x2(m1.1 = NULL, m1.2 = NULL, m2.1 = NULL, m2.2 = NULL, 9 | s1.1 = NULL, s1.2 = NULL, s2.1 = NULL, s2.2 = NULL, 10 | n1.1 = NULL, n1.2 = NULL, n2.1 = NULL, n2.2 = NULL, 11 | alpha = 0.05, all = "OFF") 12 | } 13 | \arguments{ 14 | \item{m1.1}{Cell mean for First level of Factor A, First level of Factor B} 15 | 16 | \item{m1.2}{Cell mean for First level of Factor A, Second level of Factor B} 17 | 18 | \item{m2.1}{Cell mean for Second level of Factor A, First level of Factor B} 19 | 20 | \item{m2.2}{Cell mean for Second level of Factor A, Second level of Factor B} 21 | 22 | \item{s1.1}{Cell standard deviation for First level of Factor A, First level of Factor B} 23 | 24 | \item{s1.2}{Cell standard deviation for First level of Factor A, Second level of Factor B} 25 | 26 | \item{s2.1}{Cell standard deviation for Second level of Factor A, First level of Factor B} 27 | 28 | \item{s2.2}{Cell standard deviation for Second level of Factor A, Second level of Factor B} 29 | 30 | \item{n1.1}{Cell sample size for First level of Factor A, First level of Factor B} 31 | 32 | \item{n1.2}{Cell sample size for First level of Factor A, Second level of Factor B} 33 | 34 | \item{n2.1}{Cell sample size for Second level of Factor A, First level of Factor B} 35 | 36 | \item{n2.2}{Cell sample size for Second level of Factor A, Second level of Factor B} 37 | 38 | \item{alpha}{Type I error (default is .05)} 39 | 40 | \item{all}{Power(ALL) - Power for detecting all predictors in the model at once (default is "OFF")} 41 | } 42 | \value{ 43 | Power for the One Factor ANOVA 44 | } 45 | \description{ 46 | Compute power for a Two by Two Between Subjects ANOVA with four levels. 47 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 48 | } 49 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/anova2x2_se.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/anova2x2_se.R 3 | \name{anova2x2_se} 4 | \alias{anova2x2_se} 5 | \title{Compute power for Simple Effects in a Two by Two Between Subjects ANOVA with two levels for each factor. 6 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | anova2x2_se(m1.1 = NULL, m1.2 = NULL, m2.1 = NULL, m2.2 = NULL, 9 | s1.1 = NULL, s1.2 = NULL, s2.1 = NULL, s2.2 = NULL, 10 | n1.1 = NULL, n1.2 = NULL, n2.1 = NULL, n2.2 = NULL, 11 | alpha = 0.05) 12 | } 13 | \arguments{ 14 | \item{m1.1}{Cell mean for First level of Factor A, First level of Factor B} 15 | 16 | \item{m1.2}{Cell mean for First level of Factor A, Second level of Factor B} 17 | 18 | \item{m2.1}{Cell mean for Second level of Factor A, First level of Factor B} 19 | 20 | \item{m2.2}{Cell mean for Second level of Factor A, Second level of Factor B} 21 | 22 | \item{s1.1}{Cell standard deviation for First level of Factor A, First level of Factor B} 23 | 24 | \item{s1.2}{Cell standard deviation for First level of Factor A, Second level of Factor B} 25 | 26 | \item{s2.1}{Cell standard deviation for Second level of Factor A, First level of Factor B} 27 | 28 | \item{s2.2}{Cell standard deviation for Second level of Factor A, Second level of Factor B} 29 | 30 | \item{n1.1}{Cell sample size for First level of Factor A, First level of Factor B} 31 | 32 | \item{n1.2}{Cell sample size for First level of Factor A, Second level of Factor B} 33 | 34 | \item{n2.1}{Cell sample size for Second level of Factor A, First level of Factor B} 35 | 36 | \item{n2.2}{Cell sample size for Second level of Factor A, Second level of Factor B} 37 | 38 | \item{alpha}{Type I error (default is .05)} 39 | } 40 | \value{ 41 | Power for Simple Effects Tests in a Two By Two ANOVA 42 | } 43 | \description{ 44 | Compute power for Simple Effects in a Two by Two Between Subjects ANOVA with two levels for each factor. 45 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 46 | } 47 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/corr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/corr.R 3 | \name{corr} 4 | \alias{corr} 5 | \title{Compute power for Pearson's Correlation 6 | Takes correlation and range of values} 7 | \usage{ 8 | corr(r, nlow, nhigh, alpha = 0.05, tails = 2, by = 1) 9 | } 10 | \arguments{ 11 | \item{r}{Correlation} 12 | 13 | \item{nlow}{Starting sample size} 14 | 15 | \item{nhigh}{Ending sample size} 16 | 17 | \item{alpha}{Type I error (default is .05)} 18 | 19 | \item{tails}{one or two-tailed tests (default is 2)} 20 | 21 | \item{by}{Incremental increase in sample size from low ot high} 22 | } 23 | \value{ 24 | Power for Pearson's Correlation 25 | } 26 | \description{ 27 | Compute power for Pearson's Correlation 28 | Takes correlation and range of values 29 | } 30 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/d_prec.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d_prec.R 3 | \name{d_prec} 4 | \alias{d_prec} 5 | \title{Compute Precision Analyses for Standardized Mean Differences} 6 | \usage{ 7 | d_prec(d, nlow, nhigh, propn1 = 0.5, ci = 0.95, tails = 2, by = 1) 8 | } 9 | \arguments{ 10 | \item{d}{Standardized means difference between groups} 11 | 12 | \item{nlow}{starting sample size} 13 | 14 | \item{nhigh}{ending sample size} 15 | 16 | \item{propn1}{Proportion in First Group} 17 | 18 | \item{ci}{Type of Confidence Interval (e.g., .95)} 19 | 20 | \item{tails}{number of tails for test (default is 2)} 21 | 22 | \item{by}{Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14)} 23 | } 24 | \value{ 25 | Precision Analyses for Standardized Mean Differences 26 | } 27 | \description{ 28 | Compute Precision Analyses for Standardized Mean Differences 29 | } 30 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/depb.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/depb.R 3 | \name{depb} 4 | \alias{depb} 5 | \title{Power for Comparing Dependent Coefficients in Multiple Regression with Two or Three Predictors 6 | Requires correlations between all variables as sample size. Means, sds, and alpha are option. Also computes Power(All)} 7 | \usage{ 8 | depb(ry1, ry2, ry3 = NULL, r12, r13 = NULL, r23 = NULL, n = NULL, 9 | alpha = 0.05) 10 | } 11 | \arguments{ 12 | \item{ry1}{Correlation between DV (y) and first predictor (1)} 13 | 14 | \item{ry2}{Correlation between DV (y) and second predictor (2)} 15 | 16 | \item{ry3}{Correlation between DV (y) and third predictor (3)} 17 | 18 | \item{r12}{Correlation between first (1) and second predictor (2)} 19 | 20 | \item{r13}{Correlation between first (1) and third predictor (3)} 21 | 22 | \item{r23}{Correlation between second (2) and third predictor (3)} 23 | 24 | \item{n}{Sample size} 25 | 26 | \item{alpha}{Type I error (default is .05)} 27 | } 28 | \value{ 29 | Power for Comparing Dependent Coefficients in Multiple Regression with Two or Three Predictors 30 | } 31 | \description{ 32 | Power for Comparing Dependent Coefficients in Multiple Regression with Two or Three Predictors 33 | Requires correlations between all variables as sample size. Means, sds, and alpha are option. Also computes Power(All) 34 | } 35 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/depcorr0.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/depcorr0.R 3 | \name{depcorr0} 4 | \alias{depcorr0} 5 | \title{Compute Power for Comparing Two Dependent Correlations, No Variables in Common 6 | Takes correlations and range of values. First variable in each pair is termed predictor, second is DV} 7 | \usage{ 8 | depcorr0(r12, rxy, r1x, r1y, r2x, r2y, nlow, nhigh, alpha = 0.05, 9 | tails = 2, by = 1) 10 | } 11 | \arguments{ 12 | \item{r12}{Correlation between the predictor and DV (first set of measures)} 13 | 14 | \item{rxy}{Correlation between the predictor and DV (second set of measures)} 15 | 16 | \item{r1x}{Correlation between the predictor (first measure) and the predictor variable (first measure)} 17 | 18 | \item{r1y}{Correlation between the predictor (first measure) and the dependent variable (second measure)} 19 | 20 | \item{r2x}{Correlation between the DV (first measure) and the predictor variable (first measure)} 21 | 22 | \item{r2y}{Correlation between the DV (first measure) and the dependent variable (second measure)} 23 | 24 | \item{nlow}{Starting sample size} 25 | 26 | \item{nhigh}{Ending sample size} 27 | 28 | \item{alpha}{Type I error (default is .05)} 29 | 30 | \item{tails}{one or two-tailed tests (default is 2)} 31 | 32 | \item{by}{Incremental increase in sample size from low ot high} 33 | } 34 | \value{ 35 | Power for Comparing Two Dependent Correlations, No Variables in Common 36 | } 37 | \description{ 38 | Compute Power for Comparing Two Dependent Correlations, No Variables in Common 39 | Takes correlations and range of values. First variable in each pair is termed predictor, second is DV 40 | } 41 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/depcorr1.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/depcorr1.R 3 | \name{depcorr1} 4 | \alias{depcorr1} 5 | \title{Compute Power for Comparing Two Dependent Correlations, One Variable in Common 6 | Takes correlations and range of values} 7 | \usage{ 8 | depcorr1(r1y, r2y, r12, nlow, nhigh, alpha = 0.05, tails = 2, by = 1) 9 | } 10 | \arguments{ 11 | \item{r1y}{Correlation between the first predictor and the dependent variable} 12 | 13 | \item{r2y}{Correlation between the second predictor and the dependent variable} 14 | 15 | \item{r12}{Correlation between the first predictor and the second predictor} 16 | 17 | \item{nlow}{Starting sample size} 18 | 19 | \item{nhigh}{Ending sample size} 20 | 21 | \item{alpha}{Type I error (default is .05)} 22 | 23 | \item{tails}{one or two-tailed tests (default is 2)} 24 | 25 | \item{by}{Incremental increase in sample size from low ot high} 26 | } 27 | \value{ 28 | Power for Comparing Dependent Correlations, One Variable in Common 29 | } 30 | \description{ 31 | Compute Power for Comparing Two Dependent Correlations, One Variable in Common 32 | Takes correlations and range of values 33 | } 34 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/hello.Rd: -------------------------------------------------------------------------------- 1 | \name{hello} 2 | \alias{hello} 3 | \title{Hello, World!} 4 | \usage{ 5 | hello() 6 | } 7 | \description{ 8 | Prints 'Hello, world!'. 9 | } 10 | \examples{ 11 | hello() 12 | } 13 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/indR2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/indR2.R 3 | \name{indR2} 4 | \alias{indR2} 5 | \title{Power for Comparing Independent R2 in Multiple Regression with Two or Three Predictors 6 | Requires correlations between all variables as sample size. Means, sds, and alpha are option. Also computes Power(All)} 7 | \usage{ 8 | indR2(ry1_1, ry2_1, ry3_1 = NULL, r12_1, r13_1 = NULL, r23_1 = NULL, 9 | n1, ry1_2, ry2_2, ry3_2 = NULL, r12_2, r13_2 = NULL, r23_2 = NULL, 10 | n2, alpha = 0.05, tails = 2) 11 | } 12 | \arguments{ 13 | \item{ry1_1}{Correlation between DV (y) and first predictor (1), first test} 14 | 15 | \item{ry2_1}{Correlation between DV (y) and second predictor (2), first test} 16 | 17 | \item{ry3_1}{Correlation between DV (y) and third predictor (3), first test} 18 | 19 | \item{r12_1}{Correlation between first (1) and second predictor (2), first test} 20 | 21 | \item{r13_1}{Correlation between first (1) and third predictor (3), first test} 22 | 23 | \item{r23_1}{Correlation between second (2) and third predictor (3), first test} 24 | 25 | \item{n1}{Sample size first test} 26 | 27 | \item{ry1_2}{Correlation between DV (y) and first predictor (1), second test} 28 | 29 | \item{ry2_2}{Correlation between DV (y) and second predictor (2), second test} 30 | 31 | \item{ry3_2}{Correlation between DV (y) and third predictor (3), second test} 32 | 33 | \item{r12_2}{Correlation between first (1) and second predictor (2), second test} 34 | 35 | \item{r13_2}{Correlation between first (1) and third predictor (3), second test} 36 | 37 | \item{r23_2}{Correlation between second (2) and third predictor (3), second test} 38 | 39 | \item{n2}{Sample size second test} 40 | 41 | \item{alpha}{Type I error (default is .05)} 42 | 43 | \item{tails}{number of tails for test (default is 2)} 44 | } 45 | \value{ 46 | Power for Comparing R2 Coefficients in Multiple Regression 47 | } 48 | \description{ 49 | Power for Comparing Independent R2 in Multiple Regression with Two or Three Predictors 50 | Requires correlations between all variables as sample size. Means, sds, and alpha are option. Also computes Power(All) 51 | } 52 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/indb.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/indb.R 3 | \name{indb} 4 | \alias{indb} 5 | \title{Power for Comparing Independent Coefficients in Multiple Regression with Two or Three Predictors 6 | Requires correlations between all variables as sample size. Means, sds, and alpha are option. Also computes Power(All)} 7 | \usage{ 8 | indb(ry1_1, ry2_1, ry3_1 = NULL, r12_1, r13_1 = NULL, r23_1 = NULL, 9 | n1, ry1_2, ry2_2, ry3_2 = NULL, r12_2, r13_2 = NULL, r23_2 = NULL, 10 | n2, alpha = 0.05) 11 | } 12 | \arguments{ 13 | \item{ry1_1}{Correlation between DV (y) and first predictor (1), first test} 14 | 15 | \item{ry2_1}{Correlation between DV (y) and second predictor (2), first test} 16 | 17 | \item{ry3_1}{Correlation between DV (y) and third predictor (3), first test} 18 | 19 | \item{r12_1}{Correlation between first (1) and second predictor (2), first test} 20 | 21 | \item{r13_1}{Correlation between first (1) and third predictor (3), first test} 22 | 23 | \item{r23_1}{Correlation between second (2) and third predictor (3), first test} 24 | 25 | \item{n1}{Sample size first test} 26 | 27 | \item{ry1_2}{Correlation between DV (y) and first predictor (1), second test} 28 | 29 | \item{ry2_2}{Correlation between DV (y) and second predictor (2), second test} 30 | 31 | \item{ry3_2}{Correlation between DV (y) and third predictor (3), second test} 32 | 33 | \item{r12_2}{Correlation between first (1) and second predictor (2), second test} 34 | 35 | \item{r13_2}{Correlation between first (1) and third predictor (3), second test} 36 | 37 | \item{r23_2}{Correlation between second (2) and third predictor (3), second test} 38 | 39 | \item{n2}{Sample size second test} 40 | 41 | \item{alpha}{Type I error (default is .05)} 42 | } 43 | \value{ 44 | Power for Comparing Independent Coefficients in Multiple Regression 45 | } 46 | \description{ 47 | Power for Comparing Independent Coefficients in Multiple Regression with Two or Three Predictors 48 | Requires correlations between all variables as sample size. Means, sds, and alpha are option. Also computes Power(All) 49 | } 50 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/indcorr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/indcorr.R 3 | \name{indcorr} 4 | \alias{indcorr} 5 | \title{Compute Power for Comparing Two Independent Correlations 6 | Takes correlations and range of values} 7 | \usage{ 8 | indcorr(r1, r2, nlow, nhigh, propn1 = 0.5, alpha = 0.05, tails = 2, 9 | by = 1) 10 | } 11 | \arguments{ 12 | \item{r1}{Correlation for Group 1} 13 | 14 | \item{r2}{Correlation for Group 2} 15 | 16 | \item{nlow}{Starting sample size} 17 | 18 | \item{nhigh}{Ending sample size} 19 | 20 | \item{propn1}{Proportion of sample in first group (default is .50 for equally size groups)} 21 | 22 | \item{alpha}{Type I error (default is .05)} 23 | 24 | \item{tails}{one or two-tailed tests (default is 2)} 25 | 26 | \item{by}{Incremental increase in sample size from low ot high} 27 | } 28 | \value{ 29 | Power for Comparing Two Independent Correlations 30 | } 31 | \description{ 32 | Compute Power for Comparing Two Independent Correlations 33 | Takes correlations and range of values 34 | } 35 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/indt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/indt.R 3 | \name{indt} 4 | \alias{indt} 5 | \title{Compute power for an Independent Samples t-test 6 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | indt(m1 = NULL, m2 = NULL, s1 = NULL, s2 = NULL, n1 = NULL, 9 | n2 = NULL, alpha = 0.05) 10 | } 11 | \arguments{ 12 | \item{m1}{Mean of first group} 13 | 14 | \item{m2}{Mean of second group} 15 | 16 | \item{s1}{Standard deviation of first group} 17 | 18 | \item{s2}{Standard deviation of second group} 19 | 20 | \item{n1}{Sample size for first group} 21 | 22 | \item{n2}{Sample size for second group} 23 | 24 | \item{alpha}{Type I error (default is .05)} 25 | } 26 | \value{ 27 | Power for Independent Samples t-test 28 | } 29 | \description{ 30 | Compute power for an Independent Samples t-test 31 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 32 | } 33 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/lmm1F.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lmm1F.R 3 | \name{lmm1F} 4 | \alias{lmm1F} 5 | \title{Compute power for a One Factor Within Subjects Linear Mixed Model with up to four levels. 6 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | lmm1F(m1, m2, m3 = NA, m4 = NA, s1, s2, s3 = NULL, s4 = NULL, r12, 9 | r13 = NULL, r14 = NULL, r23 = NULL, r24 = NULL, r34 = NULL, n, 10 | alpha = 0.05) 11 | } 12 | \arguments{ 13 | \item{m1}{Mean of first time point} 14 | 15 | \item{m2}{Mean of second time point} 16 | 17 | \item{m3}{Mean of third time point} 18 | 19 | \item{m4}{Mean of fourth time point} 20 | 21 | \item{s1}{Standard deviation of first time point} 22 | 23 | \item{s2}{Standard deviation of second time point} 24 | 25 | \item{s3}{Standard deviation of third time point} 26 | 27 | \item{s4}{Standard deviation of forth time point} 28 | 29 | \item{r12}{correlation Time 1 and Time 2} 30 | 31 | \item{r13}{correlation Time 1 and Time 3} 32 | 33 | \item{r14}{correlation Time 1 and Time 4} 34 | 35 | \item{r23}{correlation Time 2 and Time 3} 36 | 37 | \item{r24}{correlation Time 2 and Time 4} 38 | 39 | \item{r34}{correlation Time 3 and Time 4} 40 | 41 | \item{n}{Sample size for first group} 42 | 43 | \item{alpha}{Type I error (default is .05)} 44 | } 45 | \value{ 46 | Power for the One Factor Within Subjects Linear Mixed Model 47 | } 48 | \description{ 49 | Compute power for a One Factor Within Subjects Linear Mixed Model with up to four levels. 50 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 51 | } 52 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/lmm1Ftrends.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lmm1Ftrends.R 3 | \name{lmm1Ftrends} 4 | \alias{lmm1Ftrends} 5 | \title{Compute power for a One Factor Within Subjects LMM Trends with up to four levels. 6 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | lmm1Ftrends(m1, m2, m3 = NA, m4 = NA, s1, s2, s3 = NULL, s4 = NULL, 9 | r12, r13 = NULL, r14 = NULL, r23 = NULL, r24 = NULL, 10 | r34 = NULL, n, alpha = 0.05) 11 | } 12 | \arguments{ 13 | \item{m1}{Mean of first time point} 14 | 15 | \item{m2}{Mean of second time point} 16 | 17 | \item{m3}{Mean of third time point} 18 | 19 | \item{m4}{Mean of fourth time point} 20 | 21 | \item{s1}{Standard deviation of first time point} 22 | 23 | \item{s2}{Standard deviation of second time point} 24 | 25 | \item{s3}{Standard deviation of third time point} 26 | 27 | \item{s4}{Standard deviation of forth time point} 28 | 29 | \item{r12}{correlation Time 1 and Time 2} 30 | 31 | \item{r13}{correlation Time 1 and Time 3} 32 | 33 | \item{r14}{correlation Time 1 and Time 4} 34 | 35 | \item{r23}{correlation Time 2 and Time 3} 36 | 37 | \item{r24}{correlation Time 2 and Time 4} 38 | 39 | \item{r34}{correlation Time 3 and Time 4} 40 | 41 | \item{n}{Sample size for first group} 42 | 43 | \item{alpha}{Type I error (default is .05)} 44 | } 45 | \value{ 46 | Power for the One Factor Within Subjects LMM Trends 47 | } 48 | \description{ 49 | Compute power for a One Factor Within Subjects LMM Trends with up to four levels. 50 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 51 | } 52 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/md_prec.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/md_precision.R 3 | \name{md_prec} 4 | \alias{md_prec} 5 | \title{Compute Precision Analyses for Mean Differences} 6 | \usage{ 7 | md_prec(m1, m2, s1, s2, nlow, nhigh, propn1 = 0.5, ci = 0.95, by = 1) 8 | } 9 | \arguments{ 10 | \item{m1}{Mean of first group} 11 | 12 | \item{m2}{Mean of second group} 13 | 14 | \item{s1}{Standard deviation of first group} 15 | 16 | \item{s2}{Standard deviation of second group} 17 | 18 | \item{nlow}{starting sample size} 19 | 20 | \item{nhigh}{ending sample size} 21 | 22 | \item{propn1}{Proportion in First Group} 23 | 24 | \item{ci}{Type of Confidence Interval (e.g., .95)} 25 | 26 | \item{by}{Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14)} 27 | } 28 | \value{ 29 | Precision Analyses for Mean Differences 30 | } 31 | \description{ 32 | Compute Precision Analyses for Mean Differences 33 | } 34 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/med.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/med.R 3 | \name{med} 4 | \alias{med} 5 | \title{Compute Power for Mediated (Indirect) Effects 6 | Requires correlations between all variables as sample size.} 7 | \usage{ 8 | med(rxm1, rxm2 = 0, rxm3 = 0, rxm4 = 0, rxy, rym1, rym2 = 0, 9 | rym3 = 0, rym4 = 0, rm1m2 = 0, rm1m3 = 0, rm1m4 = 0, 10 | rm2m3 = 0, rm2m4 = 0, rm3m4 = 0, alpha = 0.05, mvars, n) 11 | } 12 | \arguments{ 13 | \item{rxm1}{Correlation between predictor (x) and first mediator (m1)} 14 | 15 | \item{rxm2}{Correlation between predictor (x) and second mediator (m2)} 16 | 17 | \item{rxm3}{Correlation between predictor (x) and third mediator (m3)} 18 | 19 | \item{rxm4}{Correlation between predictor (x) and fourth mediator (m4)} 20 | 21 | \item{rxy}{Correlation between DV (y) and predictor (x)} 22 | 23 | \item{rym1}{Correlation between DV (y) and first mediator (m1)} 24 | 25 | \item{rym2}{Correlation between DV (y) and second mediator (m2)} 26 | 27 | \item{rym3}{Correlation DV (y) and third mediator (m3)} 28 | 29 | \item{rym4}{Correlation DV (y) and fourth mediator (m4)} 30 | 31 | \item{rm1m2}{Correlation first mediator (m1) and second mediator (m2)} 32 | 33 | \item{rm1m3}{Correlation first mediator (m1) and third mediator (m3)} 34 | 35 | \item{rm1m4}{Correlation first mediator (m1) and fourth mediator (m4)} 36 | 37 | \item{rm2m3}{Correlation second mediator (m2) and third mediator (m3)} 38 | 39 | \item{rm2m4}{Correlation second mediator (m2) and fourth mediator (m4)} 40 | 41 | \item{rm3m4}{Correlation third mediator (m3) and fourth mediator (m4)} 42 | 43 | \item{alpha}{Type I error (default is .05)} 44 | 45 | \item{mvars}{Number of Mediators} 46 | 47 | \item{n}{Sample size} 48 | } 49 | \value{ 50 | Power for Mediated (Indirect) Effects 51 | } 52 | \description{ 53 | Compute Power for Mediated (Indirect) Effects 54 | Requires correlations between all variables as sample size. 55 | } 56 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/mrc_shortcuts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/MRC_shortcuts.R 3 | \name{mrc_shortcuts} 4 | \alias{mrc_shortcuts} 5 | \title{Compute Mutliple Regression shortcuts with three predictors (will expand to handle two to five) 6 | Requires correlations between all variables as sample size. Means and sds are option. Also computes Power(All)} 7 | \usage{ 8 | mrc_shortcuts(ry1 = NULL, ry2 = NULL, ry3 = NULL, r12 = NULL, 9 | r13 = NULL, r23 = NULL, n = 100, alpha = 0.05, my = 0, m1 = 0, 10 | m2 = 0, m3 = 0, s1 = 1, s2 = 1, s3 = 1, sy = 1) 11 | } 12 | \arguments{ 13 | \item{ry1}{Correlation between DV (y) and first predictor (1)} 14 | 15 | \item{ry2}{Correlation between DV (y) and second predictor (2)} 16 | 17 | \item{ry3}{Correlation between DV (y) and third predictor (3)} 18 | 19 | \item{r12}{Correlation between first (1) and second predictor (2)} 20 | 21 | \item{r13}{Correlation between first (1) and third predictor (3)} 22 | 23 | \item{r23}{Correlation between second (2) and third predictor (3)} 24 | 25 | \item{n}{Sample size} 26 | 27 | \item{alpha}{Type I error (default is .05)} 28 | 29 | \item{my}{Mean of DV (default is 0)} 30 | 31 | \item{m1}{Mean of first predictor (default is 0)} 32 | 33 | \item{m2}{Mean of second redictor (default is 0)} 34 | 35 | \item{m3}{Mean of third predictor (default is 0)} 36 | 37 | \item{s1}{Standard deviation of first predictor (default is 1)} 38 | 39 | \item{s2}{Standard deviation of second predictor (default is 1)} 40 | 41 | \item{s3}{Standard deviation of third predictor (default is 1)} 42 | 43 | \item{sy}{Standard deviation of DV (default is 1)} 44 | 45 | \item{rep}{number of replications (default is 10000)} 46 | } 47 | \value{ 48 | Mutliple Regression shortcuts with three predictors 49 | } 50 | \description{ 51 | Compute Mutliple Regression shortcuts with three predictors (will expand to handle two to five) 52 | Requires correlations between all variables as sample size. Means and sds are option. Also computes Power(All) 53 | } 54 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/packrat/packrat.opts: -------------------------------------------------------------------------------- 1 | auto.snapshot: FALSE 2 | use.cache: FALSE 3 | print.banner.on.startup: auto 4 | vcs.ignore.lib: TRUE 5 | vcs.ignore.src: FALSE 6 | external.packages: 7 | car 8 | MASS 9 | dplyr 10 | tidyr 11 | ez 12 | nlme 13 | phia 14 | afex 15 | lavaan 16 | MBESS 17 | local.repos: 18 | load.external.packages.on.startup: TRUE 19 | ignored.packages: 20 | ignored.directories: 21 | data 22 | inst 23 | quiet.package.installation: TRUE 24 | snapshot.recommended.packages: FALSE 25 | snapshot.fields: 26 | Imports 27 | Depends 28 | LinkingTo 29 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/pairt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pairt.R 3 | \name{pairt} 4 | \alias{pairt} 5 | \title{Compute power for a Paired t-test 6 | Takes means, sd, and sample sizes. Alpha is .05 by default, alterative values may be entered by user. 7 | correlation (r) defaults to .50.} 8 | \usage{ 9 | pairt(m1 = NULL, m2 = NULL, s = NULL, n = NULL, r = NULL, 10 | alpha = 0.05) 11 | } 12 | \arguments{ 13 | \item{m1}{Mean for Pre Test} 14 | 15 | \item{m2}{Mean for Post Test} 16 | 17 | \item{s}{Standard deviation} 18 | 19 | \item{n}{Sample size} 20 | 21 | \item{r}{Correlation pre-post measures (default is .50)} 22 | 23 | \item{alpha}{Type I error (default is .05)} 24 | } 25 | \value{ 26 | Power for the Paired t-test 27 | } 28 | \description{ 29 | Compute power for a Paired t-test 30 | Takes means, sd, and sample sizes. Alpha is .05 by default, alterative values may be entered by user. 31 | correlation (r) defaults to .50. 32 | } 33 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/prop1.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/prop1.R 3 | \name{prop1} 4 | \alias{prop1} 5 | \title{Compute power for a single sample proportion test 6 | Takes phi, degrees of freedom, and a range of sameple sizes. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | prop1(p1, p0, nlow, nhigh, alpha = 0.05, tails = 2, by = 1) 9 | } 10 | \arguments{ 11 | \item{p1}{expected proportion (a.k.a. alternative proportion)} 12 | 13 | \item{p0}{null proportion} 14 | 15 | \item{nlow}{starting sample size} 16 | 17 | \item{nhigh}{ending sample size} 18 | 19 | \item{alpha}{Type I error (default is .05)} 20 | 21 | \item{tails}{number of tails for test (default is 2)} 22 | 23 | \item{by}{Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14)} 24 | } 25 | \value{ 26 | Power for Tests of Single Proportion 27 | } 28 | \description{ 29 | Compute power for a single sample proportion test 30 | Takes phi, degrees of freedom, and a range of sameple sizes. Alpha is .05 by default, alterative values may be entered by user 31 | } 32 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/propind.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/propind.R 3 | \name{propind} 4 | \alias{propind} 5 | \title{Compute power for Tests of Two Independent Proportions 6 | Takes phi, degrees of freedom, and a range of sameple sizes. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | propind(p1, p2, nlow, nhigh, nratio = 0.5, alpha = 0.05, tails = 2, 9 | by = 1) 10 | } 11 | \arguments{ 12 | \item{p1}{expected proportion Group 1} 13 | 14 | \item{p2}{expected proportion Group 2} 15 | 16 | \item{nlow}{starting sample size} 17 | 18 | \item{nhigh}{ending sample size} 19 | 20 | \item{nratio}{ratio of sample size of first group to second (default is .5 for equally sized groups)} 21 | 22 | \item{alpha}{Type I error (default is .05)} 23 | 24 | \item{tails}{number of tails for test (default is 2)} 25 | 26 | \item{by}{Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14)} 27 | } 28 | \value{ 29 | Power for Tests of Two Independent Proportions 30 | } 31 | \description{ 32 | Compute power for Tests of Two Independent Proportions 33 | Takes phi, degrees of freedom, and a range of sameple sizes. Alpha is .05 by default, alterative values may be entered by user 34 | } 35 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/r_prec.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/r_prec.R 3 | \name{r_prec} 4 | \alias{r_prec} 5 | \title{Compute Precision Analyses for Correlations 6 | This approach simply loops a function from MBESS} 7 | \usage{ 8 | r_prec(r, nlow, nhigh, ci = 0.95, by = 1) 9 | } 10 | \arguments{ 11 | \item{r}{Correlation} 12 | 13 | \item{nlow}{starting sample size} 14 | 15 | \item{nhigh}{ending sample size} 16 | 17 | \item{ci}{Type of Confidence Interval (e.g., .95)} 18 | 19 | \item{by}{Incremental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14)} 20 | } 21 | \value{ 22 | Precision Analyses for Correlations 23 | } 24 | \description{ 25 | Compute Precision Analyses for Correlations 26 | This approach simply loops a function from MBESS 27 | } 28 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/regint.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/regint.R 3 | \name{regint} 4 | \alias{regint} 5 | \title{Compute Power for Regression Interaction (Correlation/Coefficient Approach)} 6 | \usage{ 7 | regint(Group1, Group2, sx1 = 1, sx2 = 1, sy1 = 1, sy2 = 1, nlow, 8 | nhigh, alpha = 0.05, Prop_n1 = 0.5, by = 2, Estimates = 1) 9 | } 10 | \arguments{ 11 | \item{Group1}{Estimates (r or b) for Group 1} 12 | 13 | \item{Group2}{Estimates (r or b) for Group 2} 14 | 15 | \item{sx1}{Standard deviation of predictor, group 1 (defaults to 1)} 16 | 17 | \item{sx2}{Standard deviation of predictor, group 2 (defaults to 1)} 18 | 19 | \item{sy1}{Standard deviation of outcome, group 1 (defaults to 1)} 20 | 21 | \item{sy2}{Standard deviation of outcome, group 2 (defaults to 1)} 22 | 23 | \item{nlow}{starting sample size} 24 | 25 | \item{nhigh}{ending sample size} 26 | 27 | \item{alpha}{Type I error (default is .05)} 28 | 29 | \item{Prop_n1}{Proportion of Sample in First Group (defaults to equal sample sizes)} 30 | 31 | \item{by}{incrimental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14)} 32 | 33 | \item{Estimates}{1 for Correlations (default), 2 for coefficients} 34 | } 35 | \value{ 36 | Power for Regression Interaction (Correlation/Coefficient Approach) 37 | } 38 | \description{ 39 | Compute Power for Regression Interaction (Correlation/Coefficient Approach) 40 | } 41 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/regintR2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/regintR2.R 3 | \name{regintR2} 4 | \alias{regintR2} 5 | \title{Compute Power for Regression Interaction (R2 Change Approach)} 6 | \usage{ 7 | regintR2(R2Mod, R2Ch, mod_pred, ch_pred, nlow, nhigh, by = 1, 8 | alpha = 0.05) 9 | } 10 | \arguments{ 11 | \item{R2Mod}{Full Model R2} 12 | 13 | \item{R2Ch}{Change in R2 Added by Interaction} 14 | 15 | \item{mod_pred}{Full Model Number of Predictors} 16 | 17 | \item{ch_pred}{Change Model Number of Predictors} 18 | 19 | \item{nlow}{starting sample size} 20 | 21 | \item{nhigh}{ending sample size} 22 | 23 | \item{by}{incrimental increase in sample (e.g. nlow = 10, nhigh = 24, by = 2, produces estimates of 10, 12, and 14)} 24 | 25 | \item{alpha}{Type I error (default is .05)} 26 | } 27 | \value{ 28 | Power for Regression Interaction (R2 Change Approach) 29 | } 30 | \description{ 31 | Compute Power for Regression Interaction (R2 Change Approach) 32 | } 33 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/tfromd.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tfromd.R 3 | \name{tfromd} 4 | \alias{tfromd} 5 | \title{Compute power for a t test using d statistic 6 | Takes d, sample size range, type of test, and tails.} 7 | \usage{ 8 | tfromd(d, nlow, nhigh, alpha = 0.05, test = "I", tails = 2, by = 1) 9 | } 10 | \arguments{ 11 | \item{d}{standardize mean difference (Cohen's d)} 12 | 13 | \item{nlow}{Starting sample size} 14 | 15 | \item{nhigh}{Ending sample size} 16 | 17 | \item{alpha}{Type I error (default is .05)} 18 | 19 | \item{test}{"I" for independent, "P" for paired} 20 | 21 | \item{tails}{one or two-tailed tests (default is 2)} 22 | 23 | \item{by}{Incremental increase in sample size from low ot high} 24 | } 25 | \value{ 26 | Power for the t-test from d statistic 27 | } 28 | \description{ 29 | Compute power for a t test using d statistic 30 | Takes d, sample size range, type of test, and tails. 31 | } 32 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/win1F.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/win1F.R 3 | \name{win1F} 4 | \alias{win1F} 5 | \title{Compute power for a One Factor Within Subjects ANOVA with up to four levels. 6 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | win1F(m1, m2, m3 = NA, m4 = NA, s1, s2, s3 = NULL, s4 = NULL, r12, 9 | r13 = NULL, r14 = NULL, r23 = NULL, r24 = NULL, r34 = NULL, n, 10 | alpha = 0.05) 11 | } 12 | \arguments{ 13 | \item{m1}{Mean of first time point} 14 | 15 | \item{m2}{Mean of second time point} 16 | 17 | \item{m3}{Mean of third time point} 18 | 19 | \item{m4}{Mean of fourth time point} 20 | 21 | \item{s1}{Standard deviation of first time point} 22 | 23 | \item{s2}{Standard deviation of second time point} 24 | 25 | \item{s3}{Standard deviation of third time point} 26 | 27 | \item{s4}{Standard deviation of forth time point} 28 | 29 | \item{r12}{correlation Time 1 and Time 2} 30 | 31 | \item{r13}{correlation Time 1 and Time 3} 32 | 33 | \item{r14}{correlation Time 1 and Time 4} 34 | 35 | \item{r23}{correlation Time 2 and Time 3} 36 | 37 | \item{r24}{correlation Time 2 and Time 4} 38 | 39 | \item{r34}{correlation Time 3 and Time 4} 40 | 41 | \item{n}{Sample size for first group} 42 | 43 | \item{alpha}{Type I error (default is .05)} 44 | } 45 | \value{ 46 | Power for the One Factor Within Subjects ANOVA 47 | } 48 | \description{ 49 | Compute power for a One Factor Within Subjects ANOVA with up to four levels. 50 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 51 | } 52 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/man/win1Ftrends.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/win1Ftrends.R 3 | \name{win1Ftrends} 4 | \alias{win1Ftrends} 5 | \title{Compute power for a One Factor Within Subjects Trends with up to four levels. 6 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user} 7 | \usage{ 8 | win1Ftrends(m1, m2, m3 = NA, m4 = NA, s1, s2, s3 = NULL, s4 = NULL, 9 | r12, r13 = NULL, r14 = NULL, r23 = NULL, r24 = NULL, 10 | r34 = NULL, n, alpha = 0.05) 11 | } 12 | \arguments{ 13 | \item{m1}{Mean of first time point} 14 | 15 | \item{m2}{Mean of second time point} 16 | 17 | \item{m3}{Mean of third time point} 18 | 19 | \item{m4}{Mean of fourth time point} 20 | 21 | \item{s1}{Standard deviation of first time point} 22 | 23 | \item{s2}{Standard deviation of second time point} 24 | 25 | \item{s3}{Standard deviation of third time point} 26 | 27 | \item{s4}{Standard deviation of forth time point} 28 | 29 | \item{r12}{correlation Time 1 and Time 2} 30 | 31 | \item{r13}{correlation Time 1 and Time 3} 32 | 33 | \item{r14}{correlation Time 1 and Time 4} 34 | 35 | \item{r23}{correlation Time 2 and Time 3} 36 | 37 | \item{r24}{correlation Time 2 and Time 4} 38 | 39 | \item{r34}{correlation Time 3 and Time 4} 40 | 41 | \item{n}{Sample size for first group} 42 | 43 | \item{alpha}{Type I error (default is .05)} 44 | } 45 | \value{ 46 | Power for the One Factor Within Subjects Trends 47 | } 48 | \description{ 49 | Compute power for a One Factor Within Subjects Trends with up to four levels. 50 | Takes means, sds, and sample sizes for each group. Alpha is .05 by default, alterative values may be entered by user 51 | } 52 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/pwr2ppl.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 | PackageRoxygenize: rd,collate,namespace,vignette 22 | -------------------------------------------------------------------------------- /validation_files/pwr2ppl/pwr2ppl_0.1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/pwr2ppl/pwr2ppl_0.1.0.tar.gz -------------------------------------------------------------------------------- /validation_files/screenshots/3x6_correlation_matrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/3x6_correlation_matrix.png -------------------------------------------------------------------------------- /validation_files/screenshots/PS2000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/PS2000.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_1.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_10.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_11.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_12.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_13.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_14.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_15.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_2.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_3.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_4.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_5.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_6.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_7.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_8.png -------------------------------------------------------------------------------- /validation_files/screenshots/gpower_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/screenshots/gpower_9.png -------------------------------------------------------------------------------- /validation_files/validation_effect_sizes_between_files/figure-markdown_github/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_effect_sizes_between_files/figure-markdown_github/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /validation_files/validation_effect_sizes_between_files/figure-markdown_github/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_effect_sizes_between_files/figure-markdown_github/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /validation_files/validation_effect_sizes_between_files/figure-markdown_github/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_effect_sizes_between_files/figure-markdown_github/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /validation_files/validation_mlm.R: -------------------------------------------------------------------------------- 1 | library(tidyverse) # for data wrangling and visualisation 2 | library(afex) # for LMEM and ANOVA 3 | library(faux) # devtools::install_github("debruine/faux") 4 | library(broom.mixed) # for extracting data from mixed effect models 5 | set.seed(8675309) # this makes sure your script uses the same set of random numbers each time you run the full script 6 | # (never set this inside a function or loop) 7 | # 8 | iat_data <- readr::read_csv("iat_data.csv") 9 | iat_data <- readr::read_csv("https://raw.githubusercontent.com/debruine/sim_mem/master/iat_data.csv") 10 | 11 | 12 | agg_data <- iat_data %>% 13 | group_by(sub_id, condition) %>% 14 | summarise(rt = mean(rt)) %>% 15 | ungroup() 16 | 17 | agg_data %>% 18 | ggplot(aes(condition, rt, fill = condition)) + 19 | geom_violin(trim = FALSE, show.legend = FALSE) + 20 | geom_boxplot(fill = "white", width = 0.2, show.legend = FALSE) + 21 | scale_fill_manual(values = c("red", "dodgerblue")) 22 | 23 | t.test(rt~condition, agg_data, paired = TRUE) 24 | 25 | vars <- agg_data %>% 26 | unite(var, condition) %>% 27 | spread(var, rt) %>% 28 | select(-sub_id) 29 | 30 | sub_n <- nrow(vars) 31 | m1 <- mean(vars$congruent) 32 | m2 <- mean(vars$incongruent) 33 | sd1 <- sd(vars$congruent) 34 | sd2 <- sd(vars$incongruent) 35 | r <- cor(vars$congruent, vars$incongruent) 36 | 37 | design_result_5 <- ANOVA_design(string = "2w", 38 | n = 20, 39 | mu = c(m1, m2), sd = mean(c(sd1, sd2)), 40 | r = r, 41 | labelnames = c("condition", "congruent", "incongruent")) 42 | power_result_5 <- ANOVA_power(design_result_5, alpha_level = 0.01, p_adjust = "none", nsims = nsims, seed = 2019, verbose = TRUE) 43 | -------------------------------------------------------------------------------- /validation_files/validation_power_between_files/figure-markdown_github/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_power_between_files/figure-markdown_github/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /validation_files/validation_power_between_files/figure-markdown_github/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_power_between_files/figure-markdown_github/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /validation_files/validation_power_between_files/figure-markdown_github/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_power_between_files/figure-markdown_github/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /validation_files/validation_power_between_files/figure-markdown_github/unnamed-chunk-9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_power_between_files/figure-markdown_github/unnamed-chunk-9-1.png -------------------------------------------------------------------------------- /validation_files/validation_power_between_within.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | ```{r setup, include=TRUE} 6 | knitr::opts_chunk$set(echo = TRUE) 7 | nsims <- 10000 #set number of simulations 8 | library(mvtnorm) 9 | library(afex) 10 | library(emmeans) 11 | library(ggplot2) 12 | library(gridExtra) 13 | library(reshape2) 14 | 15 | ``` 16 | 17 | ## Validation of Power in Mixed ANOVA 18 | 19 | We install the functions: 20 | 21 | ```{r} 22 | # Install the two functions from GitHub by running the code below: 23 | 24 | source("https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/master/ANOVA_design.R") 25 | source("https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/master/ANOVA_power.R") 26 | ``` 27 | 28 | ## Two by two ANOVA, within-between design 29 | 30 | We can simulate a Two-Way ANOVA with a specific alpha, sample size and effect size, to achieve a specified statistical power. We wil try to reproduce the power analysis by g*power for an F-test, ANOVA: Repeated measures, within-between interaction. 31 | 32 | ![](screenshots/gpower_5.png) 33 | 34 | For the 2way interaction, the result should be a power of 91.25% is we have a total samplesize of 46. Since we have 2 groups in the between factor that means the sample size per group is 2 (and both these groups collect 2 repeated measures). 35 | 36 | ```{r} 37 | mu <- c(-0.25, 0.25, 0.25, -0.25) 38 | n <- 23 39 | sd <- 1 40 | r <- 0.5 41 | string = "2w*2b" 42 | alpha_level <- 0.05 43 | p_adjust = "none" 44 | labelnames = c("age", "old", "young", "color", "blue", "red") 45 | design_result <- ANOVA_design(string = string, 46 | n = n, 47 | mu = mu, 48 | sd = sd, 49 | r = r, 50 | p_adjust = p_adjust, 51 | labelnames = labelnames) 52 | 53 | 54 | simulation_result <- ANOVA_power(design_result, alpha = 0.05, nsims = nsims) 55 | 56 | ``` 57 | 58 | ## Two by two ANOVA, within-between design Variation 1 59 | 60 | We can simulate the same Two-Way ANOVA increasing the correlation to 0.7. 61 | 62 | ![](screenshots/gpower_6.png) 63 | 64 | 65 | ```{r} 66 | mu <- c(-0.25, 0.25, 0.25, -0.25) 67 | n <- 23 68 | sd <- 1 69 | r <- 0.7 70 | string = "2w*2b" 71 | alpha_level <- 0.05 72 | p_adjust = "none" 73 | labelnames = c("age", "old", "young", "color", "blue", "red") 74 | design_result <- ANOVA_design(string = string, 75 | n = n, 76 | mu = mu, 77 | sd = sd, 78 | r = r, 79 | p_adjust = p_adjust, 80 | labelnames = labelnames) 81 | 82 | 83 | simulation_result <- ANOVA_power(design_result, alpha = 0.05, nsims = nsims) 84 | 85 | ``` 86 | -------------------------------------------------------------------------------- /validation_files/validation_power_between_within.md: -------------------------------------------------------------------------------- 1 | 2 | Validation of Power in Mixed ANOVA 3 | ---------------------------------- 4 | 5 | We install the functions: 6 | 7 | ``` r 8 | # Install the two functions from GitHub by running the code below: 9 | 10 | source("https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/master/ANOVA_design.R") 11 | source("https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/master/ANOVA_power_ttest.R") 12 | ``` 13 | 14 | Two by two ANOVA, within-between design 15 | --------------------------------------- 16 | 17 | We can simulate a Two-Way ANOVA with a specific alpha, sample size and effect size, to achieve a specified statistical power. 18 | 19 | ``` r 20 | mu_from_ES <- function(K, ES){ # provides the vector of population means for a given population ES and nr of groups 21 | f2 <- ES/(1-ES) 22 | if(K == 2){ 23 | a <- sqrt(f2) 24 | muvec <- c(-a,a) 25 | } 26 | if(K == 3){ 27 | a <- sqrt(3*f2/2) 28 | muvec <- c(-a, 0, a) 29 | } 30 | if(K == 4){ 31 | a <- sqrt(f2) 32 | muvec <- c(-a, -a, a, a) 33 | } # note: function gives error when K not 2,3,4. But we don't need other K. 34 | return(muvec) 35 | } 36 | ``` 37 | 38 | ``` r 39 | mu <- c(-0.25, 0.25, 0.25, -0.25) 40 | n <- 23 41 | sd <- 1 42 | r <- 0.5 43 | string = "2w*2b" 44 | alpha_level <- 0.05 45 | p_adjust = "none" 46 | labelnames = c("age", "old", "young", "color", "blue", "red") 47 | design_result <- ANOVA_design(string = string, 48 | n = n, 49 | mu = mu, 50 | sd = sd, 51 | r = r, 52 | p_adjust = p_adjust, 53 | labelnames = labelnames) 54 | ``` 55 | 56 | ![](validation_power_between_within_files/figure-markdown_github/unnamed-chunk-3-1.png) 57 | 58 | ``` r 59 | simulation_result <- ANOVA_power(design_result, alpha = 0.05, nsims = nsims) 60 | ``` 61 | 62 | ## Power and Effect sizes for ANOVA tests 63 | ## power effect size 64 | ## anova_color 5.05 0.0101 65 | ## anova_age 5.28 0.0104 66 | ## anova_color:age 91.40 0.2085 67 | ## 68 | ## Power and Effect sizes for contrasts 69 | ## power effect size 70 | ## p_age_old_color_blue_age_old_color_red 38.05 0.5115 71 | ## p_age_old_color_blue_age_young_color_blue 62.38 0.5171 72 | ## p_age_old_color_blue_age_young_color_red 5.15 0.0008 73 | ## p_age_old_color_red_age_young_color_blue 4.85 -0.0033 74 | ## p_age_old_color_red_age_young_color_red 63.47 -0.5184 75 | ## p_age_young_color_blue_age_young_color_red 38.08 -0.5068 76 | -------------------------------------------------------------------------------- /validation_files/validation_power_between_within_files/figure-markdown_github/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_power_between_within_files/figure-markdown_github/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /validation_files/validation_power_between_within_files/figure-markdown_github/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_power_between_within_files/figure-markdown_github/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /validation_files/validation_power_within_Brysbaert_files/figure-markdown_github/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_power_within_Brysbaert_files/figure-markdown_github/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /validation_files/validation_power_within_Brysbaert_files/figure-markdown_github/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_power_within_Brysbaert_files/figure-markdown_github/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /validation_files/validation_power_within_files/figure-markdown_github/gpower_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_power_within_files/figure-markdown_github/gpower_1.png -------------------------------------------------------------------------------- /validation_files/validation_power_within_files/figure-markdown_github/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lakens/ANOVA_power_simulation/bca1463e738f2500d2fbb8b85d2193c0bf4169b3/validation_files/validation_power_within_files/figure-markdown_github/unnamed-chunk-4-1.png --------------------------------------------------------------------------------