jmv

One Sample T-Test

Example usage

data('ToothGrowth')

ttestOneS(ToothGrowth, vars = c('len', 'dose'))

#
#  One Sample T-Test
#
#  One Sample T-Test
#  ──────────────────────────────────────────────────────
#                           statistic    df      p
#  ──────────────────────────────────────────────────────
#    len     Student's t         19.1    59.0    < .001
#    dose    Student's t         14.4    59.0    < .001
#  ──────────────────────────────────────────────────────
#

Arguments

data the data as a data frame
vars a vector of strings naming the variables of interest 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
mann TRUE or FALSE (default), perform Mann-Whitney U test
testValue a number specifying the value of the null hypothesis
hypothesis 'dt' (default), 'gt' or 'lt', the alternative hypothesis; different to testValue, greater than testValue, and less than testValue respectively
norm TRUE or FALSE (default), perform Shapiro-wilk tests of normality
meanDiff TRUE or FALSE (default), provide means and standard deviations
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.

Returns

A results object containing:

results$ttest a table
results$normality a table
results$descriptives a table
results$plots an image

Tables can be converted to data frames with asDF or as.data.frame(). For example:

results$ttest$asDF

as.data.frame(results$ttest)