Making expression containing ttest results
expr_t_parametric( data, x, y, subject.id = NULL, paired = FALSE, k = 2L, conf.level = 0.95, effsize.type = "g", var.equal = FALSE, output = "expression", ... )
data  A dataframe (or a tibble) from which variables specified are to be taken. A matrix or tables will not be accepted. 

x  The grouping variable from the dataframe 
y  The response (a.k.a. outcome or dependent) variable from the
dataframe 
subject.id  In case of repeated measures design ( 
paired  Logical that decides whether the experimental design is
repeated measures/withinsubjects or betweensubjects. The default is

k  Number of digits after decimal point (should be an integer)
(Default: 
conf.level  Scalar between 0 and 1. If unspecified, the defaults return

effsize.type  Type of effect size needed for parametric tests. The
argument can be 
var.equal  a logical variable indicating whether to treat the
variances in the samples as equal. If 
output  If 
...  Additional arguments (currently ignored). 
Expression containing details from results of a twosample test and effect size plus confidence intervals.
Cohen's d is calculated in the traditional fashion as the difference between means or mean minus mu divided by the estimated standardized deviation. By default Hedge's correction is applied (N3)/(N2.25) to produce g. For independent samples ttest, there are two possibilities implemented. If the ttest did not make a homogeneity of variance assumption, (the Welch test), the variance term will mirror the Welch test, otherwise a pooled and weighted estimate is used. If a paired samples ttest was requested, then effect size desired is based on the standard deviation of the differences.
The computation of the confidence intervals defaults to a use of noncentral Studentt distributions.
When computing confidence intervals the variance of the effect size d or g is computed using the conversion formula reported in Cooper et al. (2009)
((n1+n2)/(n1*n2) + .5*d^2/df) * ((n1+n2)/df)
(independent samples)
sqrt(((1 / n) + (d^2 / n)) * 2 * (1  r))
(paired case)
For more details, see https://indrajeetpatil.github.io/statsExpressions/articles/stats_details.html
# for reproducibility set.seed(123) library(statsExpressions) # creating a smaller dataset msleep_short < dplyr::filter(ggplot2::msleep, vore %in% c("carni", "herbi")) # with defaults expr_t_parametric( data = msleep_short, x = vore, y = sleep_rem )#> paste(italic("t")["Welch"], "(", "10.89", ") = ", "1.49", ", ", #> italic("p"), " = ", "0.164", ", ", widehat(italic("g"))["Hedge"], #> " = ", "0.61", ", CI"["95%"], " [", "0.19", ", ", "1.28", #> "]", ", ", italic("n")["obs"], " = ", 34L)# changing defaults (getting expression as output) expr_t_parametric( data = msleep_short, x = vore, y = sleep_rem, var.equal = TRUE, effsize.type = "d" )#> paste(italic("t")["Student"], "(", "32", ") = ", "1.95", ", ", #> italic("p"), " = ", "0.060", ", ", widehat(italic("d"))["Cohen"], #> " = ", "0.73", ", CI"["95%"], " [", "0.03", ", ", "1.49", #> "]", ", ", italic("n")["obs"], " = ", 34L)