subtitle_t_parametric
Making text subtitle for the t-test (between-/within-subjects designs).
Making text subtitle for the t-test (between-/within-subjects designs).
Usage
subtitle_t_parametric(data, x, y, paired = FALSE, effsize.type = "g",
effsize.noncentral = TRUE, conf.level = 0.95, var.equal = FALSE,
k = 2, ...)
Arguments
- 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
data
.- y
The response (a.k.a. outcome or dependent) variable from the dataframe
data
.- paired
a logical indicating whether you want a paired t-test.
- effsize.type
Type of effect size needed for parametric tests. The argument can be
"biased"
("d"
for Cohen's d for t-test;"partial_eta"
for partial eta-squared for anova) or"unbiased"
("g"
Hedge's g for t-test;"partial_omega"
for partial omega-squared for anova)).- effsize.noncentral
Logical indicating whether to use non-central t-distributions for computing the confidence interval for Cohen's d or Hedge's g (Default:
TRUE
).- conf.level
Scalar between 0 and 1. If unspecified, the defaults return
95%
lower and upper confidence intervals (0.95
).- var.equal
a logical variable indicating whether to treat the variances in the samples as equal. If
TRUE
, then a simple F test for the equality of means in a one-way analysis of variance is performed. IfFALSE
, an approximate method of Welch (1951) is used, which generalizes the commonly known 2-sample Welch test to the case of arbitrarily many samples.- k
Number of digits after decimal point (should be an integer) (Default:
k = 2
).- ...
Additional arguments.
Details
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 (N-3)/(N-2.25) to produce g. For independent samples t-test, there are two possibilities implemented. If the t-test 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 t-test 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
non-central Student-t distributions (effsize.noncentral = TRUE
);
otherwise a central distribution is used.
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)
See Also
subtitle_t_parametric
Examples
# NOT RUN {
# creating a smaller dataset
msleep_short <- dplyr::filter(
.data = ggplot2::msleep,
vore %in% c("carni", "herbi")
)
# with defaults
subtitle_t_parametric(
data = msleep_short,
x = vore,
y = sleep_rem
)
# changing defaults
subtitle_t_parametric(
data = msleep_short,
x = vore,
y = sleep_rem,
var.equal = TRUE,
k = 2,
effsize.type = "d"
)
# }