ttest: Perform a two-independent sample t-test

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/ttest.R

Description

This function performs a t-test, but does so in a way that adheres to the 7 steps of data analysis (it reports residuals/effect sizes/parameter estimates before showing significance).

Usage

1
ttest(y, x, related = F)

Arguments

y

Either a vector containing the Dependent variable scores, or a vector containing the scores of group 1

x

Either a vector containing the group categories, or a vector containing the scores of group 2

related

Are the two groups related (paired)? Specify true if the people are matched or if there's repeated measures.

Details

The validity of a t-test relies on basic statistical assumptions (normality, homoskedasiticity, and independence). Furthermore, statistical significance can easily be conflated with practical significance. This function is simply a wrapper for r's native t.test function, but outputs the results in such a way that encourages the user to focus on estimation as model appropriateness.

Value

Two objects: cohen's d and a table of estimates (means and difference between groups)

Author(s)

Dustin Fife

See Also

t.test

Examples

1
2
3
4
5
6
7
8
9
# where y and x are scores for group 1 and group 2 (respectively)
y = rnorm(30, 10, 5)
x = rnorm(30, 12, 5)
ttest(y,x)

# where y is all scores and x is the group labels
y = rnorm(300, 10, 5)
x = sample(c(1:2), size=length(y), replace=T)
ttest(y,x)

dustinfife/fifer2 documentation built on Nov. 4, 2019, 11:04 a.m.