Paired Samples T-Test

The Student’s paired samples t-test (sometimes called a dependent-samples t-test) is used to test the null hypothesis that the difference between pairs of measurements is equal to zero. A low p-value suggests that the null hypothesis is not true, and that the difference between the measurement pairs is not zero.

The Student’s paired samples t-test assumes that pair differences follow a normal distribution – in the case that one is unwilling to assume this, the non-parametric Wilcoxon signed-rank can be used in it’s place (However, note that the Wilcoxon signed-rank has a slightly different null hypothesis; that the two groups of measurements follow the same distribution).

Example usage

data('bugs', package = 'jmv')

ttestPS(bugs, pairs = list(
        list(i1 = 'LDLF', i2 = 'LDHF')))

#  Paired Samples T-Test
#  ──────────────────────────────────────────────────────────────
#                                   statistic    df      p
#  ──────────────────────────────────────────────────────────────
#    LDLF    LDHF    Student's t        -6.65    90.0    < .001
#  ──────────────────────────────────────────────────────────────


data the data as a data frame
pairs a list of lists specifying the pairs of measurement in data
students TRUE (default) or FALSE, perform Student's t-tests
bf TRUE or FALSE (default), provide Bayes factors
bfPrior a number between 0.5 and 2 (default 0.707), the prior width to use in calculating Bayes factors
wilcoxon TRUE or FALSE (default), perform Wilcoxon signed rank tests
hypothesis 'different' (default), 'oneGreater' or 'twoGreater', the alternative hypothesis; measure 1 different to measure 2, measure 1 greater than measure 2, and measure 2 greater than measure 1 respectively
norm TRUE or FALSE (default), perform Shapiro-wilk normality tests
qq TRUE or FALSE (default), provide a Q-Q plot of residuals
meanDiff TRUE or FALSE (default), provide means and standard errors
effectSize TRUE or FALSE (default), provide effect sizes
ci TRUE or FALSE (default), provide confidence intervals
ciWidth a number between 50 and 99.9 (default: 95), the width of confidence intervals
desc TRUE or FALSE (default), provide descriptive statistics
plots TRUE or FALSE (default), provide descriptive plots
miss 'perAnalysis' or 'listwise', how to handle missing values; 'perAnalysis' excludes missing values for individual dependent variables, 'listwise' excludes a row from all analyses if one of its entries is missing


A results object containing:

results$ttest a table
results$norm a table
results$desc a table
results$plots an array of groups

Tables can be converted to data frames with asDF or For example:


Elements in arrays can be accessed with [[n]]. For example:

results$plots[[1]] # accesses the first element