critical_t2s
critical_t2s.Rd
The function allows to calculate cohen's d and critical d for a two samples t-test.
Usage
critical_t2s(
m1 = NULL,
m2 = NULL,
t = NULL,
sd1 = NULL,
sd2 = NULL,
n1,
n2,
se = NULL,
df = NULL,
var.equal = FALSE,
hypothesis = c("two.sided", "greater", "less"),
conf.level = 0.95
)
Arguments
- m1
a number representing the mean of group 1.
- m2
a number representing the mean of group 2.
- t
the t value.
- sd1
a number representing the standard deviation of group 1.
- sd2
a number representing the standard deviation of group 2.
- n1
a number corresponding to the sample size of group 1.
- n2
a number corresponding to the sample size of group 2.
- se
a number corresponding to the standard error.
- df
degrees of freedom.
- var.equal
a logical variable indicating whether to treat the two variances as being equal.
- hypothesis
a character string indicating the alternative hypothesis ("less", "greater" or "two.tailed").
- conf.level
the confidence level to set the confidence interval, default is set to 0.95.
Value
the output returns a d
which is the Cohen's d, the critical d (dc
) which is the minimum value for which to get a significant result with a given sample, the bc
is the numerator of the formula from which the d is calculated, se
which is the standard error, df
are the degrees of freedom, then it also gives the g
and gc
which are respectively d
and dc
with Hedfer's Correction for small samples.
Examples
# critical value from summary statistics
m1 <- 0.5
m2 <- 1.0
sd1 <- 1
sd2 <- 1.5
n1 <- 30
n2 <- 35
critical_t2s(m1 = m1, m2 = m2, sd1 = sd1, sd2 = sd2, n1 = n1, n2 = n2)
#> $d
#> [1] -0.3922323
#>
#> $dc
#> [1] 0.4977544
#>
#> $bc
#> [1] 0.625058
#>
#> $se
#> [1] 0.3124405
#>
#> $df
#> [1] 59.61036
#>
#> $g
#> [1] -0.387273
#>
#> $gc
#> [1] 0.491461
#>
# critical value from the t statistic
se <- sqrt(sd1^2 / n1 + sd2^2 / n2)
t <- (m1 - m2) / se
critical_t2s(t = t, n1 = n1, n2 = n2, se = se) # se only required for calculating bc
#> Warning: When var.equal = FALSE the critical value calculated from t assume sd1 = sd2!
#> $d
#> [1] -0.3981665
#>
#> $dc
#> [1] 0.4972005
#>
#> $bc
#> [1] 0.6243625
#>
#> $se
#> [1] 0.3124405
#>
#> $df
#> [1] 63
#>
#> $g
#> [1] -0.3934044
#>
#> $gc
#> [1] 0.4912539
#>