Computes the optimal significance level for two samples (different sizes) t-tests of means
OptSig.t2n(ncp=NULL,d=NULL,n1=NULL,n2=NULL,p=0.5,k=1,alternative="two.sided",Figure=TRUE)
Non-centrality parameter
Effect size
umber of observations in the first sample
umber of observations in the second sample
prior probability for H0, default is p = 0.5
relative loss from Type I and II errors, k = L2/L1, default is k = 1
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less"
show graph if TRUE (default); No graph if FALSE
Optimal level of significance
Type II error probability at the optimal level
Refer to Kim and Choi (2020) for the details of k and p
Either ncp or d value should be specified.
In a general term, if X ~ N(mu,sigma^2); let H0:mu = mu0; and H1:mu = mu1;
ncp = sqrt(n)(mu1-mu0)/sigma
d = (mu1-mu0)/sigma: Cohen's d
Kim and Choi, 2020, Choosing the Level of Significance: A Decision-theoretic Approach: Abacus: a Journal of Accounting, Finance and Business Studies. Wiley. <https://doi.org/10.1111/abac.12172>
Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Hillsdale,NJ: Lawrence Erlbaum.
Stephane Champely (2017). pwr: Basic Functions for Power Analysis. R package version 1.2-1. https://CRAN.R-project.org/package=pwr
Kim, Jae H., 2020, Decision-theoretic hypothesis testing: A primer with R package OptSig, The American Statistician. <https://doi.org/10.1080/00031305.2020.1750484.>
# NOT RUN {
OptSig.t2n(d=0.6,n1=90,n2=60,alternative="greater")
# }
Run the code above in your browser using DataLab