Computes t-tests for one group variable and specified test variables. If no variables are specified, all numeric (integer or double) variables are used.
t_test( data, group_var, ..., var.equal = TRUE, paired = FALSE, pooled_sd = TRUE, levels = NULL, case_var = NULL )
data | a tibble |
---|---|
group_var | group variable (column name) |
... | test variables (column names). Leave empty to compute t-tests for all numeric variables in data. |
var.equal | a logical variable indicating whether to treat the two
variances as being equal. If |
paired | a logical indicating whether you want a paired t-test. Defaults
to |
pooled_sd | a logical indicating whether to use the pooled standard
deviation in the calculation of Cohen's d. Defaults to |
levels | optional: a vector of length two specifying the two levels of the group variable. |
case_var | optional: case-identifying variable (column name). If you
set |
a tibble
WoJ %>% t_test(temp_contract, autonomy_selection, autonomy_emphasis)#> # A tibble: 2 x 10 #> Variable M_Permanent SD_Permanent M_Temporary SD_Temporary Delta_M t df #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 autonom~ 3.91 0.755 3.70 0.932 0.212 1.96 998 #> 2 autonom~ 4.12 0.768 3.89 0.870 0.237 2.17 995 #> # ... with 2 more variables: p <dbl>, d <dbl>WoJ %>% t_test(temp_contract)#> # A tibble: 11 x 10 #> Variable M_Permanent SD_Permanent M_Temporary SD_Temporary Delta_M t #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 autonomy_se~ 3.91 0.755 3.70 0.932 0.212 1.96 #> 2 autonomy_em~ 4.12 0.768 3.89 0.870 0.237 2.17 #> 3 ethics_1 1.57 0.850 1.98 0.990 -0.414 -3.41 #> 4 ethics_2 3.24 1.26 3.51 1.23 -0.269 -1.51 #> 5 ethics_3 2.37 1.12 2.28 0.928 0.0862 0.549 #> 6 ethics_4 2.53 1.24 2.57 1.22 -0.0323 -0.185 #> 7 work_experi~ 17.7 10.5 11.3 11.8 6.42 4.29 #> 8 trust_parli~ 3.07 0.797 3.02 0.772 0.0539 0.480 #> 9 trust_gover~ 2.87 0.847 2.64 0.811 0.229 1.92 #> 10 trust_parti~ 2.43 0.724 2.36 0.736 0.0719 0.703 #> 11 trust_polit~ 2.53 0.707 2.40 0.689 0.136 1.37 #> # ... with 3 more variables: df <dbl>, p <dbl>, d <dbl>WoJ %>% t_test(employment, autonomy_selection, autonomy_emphasis, levels = c("Full-time", "Freelancer"))#> # A tibble: 2 x 10 #> Variable `M_Full-time` `SD_Full-time` M_Freelancer SD_Freelancer Delta_M t #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 autonom~ 3.90 0.782 3.76 0.993 0.139 2.03 #> 2 autonom~ 4.12 0.781 3.90 0.852 0.217 3.29 #> # ... with 3 more variables: df <dbl>, p <dbl>, d <dbl>