sjstats icon indicating copy to clipboard operation
sjstats copied to clipboard

Suggestion: support for t-tests

Open cschwem2er opened this issue 9 years ago • 3 comments

Hi,

as sd-tests and t-tests in R do not provide a lot of information, adding a table function in sjPlot would be very useful.

This is the output of a paired t-test in Stata (see #189): image It includes everything that is of interest (group specific and difference wise), means, standard deviations, confidence intervals, nr. of observations, df's, p values. In comparison this is the t-test in R: image

For independent two sample t-tests, there could either be a separate function to check for equal variances (var.test in base R), or the t-test function could have a parameter, e.g.var.equal, with options auto, TRUE, or FALSE. In the case of auto, the function could automatically check for variance equality and adjust the degrees of freedom computation if necessary.

cschwem2er avatar Mar 01 '17 14:03 cschwem2er

In the meantime, you can pipe that t.test output into broom::tidy, which should give you all the information you might need. You can then pretty up the output via sjt.df or pixiedust, as I do in tadaatoolbox::tadaa_t.test.

jemus42 avatar Jun 20 '17 15:06 jemus42

Do you have a reproducible example that resembles the Stata output?

strengejacke avatar Nov 10 '18 13:11 strengejacke

Hi, should be easier with the efc dataset:

library(sjmisc)
data(efc)
t.test(c82cop1 ~ e16sex, data = efc, var.equal = TRUE)

	Two Sample t-test

data:  c82cop1 by e16sex
t = 0.11281, df = 898, p-value = 0.9102
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -0.07671384  0.08607089
sample estimates:
mean in group 1 mean in group 2 
       3.122034        3.117355 

image

cschwem2er avatar Nov 18 '18 18:11 cschwem2er