Learn R Programming

MOTE (version 1.2.2)

d_single_t: Cohen's d for One-Sample t from Summary Stats

Description

**Note on function and output names:** This effect size is now implemented with the snake_case function name `d_single_t()` to follow modern R style guidelines. The original dotted version `d.single.t()` is still available as a wrapper for backward compatibility, and both functions return the same list. The returned object includes both the original element names (e.g., `d`, `dlow`, `dhigh`, `m`, `sd`, `se`, `Mlow`, `Mhigh`, `u`, `n`, `df`, `t`, `p`, `estimate`, `statistic`) and newer snake_case aliases (e.g., `d_lower_limit`, `d_upper_limit`, `mean_value`, `sd_value`, `se_value`, `mean_lower_limit`, `mean_upper_limit`, `population_mean`, `sample_size`, `degrees_freedom`, `t_value`, `p_value`). New code should prefer `d_single_t()` and the snake_case output names, but existing code using the older names will continue to work.

Usage

d_single_t(m, u, sd, n, a = 0.05)

d.single.t(m, u, sd, n, a = 0.05)

Value

A list with the following elements:

d

Cohen's \(d\).

dlow

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

dhigh

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

m

Sample mean.

sd

Sample standard deviation.

se

Standard error of the mean.

Mlow, Mhigh

Confidence interval bounds for the mean.

u

Population (reference) mean.

n

Sample size.

df

Degrees of freedom (\(n - 1\)).

t

t-statistic.

p

p-value.

estimate

APA-style formatted string for reporting \(d\) and its CI.

statistic

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

Arguments

m

Sample mean.

u

Population (reference) mean \(\mu\).

sd

Sample standard deviation \(s\).

n

Sample size \(n\).

a

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

Details

Compute Cohen's \(d\) and a noncentral-t confidence interval for a one-sample (single) t-test using summary statistics.

The effect size is defined as the standardized mean difference between the sample mean and the population/reference mean: $$d = \frac{m - \mu}{s}.$$

The corresponding t-statistic is: $$t = \frac{m - \mu}{s/\sqrt{n}}.$$

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

Examples

Run this code
# Example derived from the "singt_data" dataset included in MOTE.

# A school claims their gifted/honors program outperforms the national
# average (1080). Their students' SAT scores (sample) have mean 1370 and
# SD 112.7.

    gift <- t.test(singt_data$SATscore, mu = 1080, alternative = "two.sided")

# Direct entry of summary statistics:
    d_single_t(m = 1370, u = 1080, sd = 112.7, n = 14, a = .05)

# Equivalent shorthand:
    d_single_t(1370, 1080, 112.7, 14, .05)

# Using values from the t-test object and dataset:
    d_single_t(gift$estimate, gift$null.value,
               sd(singt_data$SATscore), length(singt_data$SATscore), .05)

Run the code above in your browser using DataLab