t.test2: t test 2

Description Usage Arguments Value Note Examples

View source: R/t.test2.R

Description

Perform a t test using summary stats rather than source data

Usage

1
2
3
## S3 method for class 'test2'
t(m1, m2, s1, s2, n1, n2, m0 = 0, equal.variance = FALSE,
  messageLevel = 0)

Arguments

m1

mean of sample 1

m2

mean of sample 2

s1

the sample standard deviation of sample 1

s2

the sample standard deviation of sample 2

n1

the size of sample 1

n2

the size of sample 2

m0

the null value for the difference in means to be tested for. Default is 0.

equal.variance

whether or not to assume equal variance. Default is FALSE.

messageLevel

integer of length 1 indicating the level of diagnostic messages to generate

Value

list of length 4 with elements "Difference of means", "Std Error", "t", and "p-value"

Note

This is based on code written by CrossValidated user Macro. The original can be found at https://stats.stackexchange.com/a/30450

Examples

1
2
3
4
5
x1 = rnorm(100)
x2 = rnorm(200)
# you'll find this output agrees with that of t.test when you input x1,x2
t.test2( mean(x1), mean(x2), sd(x1), sd(x2), 100, 200)
t.test(x1, x2)

debarros/rrttReportBuilder documentation built on Oct. 16, 2020, 4 p.m.