d_ind_t: Cohen's d for Independent Samples Using the Pooled SD

View source: R/d_ind_t.R

d_ind_tR Documentation

Cohen's d for Independent Samples Using the Pooled SD

Description

Compute Cohen's d_s for between-subjects designs and a noncentral-t confidence interval using the **pooled standard deviation** as the denominator.

Usage

d_ind_t(m1, m2, sd1, sd2, n1, n2, a = 0.05)

Arguments

m1

Mean of group one.

m2

Mean of group two.

sd1

Standard deviation of group one.

sd2

Standard deviation of group two.

n1

Sample size of group one.

n2

Sample size of group two.

a

Significance level (alpha) for the confidence interval. Must be in (0, 1).

Details

The pooled standard deviation is:

s_{pooled} = \sqrt{ \frac{ (n_1 - 1)s_1^2 + (n_2 - 1)s_2^2 } {n_1 + n_2 - 2} }

Cohen's d_s is then:

d_s = \frac{m_1 - m_2}{s_{pooled}}

The corresponding t-statistic is:

t = \frac{m_1 - m_2}{ \sqrt{ s_{pooled}^2/n_1 + s_{pooled}^2/n_2 }}

See the online example for additional context: Learn more on our example page.

Value

A list with the following elements:

d

Cohen's d_s.

dlow

Lower limit of the (1-\alpha) confidence interval for d_s.

dhigh

Upper limit of the (1-\alpha) confidence interval for d_s.

M1, M2

Group means.

sd1, sd2

Standard deviations for each group.

se1, se2

Standard errors for each group mean.

M1low, M1high, M2low, M2high

Confidence interval bounds for each group mean.

spooled

Pooled standard deviation.

sepooled

Pooled standard error.

n1, n2

Group sample sizes.

df

Degrees of freedom (n_1 - 1 + n_2 - 1).

t

t-statistic.

p

p-value.

estimate

APA-style formatted string for reporting d_s and its CI.

statistic

APA-style formatted string for reporting the t-statistic and p-value.

Examples

# The following example is derived from the "indt_data" dataset
# included in MOTE.

# A forensic psychologist examined whether being hypnotized during recall
# affects how well a witness remembers facts about an event.

t.test(correctq ~ group, data = indt_data)

# Direct entry of summary statistics:
d_ind_t(m1 = 17.75, m2 = 23, sd1 = 3.30,
        sd2 = 2.16, n1 = 4, n2 = 4, a = .05)

# Equivalent shorthand:
d_ind_t(17.75, 23, 3.30, 2.16, 4, 4, .05)

# Using raw data from the dataset:
d_ind_t(mean(indt_data$correctq[indt_data$group == 1]),
        mean(indt_data$correctq[indt_data$group == 2]),
        sd(indt_data$correctq[indt_data$group == 1]),
        sd(indt_data$correctq[indt_data$group == 2]),
        length(indt_data$correctq[indt_data$group == 1]),
        length(indt_data$correctq[indt_data$group == 2]),
        .05)

MOTE documentation built on Dec. 15, 2025, 9:06 a.m.