Feature request: Have t.test return (group-wise) SD and N
Lm returns all information necessary to reconstruct summary statistics by group. However, t.test only returns the group means, and not the group SDs, or even the group Ns. These cannot be reconstructed from the test statistic and df, because the df are already pooled, except under a very strict assumption of equality of groups and variances.
I need these summary statistics for a package that performs Bayesian inference for frequentist analyses, through normal approximation of the posterior. To make the package as user friendly as possible, I would like it to have S3 methods for commonly used frequentist analyses in R, such as: lm and t.test.
As per the R-project feature request guidelines, I would like to gauge how people feel about adding functionality to t.test, so that it will return either the model data, as lm() does, or full summary statistics (per group)? I can mask the t.test function with an enhanced version, but I feel like there is value in making this functionality available to all.
Thank you sincerely for your input. Below is a reproducible example, illustrating the problem.
# t.test model
m_t <- t.test(d$Petal.Length[1:50], d$Petal.Length[51:100], var.equal = TRUE)
# Extract group means:
# Extract group SDs:
# Not available
# Extract group Ns:
# Not available
Dr. Caspar J. van Lissa
Assistant professor of developmental data science
Utrecht University, dept. Methodology & Statistics
Sjoerd Groenmangebouw C1.01, 3584CH Utrecht, the Netherlands. Secretariat: +31 30 253 4438