Practical t-test Power Analysis with R




Power analysis based on the analytical t-test is an important aspect of a research study to determine the sample size required to detect the effect for the comparison of two means. The current paper presents a reader-friendly procedure for carrying out the t-test power analysis using the various R add-on packages. While there is a growing of R users in the academic that uses R as the base for carrying out research, there is a lack of reference that discusses both frequentist and Bayesian approaches and point out their distinct features for t-test power analysis. The practical aspects of the consequences of unequal variances and sample sizes are often neglected and this paper discusses and illustrates using the graphical power curve. A written R function and several programs are used to illustrate the usefulness of choosing an appropriate sample size under the frequentist approach. The Bayes factor is introduced to show its expediency to generate the required sample size under the Bayesian approach. Researchers and practitioners with intervention research using the t-test to carry out hypothesis testing will find this paper a commendable power analysis reference to design their project.